Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Help On Scripts

9 years ago

So I am making this game that allows the person to use a backpack to access their things. I have ammo as a variable that is not shown on all pages. Is there a script that will allow it to be shown on just a certain page? If so I could use the help.

Help On Scripts

9 years ago

$PAGETEXT := $PAGETEXT + "Ammo: " + %AMMO

Assuming your variable is named AMMO and you want it to be displayed at the end of the page.

Help On Scripts

9 years ago

Well I want it so when they use their backpack I made a link that says ammo I want it to be displayed on that page.

Help On Scripts

9 years ago

Oh wait, I forgot the easier way: %%AMMO%%

(You can just drop that straight into your page, as I recall)

Help On Scripts

9 years ago

And that should show the player how much ammo they have on that page correct. (I am new to scripting.)

Help On Scripts

9 years ago

It will display the number that is currently in AMMO, yes. You'll have to make sure you're adding to & subtracting from AMMO as appropriate. You might find it helpful to have AMMO displayed on all pages while you're working on the game, so when you play through to test it, you can see exactly what's happening and when. Then, once everything is working right, you can set it to not be displayed.

Help On Scripts

9 years ago

Well great, thanks for the help.

Help On Scripts

9 years ago

Also does anyone know how to set a maximum for an %ITEMUSED3 = 0 how do you set a maximum so the player only has so many uses before (in my case reload) it can't be used?

Help On Scripts

9 years ago

$ITEMUSED is a system variable that tracks how many times a certain item is used. Note that it is prefixed with a dollar symbol, not a percentage sign. In the Items tab, one can edit the maximum uses of a specific item. If a maximum is imposed, after the item reaches this limit, it can no longer be used; setting that item's $ITEMUSED variable to zero resets the count, allowing it to be used again. An item can be limited to one to eight uses, or the limit can be left infinite.

Help On Scripts

9 years ago
Yeah could do item scripting for a bit more control instead as well. For example, this:

IF $ITEMUSED3 = 4 THEN
BEGIN
$DEST := @NONE
END

Would give the "This item can't be used here" pop-up once the item has been used 4 times. You could change the destination to actually be a page, and then add another script somewhere else (Like in the item script of an ammo item) setting it back to zero, like this:

$ITEMUSED3 := 0

Then it would be allowed 4 more uses until the first script kicked back in. Hope that didn't get too confusing.

Help On Scripts

9 years ago

Also is there a way to make it so when a item is used a variable goes down? If so please tell me I am a noob to scripting and trying to learn it.

Help On Scripts

9 years ago

Yes. Items can have scripts attached to them. If you want to lower a variable by one each time a specific item is used, put %VARIABLE := %VARIABLE - 1 in its item script.

Help On Scripts

9 years ago

Oh well thanks again. I think I ask for help from you once.

Help On Scripts

9 years ago
Short answer: Yes
Long answer: Yes, and I literally just showed you how to, haha.

Put the change to the variable you want to make (So %AMMO := %AMMO - 1), in the item script, and whenever the item is used, %AMMO will go down by one.