Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Fedx on Sat 02/05/2009 03:17:19

Title: Add and sustract 2 custom properties.
Post by: Fedx on Sat 02/05/2009 03:17:19
I'm doing this Yu-Gi-Oh kind of game, and I was wondering how can I make this:
I created a custom property called AttackPower. I have a monster with 8000 of AttackPower and another with 6000. I also have a bool global variable called IsMonsterAtk set to False. I know I have to put in the rep_exec a function that checks if IsMonsterAtk is True, and if so, check wich card is atacking and wich is defending, do the sustraction and declare a winner. But how do I do that?

BTW, the cards are inventory items, there's an inventory below the playable field.
Title: Re: Add and sustract 2 custom properties.
Post by: Trent R on Sat 02/05/2009 04:49:31
Well, you can't change properties at run-time (I assume you used the built in schema).. but there's many ways to so this. Structs, arrays, local vars, and my personal fav-extender functions.

I'd suggest creating another script (as if doing a module) and creating variables (or a dynamic array-see manual entry) in the module script. Create Get and Set (and Mod, if you want) functions that change and return those variables. Add the import declarations in the module header and you should be done.


~Trent
PS-Yeah I know that didn't explain much, but I'm tired now. I'll probably come back later with a script or something, or someone else may explain a better way.
Title: Re: Add and sustract 2 custom properties.
Post by: Fedx on Sat 02/05/2009 17:44:07
Ok! Thanks, I will at least try to do that.