Page 1 of 1
-script- the herb changer -script-
Posted: 10 Oct 2010, 12:54
by lien
hello tmw community ,
normally this script hasn't anybug (I had tested)
you can found it here(pasterbin)
I wish that script is helpful
Lien... &
Wario
Re: -script- the herb changer -script-
Posted: 10 Oct 2010, 13:09
by argul

that is a nice idea...
But do you think an elf would change that in a ration 1:1?
I would put that elf on that map before the graveyard. At some location, where many wisps are flying around?
Pjotr
Re: -script- the herb changer -script-
Posted: 10 Oct 2010, 13:23
by Crush
The script has a critical bug which is not that obvious at first. You are checking the amount of herbs the character has during the dialog, but not again right before doing the exchange. This gives the player the chance to give his herbs away to a mule during the dialog. Then @delitem will do nothing because the character hasn't got any herbs, but @getitems will work properly afterwards. The result is that the player has gained the new herbs without losing the old ones. This means you just just gave the players the opportunity to dupe as many herbs as they want. But it's not like you are the first who made that mistake: we had scripts allowing that exploit in the game for years until we noticed.
On a related note: Having an NPC which exchanges herbs at the rate 1:1 would pretty much defeat the purpose of having differently colored herbs.
Re: -script- the herb changer -script-
Posted: 10 Oct 2010, 13:35
by lien
argul wrote:
that is a nice idea...
But do you think an elf would change that in a ration 1:1?
I would put that elf on that map before the graveyard. At some location, where many wisps are flying around?
Pjotr
1:1... well, if it's 1:2 and player do @num irregular how cut a herb in two parts !
Crush wrote:Having an NPC which exchanges herbs at the rate 1:1 would pretty much defeat the purpose of having differently colored herbs.
It also has an exploit which is not that obvious at first. You are checking the amount of herbs the character has during the dialog, but not again right before doing the exchange. This will allow the player to trade away his herbs during the dialog. Because @delitem will do nothing when the character hasn't got the item but @getitems will work properly afterwards, this will allow the players to duplicate herbs. But don't worry, we trapped in that trap, too.
Code: Select all
if(@num > countitem(@hkind)) goto L_notherb;
can be reuse in L_change ?
Re: -script- the herb changer -script-
Posted: 10 Oct 2010, 13:45
by Crush
lien wrote:1:1... well, if it's 1:2 and player do @num irregular how cut a herb in two parts !
Division always rounds down to the next integer. So when the player enters an uneven number one herb will be lost. Alternatively, let the player enter the number of herbs he wants, not the number he gives.
"How many of my herbs do you want?"
(Player enters 42)
"Then I want 84 of your herbs."
lien wrote:Code: Select all
if(@num > countitem(@hkind)) goto L_notherb;
can be reuse in L_change ?
Yes, checking the number again just before calling delitem will fix this exploit.
Re: -script- the herb changer -script-
Posted: 10 Oct 2010, 13:59
by lien
Crush wrote:lien wrote:1:1... well, if it's 1:2 and player do @num irregular how cut a herb in two parts !
Division always rounds down to the next integer. So when the player enters an uneven number one herb will be lost. Alternatively, let the player enter the number of herbs he wants, not the number he gives.
"How many of my herbs do you want?"
(Player enters 42)
"Then I want 84 of your herbs."
lien wrote:Code: Select all
if(@num > countitem(@hkind)) goto L_notherb;
can be reuse in L_change ?
Yes, checking the number again just before calling delitem will fix this exploit.
ok so L change will looks like something like that
Code: Select all
L_change:
if(@num > countitem(@hkind)) goto L_notherb;
mes "[Elf]";
mes "\"well, there is .\"";
delitem @hkind,@num*2; //ratio 2:1
getitem @want,@num;
close;
}
[edit]
http://pastebin.com/hCw3jSnn here it the V. without the 1:1 ratio ( you have to say before what you want )
Re: -script- the herb changer -script-
Posted: 07 Nov 2010, 19:13
by lien
sorry for double post,
But I was think this type of "quest" can be reusable a lot...
so I did a function
>>on paster bin here<<
it was tested.
for example you can do an script easily like this
Code: Select all
009-1.gat,80,47,0 script pearlchanger 120,{
set @NPCName$, "[test]";
set @item_type$, "pearl";
setarray @menu_Item_Wanted$, "Never Mind", "Diamond", "Ruby", "Emerauld","Sapphire","Topaz","Amethist";
setarray @item_wanted_ID, 0, 4002, 4003, 4004, 4005, 4006, 4007;
set @items_number, 7;
set @ratio, 1;
callfunc "itemchanger";
}
Lien... &
Wario !