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

Help with trigger?

Status
Not open for further replies.
Level 2
Joined
Nov 21, 2010
Messages
14
Hello everybody! i'm currently learning how to use triggers and I have a problem creating one. My objective with the trigger I'm creating, is to make it so when somebody enters a secret code, he will be able to build a unit that nobody can. Can somebody please tell me how to do it?
Thanks in advance.
 
Level 2
Joined
Nov 21, 2010
Messages
14
How do I make it so that the triggering player gets the unit?
I think ive got the first part down, but under my actions, it says
"Tech Tree- Allow unit for Player 1"
Please advice
 
Level 2
Joined
Nov 21, 2010
Messages
14
Also, I think I have to make a requirement to make it so that the unit can only be built when the code is entered.
Sorry for the double post.
What do you think?
 
Level 13
Joined
Apr 15, 2008
Messages
1,063
Do you want the player to be given one unit, or be able to build a new type of units?
For the first, use "Unit - Create 1 (unit type) for (triggering player)"
For the second, I guess the Techtree thing should work, but you will need to disable the unit for everyone first (at map initialization), and then allow it to those who know the code.

Also, you propably would need "Clear text messages", so other players won't be able to read the code.
Also, if you are giving player the unit, you need to check whether he was already given one, so that he won't be able to spam these bonus units. (Either count units in unit group, OR use some boolean array, where you save who used the code in this game)
 

Dr Super Good

Spell Reviewer
Level 65
Joined
Jan 18, 2005
Messages
27,290
(although now it only takes 16 bits to save a group...)
I take it you have proof for this statement? Like people disassembling the game to see how they work? Frankly I imagine that the overhead for just the object is 64-128 bits (if lucky) as you have the garbage collection counter and the object ID to manage.

Groups of units and players were never meant to be ordered, just a way of refering to all of the contense. If you want order, you must use arrays.
 
Level 2
Joined
Nov 21, 2010
Messages
14
Thanks for the help, but I realized even after "clearing text messages" the player can still check the message log to see what the code is. Is there anyway to clear the message log too? I havent found any triggers for it.
 
Level 13
Joined
Apr 15, 2008
Messages
1,063
If you hid menu frame, message log propably won't be accesible, even with hotkey.
(Main menu is then bound on ESC)

I take it you have proof for this statement?.
No, I just supposed that's because it's possible, it would be done this way. It's true that it beeing an object takes up a lot more memory than the actual data.
But from what I observed, it seems that object data is saved outside the 2MB space, so it really doesn't matter, because whatever the map uses up, it will be but a fraction of the 600MB starcraft needs just to run :grin:

Yes it's main purpose wasn't to be ordered, but it sure is useful. Besides, unit group is still ordered.
 
Guys.. guys.. guys.

Make all players be able to train the unit in question, then using this same trigger disallow the unit to be trained, re-allowing it later.:

Trigger-6.png
 
Status
Not open for further replies.
Top