PDA

View Full Version : Duplicating an item class?



Binx
04-27-2013, 03:23 PM
Ok, it seems to me this should be really simple, but thus far, even the most basic of scripts seem to be above my head. I'm looking for an item script that will simply clone an existing item class and set it to a custom class. The basic idea is that if I want, say, a fire or ice rod, existing scripts (the ones I've seen, at least) would have me attach it to a wand, so I wouldn't be able to place both into different slots on the subscreen. What I'm specifically wanting to do is to clone the Potions item class, so that I can have different types of potion (HP, MP, HP/MP) occupy different slots. But I'm sure I'd find other uses for it down the line. New things to try occur to me all the time.

Zim
04-27-2013, 04:27 PM
Ok, it seems to me this should be really simple, but thus far, even the most basic of scripts seem to be above my head. I'm looking for an item script that will simply clone an existing item class and set it to a custom class. The basic idea is that if I want, say, a fire or ice rod, existing scripts (the ones I've seen, at least) would have me attach it to a wand, so I wouldn't be able to place both into different slots on the subscreen. What I'm specifically wanting to do is to clone the Potions item class, so that I can have different types of potion (HP, MP, HP/MP) occupy different slots. But I'm sure I'd find other uses for it down the line. New things to try occur to me all the time.


item script Potion
{
void run(int a,int b, int c)
{
if(a==0){Link->HP+=b;}
if(a==1){Link->MP+=c;}
if(a==2){Link->HP+=b;Link->MP+=c;}
}
}

Set this script to your custom item script slot.
Arg D0 set to 0 is HP potion, 1 is MP potion, 2 is HP/MP.
Arg D1 is amount of HP it will recover.
Arg D2 is amount of MP it will recover.
Place the item script outside your global.

Binx
04-27-2013, 04:56 PM
Ok, so the attributes in the item editor can all be set in a script the way you did here, then? Thanks a lot for the script. I'll implement it right away


EDIT: Thanks a lot, it works perfectly!