• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] About stacking....

Status
Not open for further replies.
Level 4
Joined
Dec 10, 2008
Messages
59
Hello.

Not sure if the thread's title is correct or not...but oh well, i'll explain it via the questions.

I've been thinking, how do you stack integers (like Kill amounts) and set a limit for them? An example will be Shadow Fiend's Necromastery or something in DoTA, where the more he kills, the more attack he gets (and sorry for the constant mentioning of DoTA, not that i like the map, it's just the best map to set references)

So, how do i keep on summing up the integers (in this case, kill counts) and then, say when it reaches 80, it stops adding. Also, how do i REDUCE it, like when Shadow Fiend dies, the number of souls in his Necromastery gets reduced to half. I understand it's triggered (at least, i THINK it is), but i'm not really sure what to input D=

Thanks in advance to any good Samaritans XD
 
Level 7
Joined
Jul 20, 2008
Messages
377
What you want isn't "stacking" - it's incrementing/decrementing.

JASS:
if yourInteger<80 then
   set yourInteger = yourInteger + 1
endif

And to reduce by half:
JASS:
set yourInteger = yourInteger / 2

I used JASS code in this case because it's easy to type and this example is easy to read and easily ported into GUI.
 
Last edited:
Level 4
Joined
Dec 10, 2008
Messages
59
What you want isn't "stacking" - it's incrementing/decrementing.

JASS:
If yourInteger<80 then
   set yourInteger = yourInteger + 1
endif

And to reduce by half:
JASS:
set yourInteger = yourInteger / 2

I used JASS code in this case because it's easy to type and this example is easy to read and easily ported into GUI.

Wokay...i get it...

hmm, then how to i stop it? as in your case, how do i stop it when it becomes more than 80?
 
Level 7
Joined
Jul 20, 2008
Messages
377
You compare inequality.

Like in the first example, it only increments by one IF your integer is less than 80. Have you used if conditions in your maps?
 
Status
Not open for further replies.
Top