"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
 
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.
 
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)
?
 
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.
 
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:
 
Yeah I started posting before he replied that he solved the problem, but didn't finish the post until after he replied. Sorry!
 
I've run into a problem, lol. I can't display the real variable though into the leader board? How do I fix that?
 
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.
 
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
 
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.
 
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)
 
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 The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      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