• 🏆 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!

[Solved] change owner wont work (with photo&trigger tag)

Status
Not open for further replies.
Level 5
Joined
May 8, 2009
Messages
87
what i am trying to do is to change the flag (Capture Point) owner from player 12 to player 6,
but you need to have all 5 heroes at the same time in the same region (001) to work.
but it doesn't work.

any ideas?

ps am working on this like 6 hours.


  • Events
    • Unit - A unit enters Region 001 <gen>
  • Conditions
    • (Owner of Capture Point 0018 <gen>) Equal to Player 12 (Brown)
    • (Number of units in (Units in Region 000 <gen> owned by Neutral Passive)) Equal to 10
    • (Number of units in (Units in Region 001 <gen> owned by Player 1 (Red))) Equal to 1
    • (Number of units in (Units in Region 001 <gen> owned by Player 2 (Blue))) Equal to 1
    • (Number of units in (Units in Region 001 <gen> owned by Player 3 (Teal))) Equal to 1
    • (Number of units in (Units in Region 001 <gen> owned by Player 4 (Purple))) Equal to 1
    • (Number of units in (Units in Region 001 <gen> owned by Player 5 (Yellow))) Equal to 1
  • Actions
    • Unit - Change ownership of Capture Point 0018 <gen> to Player 6 (Orange) and Change color
    • Unit Group - Pick every unit in (Units in Region 000 <gen> owned by Neutral Passive) and do (Unit - Change ownership of (Picked unit) to Player 6 (Orange) and Change color)
war3_Qand_A.jpg


41 minutes later,constantly refreshing the screen,16 views and no answer.this is depressing. :(
 
Last edited by a moderator:
Level 13
Joined
Mar 24, 2013
Messages
1,105
Besides the fact that you're leaking 7 unit groups, it could optimized to only use 2. However, it should be working.

So, lets debug. Move each of those conditions to the actions inside different If statements. For example you'll have if owner of capture point is brown. Then Print Brown. Next If, number of units in region owned by player 1. Then print the number of units in region owned by player 1.

Once you see what is being printed, the issue should become more apparent.
 
Level 5
Joined
May 8, 2009
Messages
87
you mean something like this?

  • If ((Number of units in (Units in Region 001 <gen> owned by Player 1 (Red))) Equal to 1) then do (Game - Display to (All players) the text: player 1 exist) else do (Do nothing)
or something entirely different?

(basically what you just said was like 00001111000110000 to me,am not that advanced)
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
Well we want to debug to figure out why the trigger is not firing.

To do this we need to know which condition is failing. In order to do this we need to take a look at each condition individually.

So in the actions section we are going check each condition and print to the screen the resulting information.

So like this:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Number of units in (Units in Region 001 <gen> owned by Player 1 (Red))) Equal to 1
    • Then - Actions
      • Game - Display to (All players) the text: A unit from Player 1 was present. // If we see this we know the condition was successful.
    • Else - Actions
      • Game - Display to (All players) the text: (String((Number of units in (Units in Region 001 <gen> owned by Player 1 (Red))))) // If we see this we know it failed, and we can glean some more information by understanding what number it printed.
 
Level 5
Joined
May 8, 2009
Messages
87
Well i did this:
  • Events
    • Unit - A unit enters Region 001 <gen>
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
      • Then - Actions
        • If ((Owner of Capture Point 0018 <gen>) Equal to Player 12 (Brown)) then do (Game - Display to (All players) the text: 12) else do (Do nothing)
        • If ((Number of units in (Units in Region 000 <gen> owned by Neutral Passive)) Equal to 10) then do (Game - Display to (All players) the text: N) else do (Do nothing)
        • If ((Number of units in (Units in Region 001 <gen> owned by Player 1 (Red))) Equal to 1) then do (Game - Display to (All players) the text: p1) else do (Do nothing)
        • If ((Number of units in (Units in Region 001 <gen> owned by Player 2 (Blue))) Equal to 1) then do (Game - Display to (All players) the text: p2) else do (Do nothing)
        • If ((Number of units in (Units in Region 001 <gen> owned by Player 3 (Teal))) Equal to 1) then do (Game - Display to (All players) the text: p3) else do (Do nothing)
        • If ((Number of units in (Units in Region 001 <gen> owned by Player 4 (Purple))) Equal to 1) then do (Game - Display to (All players) the text: p4) else do (Do nothing)
        • If ((Number of units in (Units in Region 001 <gen> owned by Player 5 (Yellow))) Equal to 1) then do (Game - Display to (All players) the text: p5) else do (Do nothing)
      • Else - Actions
        • Do nothing
and i get the all messages.

Now another thing i found is that if i do this:
  • Conditions
    • (Owner of Capture Point 0018 <gen>) Equal to Player 12 (Brown)
    • (Number of units in (Units in Region 000 <gen> owned by Neutral Passive)) Equal to 10
    • (Number of units in (Units in Region 001 <gen> owned by Player 1 (Red))) Equal to 1
  • Actions
    • Unit - Change ownership of Capture Point 0018 <gen> to Player 6 (Orange) and Change color
    • Unit Group - Pick every unit in (Units in Region 000 <gen> owned by Neutral Passive) and do (Unit - Change ownership of (Picked unit) to Player 6 (Orange) and Change color)

the trigger is working fine.but if i add the other players

  • Conditions
    • (Owner of Capture Point 0018 <gen>) Equal to Player 12 (Brown)
    • (Number of units in (Units in Region 000 <gen> owned by Neutral Passive)) Equal to 10
    • (Number of units in (Units in Region 001 <gen> owned by Player 1 (Red))) Equal to 1
    • (Number of units in (Units in Region 001 <gen> owned by Player 2 (Blue))) Equal to 1
    • (Number of units in (Units in Region 001 <gen> owned by Player 3 (Teal))) Equal to 1
    • (Number of units in (Units in Region 001 <gen> owned by Player 4 (Purple))) Equal to 1
    • (Number of units in (Units in Region 001 <gen> owned by Player 5 (Yellow))) Equal to 1
then nothing.


But any way i will go with a different method (i just came up with)
i will set up a variable,for the heroes.and store numbers in it,so every time a hero enters the region it will add up to the variable,and when it reach the number 5,then the action will take place.
or something like that.

thank you for sacrificing your time to help me! +Rep
 
Last edited:
Level 38
Joined
Feb 27, 2007
Messages
4,951
  • Conditions
    • (Owner of Capture Point 0018 <gen>) Equal to Player 12 (Brown)
    • (Number of units in (Units in Region 000 <gen> owned by Neutral Passive)) Equal to 10
    • (Number of units in (Units in Region 001 <gen> owned by Player 1 (Red))) Equal to 1
    • (Number of units in (Units in Region 001 <gen> owned by Player 2 (Blue))) Equal to 1
    • (Number of units in (Units in Region 001 <gen> owned by Player 3 (Teal))) Equal to 1
    • (Number of units in (Units in Region 001 <gen> owned by Player 4 (Purple))) Equal to 1
    • (Number of units in (Units in Region 001 <gen> owned by Player 5 (Yellow))) Equal to 1
When you put multiple conditions together like that the game automatically evaluates them ALL and ALL of them must be true for it to proceed. What you want to do is put them in an "or" block so any one of the conditions will cause the trigger to run:
  • Conditions
    • Or - Any conditions are true
      • -------- This one seems like it might need to go OUTSIDE the OR block. Just a guess, since I can't see your whole trigger --------
      • (Owner of Capture Point 0018 <gen>) Equal to Player 12 (Brown)
      • -------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------
      • (Number of units in (Units in Region 000 <gen> owned by Neutral Passive)) Equal to 10
      • (Number of units in (Units in Region 001 <gen> owned by Player 1 (Red))) Equal to 1
      • (Number of units in (Units in Region 001 <gen> owned by Player 2 (Blue))) Equal to 1
      • (Number of units in (Units in Region 001 <gen> owned by Player 3 (Teal))) Equal to 1
      • (Number of units in (Units in Region 001 <gen> owned by Player 4 (Purple))) Equal to 1
      • (Number of units in (Units in Region 001 <gen> owned by Player 5 (Yellow))) Equal to 1
Now the reason that pOke is suggesting you put them all in separate IF blocks is that you can't know which of these conditions was true when the trigger's actions successfully run. To find out you'll have to check all of those conditions over again until one is true, which you then can use to properly change ownership of the capture point. So since you have to check them all anyway it doesn't make sense to have a big OR block of them all in the trigger's conditions-- it's repetitive and inefficient.
 
Status
Not open for further replies.
Top