Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Item variables..

11 years ago

Probably an easy question (I'm having a brain dead day...) but,

1. How do you add an item, that when accepted into the player's inventory adjusts stats or variables. 

I thought that on item creation I could just add/subtract a value but it doesn't seem to be the case. For example, say I give you a sword, that sword should give you +10 attack while it remains in your possession and until it's dropped.

I'm using the 'attack' stat as a variable, as in game events/decisions can affect it. 

I'm thinking it has something to do with scripting... Or I'm missing something obvious (brain dead day y'see...)

Any help?

Item variables..

11 years ago

Theres a system state variable that tells whether the item is in possesion or not. Then you have to create a global script that I can't figure out yet.

Item variables..

11 years ago

Galo's correct.

Create the Item, make note of the Item # (for this example say it is 10), then in Global Script add:

IF $ITEMSTATE10 = 1 THEN
%MODATTACK := %ATTACK + 10

IF $ITEMSTATE10 = 0 THEN
%MODATTAC := %ATTACK

 

Item variables..

11 years ago

And then you have to use the MODATTAC variable instead of ATTACK.

Item variables..

11 years ago

Cripes...

So basically, assuming I had an item modify three stats I'd have to create the three modstats for that 'state'?

I assume the modstat variable is re-usable with different or multiple items though?

Say, I have six items modifying the same value, if I linked them all to the MODATTACK stat it would stack aye?

Hmm..

Item variables..

11 years ago

It won't stack. For the other items you would have to write this below the first one(assuming that the item is item 4 and adds 17 to attack):

IF $ITEMSTATE4 = 1 THEN
%MODATTACK := %MODATTAC + 17

Item variables..

11 years ago

Easiest way would be to start of with:

%MODATTACK := %BASEATTACK

Then for all the possible items:

IF $ITEMSTATE4 = 1 THEN
%MODATTACK := %MODATTACK + 17

IF $ITEMSTATE5 = 1 THEN
%MODATTACK := %MODATTACK + 15

 

And so on, and so forth.

Item variables..

11 years ago

Triple yikes. :P

Ok, thanks all :) 

I'll try and make it work or find alternative methods. *ponder*

Item variables..

11 years ago

That's really as simple as it gets lol.

All you're doing is setting their attack to some base attack that you have saved (like if they always do 10 by default, it's 10), then adding to that some number whenever a certain item is found in their possession.

Item variables..

11 years ago

Scripting is very powerful, but requires excruciating detail just to do something relatively simple. In my Dungeon Stompage game, each swing of a weapon runs a script a couple hundred lines long....

Item variables..

11 years ago

Arrays, loops, and strings would make things much much easier :(

Item variables..

11 years ago

Hmm, I was going to do the item-variation to make a 'war-game' where each item would be a 'unit' that would contribute to a set of values.

Then the player could select a course of action and the final tally would be used vs the enemy tally for a win/lose result.

The items being a method of recruitment per se. Though, I suppose another alternative is to use it a variable (if=1 then +10 or whatever) in fact, I may save myself the trouble in the long run and make each war scenario self-contained with minor variations of unit and abilities so I can limit that impact... Partially cos I have a codex, variable combat system and so on in the mix and I fear if I put coding in for each war battle I'm going to be writing this damn thing until 2050... Spent enough time on it so far... O_o

 

I digress/ramble! Back to the drawing board!