Page 1 of 1

i need help=with equiping items

PostPosted: Tue Jan 26, 2010 9:51 am
by Lexcondran
in my game i have this thing where i want to click on the image
and then it turns red = its equipped and then adds its stats to the players stats
unfortunately my issue is it wont work or do anyhting thats on create actor
when i put the scirpt into draw actor it jsut keeps adding to the stats infinitely and wont stop.
... very confusing and another stump in my road to make my dang Rpg awesome
=My rpg is basically a huge compilation playground for new people to figure stuff out to make their own rpgs

Re: i need help=with equiping items

PostPosted: Tue Jan 26, 2010 7:55 pm
by Leif
Add new actor variable "Equipped" (integer, for example). It will be 1 if item is equipped and 0 - if not.

On item's CreateActor Event

Code: Select all
Equipped=0;


On item's MouseDown Event

Code: Select all
if (Equipped==0)
{
Equipped=1;
// add parameters
hero.attack=hero.attack+item.attack;
...
//make item red
ChangeAnimation("item", "red", FORWARD);
}

else

{
Equipped=0;
// subtract  parameters
hero.attack=hero.attack-item.attack;
...
//make item normal
ChangeAnimation("item", "normal", FORWARD);
}