• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Multiboard showing gold and built towers

Status
Not open for further replies.
Level 3
Joined
Jun 19, 2017
Messages
19
Hi.

So like in the title, I'd like to create a multiboard showing each player's gold and the number of built towers (tower defence map).

The idea: example for player 1

Each player has 250 gold at the start.
A variable called gold_Player_1 set to 250.
Every time the gold of player 1 gets different than the value of the variable -> re-ajustment of the variable...
Update of the value of the variable in the multiboard...

But if I choose (event type) "Player properties" -> Player 1 (Red)'s current gold becomes different to ???,
I can't choose any variable. It says "No variable of this type generated".

1.jpg

To test, I created 2 variables: 1 real and 1 integer. None is found.

Quite the same problem for the action (set variable):
If I set a integer variable, WorldEdit lets me set gold_Player_1 = (player 1 (Red) current gold).

2.jpg


But when I try to set a real variable, he does not let me choose "Player properties -> Player 1 (Red)'s current gold."

Very confusing at my low skill level.

To do it shorter, in one question:
How to put player current gold in a variable?

Any help would be welcome :)
 
Last edited:
Level 13
Joined
Nov 4, 2006
Messages
1,239
you need an integer variable for gold

Edit: just did some testing and now i get your problem.

anyway, as mentioned use an integer for setting the gold variable.

Leave the event for your first trigger blank and then use a trigger to add the event:

  • Trigger - Add to (your trigger) the event (Player - Player 1 (Red)'s current Gold becomes unequal to (Real(your_integer_gold_variable)))
here you need to convert the integer into a real variable
 
Last edited:
Level 11
Joined
Nov 23, 2013
Messages
665
I encounter the same problem when trying to set an event with Player 1 Current Gold becomes different than X. It seems that X cannot be a variable in this event, whether it is a real or an integer. Looks like it has to be a fixed number.

You may want to try to use a timer with a short duration to re-assign periodically the player's gold to the variable, so you can display it in your multiboard.

For your last question, you need an integer for gold. In case you would really need a real for some reason, you need to convert it into an integer before you can set the gold property with that variable.
 
Level 3
Joined
Jun 19, 2017
Messages
19
Sorry, bad translation of mine.
I wrote entire but meant integear.
Multitable is multiboard in fact.
I'll correct the post.

EDIT:

UreDe4D's solution works fine.

Create a integer variable called gold_Player_1 for example.

1 trigger (trig_1) with no event and no condition:
Actions: -> Set gold_Player_1 = (Player 1 (Red) current gold)
-> Multiboard - set text item in column Y, row X to (String(gold_Player_1))

And another trigger who does the integer / real convertion and adds the event to trig_1:
Events: -> Time - Elapsed game time is 0.5 seconds
Conditions: -> none
Actions: -> Trigger - Add to (Trig_1) the event (Player - Player 1 (Red)'s current gold becomes unequal to (Real(gold_Player_1))

I chose "Time elapsed" for the event of the second trigger, but maybe there are some smarter solutions...

Great thanks!
Would never have found this on my own.
 
Last edited:
Level 3
Joined
Jun 19, 2017
Messages
19
For the counter of the buildings, no special problem.

A real variable called build_Player_1.

A trigger:
Events: -> Unit - A unit finishes construction
Conditions -> (Owner of (constructed structure)) is equal to Player 1 (Red)
Actions -> Set build_Player_1 = (build_Player_1 +1)
->Multiboard - set text item in column Y, row X to (String(build_Player_1))
 
Status
Not open for further replies.
Top