"SET =" Question

bionicben

New Member
Reaction score
0
Before asking you my question I want to explain to you my map so you can understand how it works. At the start of the game you spawn to select your hero. There are six heroes you may choose, each hero may only be chosen once.

Trigger:
  • Red S
    • Events
      • Unit - A unit enters Warrior <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Unit - Change ownership of Cyrex 0006 <gen> to Player 1 (Red) and Change color
      • Unit - Remove (Triggering unit) from the game
      • Unit - Remove Circle of Power 0036 <gen> from the game
      • Trigger - Turn on Red1 <gen>
      • Unit - Move Cyrex 0006 <gen> instantly to (Center of Spawn Hero <gen>), facing 90.00 degrees

That's an example trigger to show you what I mean. When you choose a hero the hero's ownership is changed from passive to you. That specific hero is then moved to a location and the game begins. Please note that the heroes are already in existence when the game begins, they aren't spawned by trigger.

Now, on to the question. I need a leader/multiboard that can show every players health whether it be by text or some other means. I need the health to update often. Basically so the healer doesn't let people die in the game :p But the problem I am having is displaying their health points and updating them. NOW! The question!

How do you set a integer variable to a units health points?

Trigger:
  • Events
    • Set RedHP = ________.

Thanks for your assistance :]

*edit=typo
 

Squirel

New Member
Reaction score
13
Trigger:
  • Set Variable To Health
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set RedHP = (Life of Variable_Storing_Reds_Hero)


The above trigger should do what you want. You just need a variable that stores red's hero.
 

bionicben

New Member
Reaction score
0
To set red's hero in a variable its like this right?

Trigger:
  • turnon
    • Events
      • Unit - A unit enters Event003 <gen>
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Actions
      • Set RedHero = (Triggering unit)

The variable "RedHero" is a unit variable right?

And where is..
Trigger:
  • Actions
    • Set RedHP = (Life of Variable_Storing_Reds_Hero)
?
 

Squirel

New Member
Reaction score
13
Press new action. Select the action set variable. In the slot Variable, place your REAL (not integer) variable. Click the Value field. Scroll through the Function options and select the item Unit - Property. Leave the field Life as is. Change the field Triggering Unit to your unit variable that stores the player's hero.
 
Reaction score
341
Press new action. Select the action set variable. In the slot Variable, place your REAL (not integer) variable. Click the Value field. Scroll through the Function options and select the item Unit - Property. Leave the field Life as is. Change the field Triggering Unit to your unit variable that stores the player's hero.

He's obviously already solved his problem. :nuts:
 

Squirel

New Member
Reaction score
13
Yeah I started posting before he replied that he solved the problem, but didn't finish the post until after he replied. Sorry!
 

bionicben

New Member
Reaction score
0
I've run into a problem, lol. I can't display the real variable though into the leader board? How do I fix that?
 

Squirel

New Member
Reaction score
13
Try this. Instead of using a real variable, use an integer variable and use this action (RedHP has been changed to an integer variable here):

Trigger:
  • Set Variable To Health
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set RedHP = (Integer((Life of RedHero)))


It uses the action Convert Real to Integer, then the life of RedHero.
 

bionicben

New Member
Reaction score
0
Trigger:
  • (Issued order) Not equal to (Order((Name of Sacrifice)))

I'm not sure what that part meant? Espeically the Name of Sacrifice part.. and

Trigger:
  • Set RedHP = (Integer((Life of RedHero)))
..
I'm sorry I'm such a noob, btw. Must be frustrating to you XD
 

Squirel

New Member
Reaction score
13
OOPS used that trigger to help with another question too. I edited it.

The variable that I am using is now an integer. There is a function for integer variables that is called Conversion - Convert Real to Integer. What this does is take your real which is the health of your unit (WCIII keeps track of unit health to at least 3 decimals) and truncates it so there is no decimal. For instance:

Integer(2.3) = 2
Integer(4.7) = 4

It does not round up.
So since your multiboard will not display a real, I am simply converting the real to an integer.
 

bionicben

New Member
Reaction score
0
Alright, check these and see if I did it right. That took me a minute to understand hahha.
Trigger:
  • Refresh Hp
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set RedHP = (Integer((Life of RedHero)))


Trigger:
  • Set Hero Var
    • Events
      • Unit - A unit enters (Region x)
    • Conditions
    • Actions
      • Set RedHero = (Triggering unit)
 

Squirel

New Member
Reaction score
13
EDIT: It works? Multiboard and all? Thats strange... Can you post the multiboard trigger for me? Ignore this post...

I just looked at the multiboard triggers and found something important! The way that you have that trigger set up was never the issue. What you are saving in these triggers is an integer or a real. What the multiboard wants is a string. Remember what I said about conversions? Well there is a conversion to convert either an integer or a real into a string. You will have to use that function in the multiboard trigger to convert your variable RedHP to a string.

For the set of triggers that you last posted (RedHP is an integer) you would use the function Conversion - Convert Integer to String. The action would look like this:

Trigger:
  • Multiboard - Set the text for YourMultiboard item in column 1, row 1 to (String(RedHP))
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top