add function in item_db2 script

madtoyz

New member
Messages
173
Points
0
hello,last a few years ago i have request henshin function in eAthena.ws/board but the forum already down.

im still save the script function but i forget how to add the function into item_db2 script

here is the function.

function script Henshin { set .@i,(HP*100/MaxHP*100)/100; if (.@i < 10) { specialeffect2 EF_HEAL; specialeffect2 EF_POTION_BERSERK; unittalk getcharid(3),"Henshin!!"; disguise 1785; percentheal 100,0; sleep2 10000; undisguise; } end;}//-- eof --
when player HP below 10% using certain items that got this function will change become monster,if this function will disguise player become atros and will say HENSHIN.

 
Simply, in the OnUse script of a file (the first curly braces) make it to contain the following:

callfunc "Henshin";

This should make it work.

 
Simply, in the OnUse script of a file (the first curly braces) make it to contain the following:

callfunc "Henshin";

This should make it work.
like this ?

Code:
29018,kamenriderhelm,kamen rider helm,5,0,,0,,0,,0,0xFFFFFFFF,7,2,7168,,0,0,29018,{},{},{ callfunc "Henshin"; }
 
Yes, but on the first curlys, not in the last ones. The first is meant for when an item is used, the second is meant for when an equip is equipped (has almost no sense since the first curlys also get executed when you equip something) and the last ones are meant for the OnUnequip event.

Should be like this:

29018,kamenriderhelm,kamen rider helm,5,0,,0,,0,,0,0xFFFFFFFF,7,2,7168,,0,0,29018,{ callfunc "Henshin"; },{},{}

Test it before using it on a production server
default_wink.png
.

EDIT: Corrected a big fail.

 
Last edited by a moderator:
ive try it already but nothing happen.

the script i make it name Henshin.txt

and put it in npc/basicnpc/change/Henshin.txt

function script Henshin { set .@i,(HP*100/MaxHP*100)/100; if (.@i < 30) { specialeffect2 EF_HEAL; specialeffect2 EF_POTION_BERSERK; unittalk getcharid(3),"Henshin!!"; disguise 1785; percentheal 100,0; sleep2 10000; undisguise; } end;}//-- eof --

in the scripts_custom.conf i already writedown like this.

npc: npc/basicnpc/change/Henshin.txt
in the item_db2 i put like this

29949,Batman_Helmet,Batman Helmet,5,0,,0,,0,,0,0xFFFFFFFF,7,2,3072,,0,0,2048,{},{},{ callfunc "Henshin"; }
when the user have 30% less HP,they will auto disguise become Atros (numid1785)

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
 
WHOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOPS, big fail of mine, the script should go on the first curlies as I said but I didn't change it.

Try this:

29949,Batman_Helmet,Batman Helmet,5,0,,0,,0,,0,0xFFFFFFFF,7,2,3072,,0,0,2048,{ callfunc "Henshin"; },{},{}

Sorry!

 
WHOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOPS, big fail of mine, the script should go on the first curlies as I said but I didn't change it.

Try this:

29949,Batman_Helmet,Batman Helmet,5,0,,0,,0,,0,0xFFFFFFFF,7,2,3072,,0,0,2048,{ callfunc "Henshin"; },{},{}

Sorry!
i try it already but still same just before, not working ... 

29949,Batman_Helmet,Batman Helmet,5,0,,0,,0,,0,0xFFFFFFFF,7,2,3072,,0,0,2048,{ callfunc "Henshin"; },{},{}
loadnpc - npc/basicnpc/change/Henshing.txt - done. (have try but no working) then i try

server restart - done. (have try but no working)

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

Untitled_zps53423eec.jpg


 
Will try script on local server then edit. Trying ATM.

Edit:

Better in a new post since you replied =P

 
Last edited by a moderator:
It works on my side, but don't know any means of recording it.

Steps I've done:

[*]Copied over the item on my db/item_db2.txt

[*]Created a new NPC file on my folder, called henshin.txt (which is npc/custom/bote). No clientside files required, but I'll only see an Apple sprite.

[*]Opened server.

[*]Issued @loadnpc npc/custom/bote/henshin.txt (you should use the npc path in your server).

[*]Check @loadnpc feedback (script loaded) and the map server console to see if there was any warning/error. No errors.

[*]Use @item 29949 30. See that's a headgear so I dropped 29 of them
default_laugh.png
.

[*]Damaged myself to almost death, then use the item. Item works.

Only issue I see is that the script executes twice without any known reason to me, maybe because it uses 2 equipment slots?

Pics:

cVsxuFY.jpg
WqL7ayL.jpg


 
Last edited by a moderator:
Code:
function    script    Henshin    {    set @sr,1;    specialeffect2 EF_HEAL;    specialeffect2 EF_POTION_BERSERK;    unittalk getcharid(3),"Henshin!!";    disguise 1785;    percentheal 100,0;    sleep2 10000;    undisguise;    set @sr,0;    end;}
Code:
autobonus2 "{if(((HP*100/MaxHP*100)/100) >=30 || @sr ) end; callfunc "Henshin"; }",10000,10000,BF_WEAPON|BF_MAGIC;
 
the problem here is,player will always can equip the items when reach HP 30% ...

i thought third curlys is the best way to put function script but its not support. /swt

i try put in the first curlys ( mean when HP 30%,player equip the costume headgear,function will working and after disguise is finish,player can unequip back the costume until HP 30% and HENSHIN again ) /huh

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
 
Don't understand very well, this is what I understood:

If user equips it with >30% this has no effect; else call the function Henshin.

Or maybe you meant:

User can't equip this with >30%; if equipped call Henshin function, then when its effect ends auto unequip the headgear.

 
function  script  Henshin  {  set @sr,1;  specialeffect2 EF_HEAL;  specialeffect2 EF_POTION_BERSERK;  unittalk getcharid(3),"Henshin!!";  disguise 1785;  percentheal 100,0;  sleep2 10000;  undisguise;  set @sr,0;  end;}


Code:
autobonus2 "{if(((HP*100/MaxHP*100)/100) >=30 || @sr ) end; callfunc "Henshin"; }",10000,10000,BF_WEAPON|BF_MAGIC;
After i try this autobonus2 put in the first curlys, no need to unequip item,they will auto HENSHIN..

and { callfunc "Henshin"; } also can use....

DONE. ( sorry for my mistake )

 
Last edited by a moderator:
Back
Top