-script- the herb changer -script-

Content and general development discussion, including quest scripts and server code. TMW Classic is a project comprising the Legacy tmwAthena server & the designated improved engine server based on evolHercules.


Forum rules

This forum houses many years of development, tracing back to some of the earliest posts that exist on the board.

Its current use is for the continued development of the server and game it has always served: TMW Classic.

Post Reply
User avatar
lien
Warrior
Warrior
Posts: 446
Joined: 30 Oct 2008, 08:59
Location: France

-script- the herb changer -script-

Post by lien »

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: 08 Aug 2010, 18:43

Re: -script- the herb changer -script-

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

Re: -script- the herb changer -script-

Post 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.
  • 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
Warrior
Warrior
Posts: 446
Joined: 30 Oct 2008, 08:59
Location: France

Re: -script- the herb changer -script-

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

Re: -script- the herb changer -script-

Post 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.
  • 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
Warrior
Warrior
Posts: 446
Joined: 30 Oct 2008, 08:59
Location: France

Re: -script- the herb changer -script-

Post 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 )
Image
User avatar
lien
Warrior
Warrior
Posts: 446
Joined: 30 Oct 2008, 08:59
Location: France

Re: -script- the herb changer -script-

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