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

[Solved] Question regarding Interger variable

Status
Not open for further replies.
Level 3
Joined
Mar 6, 2016
Messages
29
Hello. So i've been using a step by step guide to make a leaderboard for my map. I just see one difference, which I cannot figure out how to fix.

Code:
    Events
        Unit - A unit Dies
    Conditions
        ((Killing unit) belongs to an ally of Player 1 (Red)) Equal to True
    Actions
        Set Player_Kills[(Player number of (Owner of (Killing unit)))] = (Player_Kills[(Player number of (Owner of (Killing unit)))] [U]+ 1)[/U]
        Leaderboard - Change the value for (Owner of (Killing unit)) in (Last created leaderboard) to Player_Kills[(Player number of (Owner of (Killing unit)))]
        Leaderboard - Sort (Last created leaderboard) by Value in Descending order

This is the last step in the guide. I've underlined and marked my issue. I have the exact same trigger, I just done have that single +1.

I've attached a screenshot of my trigger, just in case.

Any help much appreciated!
 

Attachments

  • 1.png
    1.png
    11.9 KB · Views: 86
Level 7
Joined
Jun 14, 2009
Messages
235
You need to add it as an integer value.

The trigger you have in the picture just sets PlayerKills equal to itself. You need to use Arithmetic to add 1
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
When selecting your integer value, you have chosen to use a variable.
The variable that you used is an array of integers.

What you have to do is do a calculation on that value, so you use arithmetics (which are very basic math operators).
So instead of choosing your array, you select the dropdown of functions and choose arithmetics.
 
This is not really related to a variable issue, but as explained it has something to do with
missing arithmtic operation.

In GUI you can set the integer variable to (something like):
- preset value
- variable
- function
- Input box (where you can write your own number)


You used "variable" in your example, and just set it to YourVariable again, which obviously won't change something.
When you choose "functions", you can go to "arithmetic" and then make a sum of: YourVariable + 1 .. this will do the trick.

This is how to easily post triggers: http://www.hiveworkshop.com/forums/miscellaneous-tutorials-456/how-easily-post-triggers-163285/
 
Status
Not open for further replies.
Top