• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Unit enters rect - force 2

Status
Not open for further replies.
Level 2
Joined
Aug 29, 2017
Messages
20
Hello, so I've created a trap that is activated by event when unit enters rect but the problem is I want it to be triggered only when force 2 enters. I am sure it is an easy thing to do but I just can't figure it out :cconf:
Anyhelp?
 
Level 2
Joined
Aug 29, 2017
Messages
20
use ownership of entering unit = force 2

how exactly do I do that? I supose its under conditions?

By force 2 you mean team 2 or player 2?

Depending on which one, simply put "triggering player equal to player 2" or "triggering player equal to allies of player 2 (or whatever player is in team 2)" as a condition

I mean team 2. So I have that region(trap) and it activaties whenever anyone comes to it, what I want it to do is to be activated only when team 2 steps on it
I believe you may answered my question but I do not have the knowledge to do it




I ve got model of a statue coming to life as a trap, statue as a statue form is a neutral passive but when the trap is activated it changes to player 1 (user) and morph into living statue form which I wanted but as I said I want it to be activated only when team 2 steps on it

so this is what I've got so far:

1.png


2.png
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Add everyone in the team "force 2" to a player group. You can then test if owner of entering unit is in that player group. The player group is stored in a variable.

These variables could be separate for each force (eg Force1, Force2 etc), or they could be in an array (eg Force[1], Force[2]). Whichever you use is up to you. If using arrays the GUI system will only initialize the first array size indices to contain a player group, anything beyond that will need to be explicitly initialized to contain a player group.

You setup the player groups at map initialization, or after your force alliances are setup. If the players in each force do not vary then you can literally hard code adding the players to the player groups such (add Player 1 (Red) to Force[1], add Player 2 (Blue) to Force[2], add Player 3 (whatever) to Force[2], etc).
 
Level 14
Joined
Nov 30, 2013
Messages
926
Like DSG said, you can use Player Group to run the trigger if the entering unit is an enemy or an ally for the 'trap'. Here's an example of making one.
  • Team Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Team 1 --------
      • Player Group - Add Player 1 (Red) to Team[1]
      • -------- Team 2 --------
      • Player Group - Add Player 2 (Blue) to Team[2]
  • Rekt newb
    • Events
      • Unit - A unit enters Team 1 Reg <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Entering unit)) is in Team[1]) Equal to False
        • Then - Actions
          • -------- When enemy players' unit enters --------
          • Unit - Kill (Triggering unit)
        • Else - Actions
          • -------- When ally players' unit enters --------
          • Do nothing
 
Level 2
Joined
Aug 29, 2017
Messages
20
first of all thank you all very much for the responds! I am really thankful :)

Like DSG said, you can use Player Group to run the trigger if the entering unit is an enemy or an ally for the 'trap'. Here's an example of making one.
  • Team Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Team 1 --------
      • Player Group - Add Player 1 (Red) to Team[1]
      • -------- Team 2 --------
      • Player Group - Add Player 2 (Blue) to Team[2]
  • Rekt newb
    • Events
      • Unit - A unit enters Team 1 Reg <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Entering unit)) is in Team[1]) Equal to False
        • Then - Actions
          • -------- When enemy players' unit enters --------
          • Unit - Kill (Triggering unit)
        • Else - Actions
          • -------- When ally players' unit enters --------
          • Do nothing

Thanks bear_369 this helps a lot!! :)

here is what I've done so far:

6-png.281246


--------------------------------------------------------------------------------------------------------------------------

And I am stuck at:



5-png.281245



Don't have a clue to how to set that option you did, tried all the options in "If - Conditions"
 
Level 2
Joined
Aug 29, 2017
Messages
20
I managed to do it!

To summarize:
I've used WhiteDeath's
Living Statue model and wanted to trigger it to morph from Living Statue (statue) to Living Statue (mobile) and change ownership from neutral passive to user Player1 (red) - The trigger must happen only when enemy unit enters trap which is computer since the map isn't PvP and this worked well for me in this case.

I have managed to do it like this

Event
- Unit - a unit enters Trap <gen>

Actions
-------------Undead Computer (color) enters----------------

- if/then/else action

if Conditions
- (Owner of (triggering unit)) Equal to (==) Purple,Pink,Gray,Dark Green ----->(I have done this separately each for every enemy color)
then Actions - Unit group - Order (units in Trap <gen>) to Special Medivh - Human form ----->(since the main goal was to trigger morphing of a statue that is in statue form to a living statue form)
else Actions - do nothing


--------------Change Statues Ownership------------------
- Unit - Change owenrship of Living Statue (statue) 0048 <gen> to player1 (Red) and change color ----->(To change ownership of statue from Neutral to User (Red) when the trigger is activated)


I would have posted some screenshots but it seems I can't post it due server issues so I hope its understandable enough this way, it might come in handy to someone who finds himself in same problem as I did.

Thank you all for help! I really appreciate it :thumbs_up: +rep to all
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
I assume you used an "or" block for that condition, otherwise it is not possible for the owner of triggering unit to be 2 different players at the same time so the then actions will never run.

Be aware that Do Nothing really does nothing. It is only needed for the RoC non-block conditional actions.
 
Level 2
Joined
Aug 29, 2017
Messages
20
I assume you used an "or" block for that condition, otherwise it is not possible for the owner of triggering unit to be 2 different players at the same time so the then actions will never run.

Be aware that Do Nothing really does nothing. It is only needed for the RoC non-block conditional actions.


I've created

Multiple Functionslf (All conditions are true) then do (Then Actions) else do (Else Actions)

if Conditions - (Owner of (triggering unit)) Equal to (==) Purple
then Actions - Unit group - Order (units in Trap <gen>) to Special Medivh - Human form
else Actions - do nothing


So now I've copied this 3 times and in each changed owner of triggering unit to different computer enemy color
and so now whenever any unit of those colors enters the trap the Statues transform using Crow ability, change ownership from neutral to Player1 and automaticly attack the enemy :)
 

Attachments

  • Picture2 copy.png
    Picture2 copy.png
    64 KB · Views: 39
Level 14
Joined
Nov 30, 2013
Messages
926
I've created

Multiple Functionslf (All conditions are true) then do (Then Actions) else do (Else Actions)

if Conditions - (Owner of (triggering unit)) Equal to (==) Purple
then Actions - Unit group - Order (units in Trap <gen>) to Special Medivh - Human form
else Actions - do nothing


So now I've copied this 3 times and in each changed owner of triggering unit to different computer enemy color
and so now whenever any unit of those colors enters the trap the Statues transform using Crow ability, change ownership from neutral to Player1 and automaticly attack the enemy :)
It should work depending on what you wanted to be, but it's messy and unorganized for obvious reason.
You can use "Or - Multiple Conditions" inside the "If" block, that way it's more cleaner and easier for you to read.
  • Trap
    • Events
      • Unit - A unit enters Trap <gen>
    • Conditions
    • Actions
      • -------- Enemy Computers --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Triggering unit)) Equal to Player 4 (Purple)
              • (Owner of (Triggering unit)) Equal to Player 9 (Gray)
              • (Owner of (Triggering unit)) Equal to Player 8 (Pink)
              • (Owner of (Triggering unit)) Equal to Player 11 (Dark Green)
        • Then - Actions
          • Unit Group - Order (Units in Trap <gen>) to Special Medivh - Human Form
        • Else - Actions
      • -------- Other actions below --------
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
So now I've copied this 3 times and in each changed owner of triggering unit to different computer enemy color
The computer scientist in me dies a little every time I see someone do that...

I suggest doing what bear_369 has posted as it is infinitely more readable and maintainable. It does not duplicate the actions 4 times so if you ever want to change them you only have to change them in 1 place. This is less prone to making mistakes and results in higher triggering productivity.
 
Level 2
Joined
Aug 29, 2017
Messages
20
It should work depending on what you wanted to be, but it's messy and unorganized for obvious reason.
You can use "Or - Multiple Conditions" inside the "If" block, that way it's more cleaner and easier for you to read.
  • Trap
    • Events
      • Unit - A unit enters Trap <gen>
    • Conditions
    • Actions
      • -------- Enemy Computers --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Triggering unit)) Equal to Player 4 (Purple)
              • (Owner of (Triggering unit)) Equal to Player 9 (Gray)
              • (Owner of (Triggering unit)) Equal to Player 8 (Pink)
              • (Owner of (Triggering unit)) Equal to Player 11 (Dark Green)
        • Then - Actions
          • Unit Group - Order (Units in Trap <gen>) to Special Medivh - Human Form
        • Else - Actions
      • -------- Other actions below --------


Yeah I know its a mess, thank you very much for making it more organized and much more approachable :) I think I am getting a hang of it now :grin:



The computer scientist in me dies a little every time I see someone do that...

I suggest doing what bear_369 has posted as it is infinitely more readable and maintainable. It does not duplicate the actions 4 times so if you ever want to change them you only have to change them in 1 place. This is less prone to making mistakes and results in higher triggering productivity.

:alol::alol:
Yeah seeing it like that really gives me a headache too but I don't have any skills in the triggering field yet so I had to improvise, what else can I do :D but I think I am getting to understant it now. It seems to me that when you get to undestand the foundations of it you mostly just play around with it later :)


And once again thank you very much for the help guys, you really saved me a lot of time and spared me a lot of nerves trying to get this to work :thumbs_up:
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
I didn't understand, could you elaborate how it's used in RoC?
RoC does (or did) not have the block if then else actions. It only had the single condition single line action if then else. Since all arguments must be valid, one needed to specify an action for both the then and else parameters. If you did not want it to do anything, that action had to be Do Nothing, hence the name and what it does. With the block based if then else actions this is not needed as it is valid to leave one of the blocks empty.
 
Status
Not open for further replies.
Top