-script- the herb changer -script-

Content and general development discussion, including maps, quests, and server code from the development team.
Post Reply
User avatar
lien
Novice
Novice
Posts: 446
Joined: Thu Oct 30, 2008 9:59 am
Location: France

-script- the herb changer -script-

Post by lien » Sun Oct 10, 2010 1:54 pm

hello tmw community ,
normally this script hasn't anybug (I had tested) :mrgreen:
you can found it here(pasterbin)

I wish that script is helpful :wink:

Lien... & Wario
Image
User avatar
argul
Novice
Novice
Posts: 237
Joined: Sun Aug 08, 2010 7:43 pm

Re: -script- the herb changer -script-

Post by argul » Sun Oct 10, 2010 2:09 pm

:-) 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
---
User avatar
Crush
TMW Adviser
TMW Adviser
Posts: 8046
Joined: Thu Aug 25, 2005 5:08 pm
Location: Germany

Re: -script- the herb changer -script-

Post by Crush » Sun Oct 10, 2010 2:23 pm

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.
  • former Manasource Programmer
  • former TMW Pixel artist
  • NOT a game master

Please do not send me any inquiries regarding player accounts on TMW.


You might have heard a certain rumor about me. This rumor is completely false. You might also have heard the other rumor about me. This rumor is 100% accurate.
User avatar
lien
Novice
Novice
Posts: 446
Joined: Thu Oct 30, 2008 9:59 am
Location: France

Re: -script- the herb changer -script-

Post by lien » Sun Oct 10, 2010 2:35 pm

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 ?
Image
User avatar
Crush
TMW Adviser
TMW Adviser
Posts: 8046
Joined: Thu Aug 25, 2005 5:08 pm
Location: Germany

Re: -script- the herb changer -script-

Post by Crush » Sun Oct 10, 2010 2:45 pm

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.
  • former Manasource Programmer
  • former TMW Pixel artist
  • NOT a game master

Please do not send me any inquiries regarding player accounts on TMW.


You might have heard a certain rumor about me. This rumor is completely false. You might also have heard the other rumor about me. This rumor is 100% accurate.
User avatar
lien
Novice
Novice
Posts: 446
Joined: Thu Oct 30, 2008 9:59 am
Location: France

Re: -script- the herb changer -script-

Post by lien » Sun Oct 10, 2010 2:59 pm

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 )
Image
User avatar
lien
Novice
Novice
Posts: 446
Joined: Thu Oct 30, 2008 9:59 am
Location: France

Re: -script- the herb changer -script-

Post by lien » Sun Nov 07, 2010 8:13 pm

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 !
Image
Post Reply