Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Items... yet again.

10 years ago

Is there any way I could have a variable that relates to the item?

Let's say the item is a handgun.  The handgun starts out with 15 bullets, and using the variable settings I could easily award the player more clips of 15 as the game goes on, but how would I do that and still anchor it to the item?

Items... yet again.

10 years ago

Sort answer: yes.

Long answer: you'd need to explain exactly what you what if you want more detail, because saying you want to "anchor" a variable to an item doesn't really make sense.
 

Items... yet again.

10 years ago

When you want to award players more clips, put this code in the link that you're using to award them.

%CLIP := 15

Items... yet again.

10 years ago
Go to the gun's item script. It should be under the items tab. Look at my example below. In this example, the page numbered 37 is a page where the gun is used successfully. The page numbered 05 is a page where the player attempts to use the gun, only to find out that he has no bullets. This example assumes that there are three clips and only one bullet is expended per item use.

%TOTALCLIP := %CLIP1 +%CLIP2 + %CLIP3

IF %TOTALCLIP > 0 THEN $DEST := @P37

IF %CLIP1 > 0 THEN %CLIP1 := %CLIP1 - 1
IF %CLIP1 = 0 AND %CLIP2 > 0 THEN %CLIP2 := %CLIP2 - 1
IF %CLIP1 = 0 AND %CLIP2 = 0 AND %CLIP3 > 0 THEN %CLIP3 := %CLIP3 - 1

IF %TOTALCLIP = 0 THEN $DEST := @P05

Items... yet again.

10 years ago
@JDeath7