• 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.

[JASS] increment or decrement function

Status
Not open for further replies.
Level 3
Joined
Aug 25, 2012
Messages
30
Hello, I am totaly newbie to Jass, but i need a simple function, that when i call with integrer parameter, it increases/decreases it by 1, so I dont have to create a structures like this (there are +- 30 of these structures in my map, and more comming...)
  • Set PlayerKills[(Player number of (Owner of (Killing unit)))] = (PlayerKills[(Player number of (Owner of (Killing unit)))] + 1)
 
Level 3
Joined
Aug 25, 2012
Messages
30
Thanks for response, i was only wondering if there is something similar to <variable>++ like in other programming languages i know (C#, Java, PHP, etc.)
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
No there isn't. Technically you can do it in zinc and cjass, but that is just interfaced. It ends up doing the same thing. Although, you can always make your own increment/decrement functions. But I only recommend doing that if you are comfortable with JASS.

You can't, at least for what is asked, being able to use an integer parameter, since functions arguments are taken as value, not as reference.
 
Status
Not open for further replies.
Top