Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

[Answered] Assigning Attributes to Items

15 years ago
Is it possible to assign variable amounts to items? For instance, if I wanted to make, say, a sword that has a ATTACK value of 15, can I do that? Or do we not have a way yet?

[Answered] Assigning Attributes to Items

15 years ago

It's simplest if I give you an example:

Let's say you have a weapon called "Sword", and you want it to do 15 damage per attack. If the player had the weapon in their inventory, that could open up a link that said ATTACK WITH SWORD whever you had a chance to attack an enemy. That link would decrease enemy HP by 15. So basically it's "If you have SWORD equipped, you can select the ATTACK WITH SWORD link, and this decreases ENEMYHP by 15.

That's a simple method of attaching variables to items. I know, it seems like a tedious hassle. But that's the only way I know how to do it. I'm sure there's some sort of magic you can pull off using Script, but I don't know.

[Answered] Assigning Attributes to Items

15 years ago

You can't assign variables directly to items as far as I know, no. Sorry, but you'll have to do it the hard/only way. Sort of say something like a $ITEMSTATE13 system variable (check my article on scripting items for more info, and we're assuming here that the sword is item number 13 in your storygame) and in this example if it's set to 0 then it means fighting bare hands and if it's set to 1 it means you have the sword in your inventory and you do more attack. There'd also be a variable for how much damage you do (%DAMAGE) and that'd be altered depending on whether you have a sword or not. And there's one for the enemy's health (%ENEMYHP).

 

IF $ITEMSTATE13 = 0 THEN

%DAMAGE := 5

ELSE $ITEMSTATE13 = 1 THEN

%DAMAGE := 15

END

 

Now for attacking you'd use this script.

 

%ENEMYHP := %ENEMYHP - %DAMAGE

 

That's the only way I can think of for doing it. You should probably get another scripter to go over this, I literally haven't scripted in almost a year now.

[Answered] Assigning Attributes to Items

15 years ago
I prefer October's over Anubis's way.

[Answered] Assigning Attributes to Items

15 years ago
Also to note: there is a script in the editor that allows you to manipulate a variable on item use. I believe its in the item's own settings, whenever the item is "used" it executes an item script specific to that item.

so in that specific item's script you can have:

%DAMAGE := 15

and then whenever you use the item, you can take the user to the page where they fight and have a link that says Attack, and that link will account for the damage by applying %ENMYHP := %ENMYHP - %DAMAGE.


For the record, i wouldnt use this method cause it causes an extra page to be constructed to account for the swords' use. However, it is just something i wanted noted.