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

Conditions are being skipped/ingored against my will!

Status
Not open for further replies.
Level 2
Joined
Jul 10, 2004
Messages
11
Here is the trigger. If this is too much to read... read the 2nd code its the same system just a lot smaller.

Code:
Spawning Spiders
    Events
        Unit - A unit enters Ashen Spider Region <gen>
    Conditions
        (Number of units in (Units of type Spider Ashen)) Less than or equal to 10
        Or - Any (Conditions) are true
            Conditions
                (Owner of (Triggering unit)) Equal to Player 1 (Red)
                (Owner of (Triggering unit)) Equal to Player 2 (Blue)
                (Owner of (Triggering unit)) Equal to Player 3 (Teal)
                (Owner of (Triggering unit)) Equal to Player 4 (Purple)
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units in Ashen Spider Region <gen> matching ((Owner of (Picked unit)) Equal to Player 11 (Dark Green)))) Equal to 0
            Then - Actions
                Unit - Create 10 Spider Ashen for Player 11 (Dark Green) at (Center of Spider Cave Exit Spawn <gen>) facing Default building facing degrees
                Unit Group - Pick every unit in (Units in Spider Cave Exit Spawn <gen> matching ((Owner of (Matching unit)) Equal to Neutral Hostile)) and do (Actions)
                    Loop - Actions
                        Unit - Order (Picked unit) to Patrol To (Random point in Ashen Spider Region <gen>)
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units in Ashen Spider Region <gen> matching ((Owner of (Picked unit)) Equal to Player 11 (Dark Green)))) Equal to 1
            Then - Actions
                Unit - Create 9 Spider Ashen for Player 11 (Dark Green) at (Center of Spider Cave Exit Spawn <gen>) facing Default building facing degrees
                Unit Group - Pick every unit in (Units in Spider Cave Exit Spawn <gen> matching ((Owner of (Matching unit)) Equal to Player 11 (Dark Green))) and do (Actions)
                    Loop - Actions
                        Unit - Order (Picked unit) to Patrol To (Random point in Ashen Spider Region <gen>)
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units in Ashen Spider Region <gen> matching ((Owner of (Picked unit)) Equal to Player 11 (Dark Green)))) Equal to 2
            Then - Actions
                Unit - Create 8 Spider Ashen for Player 11 (Dark Green) at (Center of Spider Cave Exit Spawn <gen>) facing Default building facing degrees
                Unit Group - Pick every unit in (Units in Spider Cave Exit Spawn <gen> matching ((Owner of (Matching unit)) Equal to Player 11 (Dark Green))) and do (Actions)
                    Loop - Actions
                        Unit - Order (Picked unit) to Patrol To (Random point in Ashen Spider Region <gen>)
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units in Ashen Spider Region <gen> matching ((Owner of (Picked unit)) Equal to Player 11 (Dark Green)))) Equal to 3
            Then - Actions
                Unit - Create 7 Spider Ashen for Player 11 (Dark Green) at (Center of Spider Cave Exit Spawn <gen>) facing Default building facing degrees
                Unit Group - Pick every unit in (Units in Spider Cave Exit Spawn <gen> matching ((Owner of (Matching unit)) Equal to Player 11 (Dark Green))) and do (Actions)
                    Loop - Actions
                        Unit - Order (Picked unit) to Patrol To (Random point in Ashen Spider Region <gen>)
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units in Ashen Spider Region <gen> matching ((Owner of (Picked unit)) Equal to Player 11 (Dark Green)))) Equal to 4
            Then - Actions
                Unit - Create 6 Spider Ashen for Player 11 (Dark Green) at (Center of Spider Cave Exit Spawn <gen>) facing Default building facing degrees
                Unit Group - Pick every unit in (Units in Spider Cave Exit Spawn <gen> matching ((Owner of (Matching unit)) Equal to Player 11 (Dark Green))) and do (Actions)
                    Loop - Actions
                        Unit - Order (Picked unit) to Patrol To (Random point in Ashen Spider Region <gen>)
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units in Ashen Spider Region <gen> matching ((Owner of (Picked unit)) Equal to Player 11 (Dark Green)))) Equal to 5
            Then - Actions
                Unit - Create 5 Spider Ashen for Player 11 (Dark Green) at (Center of Spider Cave Exit Spawn <gen>) facing Default building facing degrees
                Unit Group - Pick every unit in (Units in Spider Cave Exit Spawn <gen> matching ((Owner of (Matching unit)) Equal to Player 11 (Dark Green))) and do (Actions)
                    Loop - Actions
                        Unit - Order (Picked unit) to Patrol To (Random point in Ashen Spider Region <gen>)
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units in Ashen Spider Region <gen> matching ((Owner of (Picked unit)) Equal to Player 11 (Dark Green)))) Equal to 6
            Then - Actions
                Unit - Create 4 Spider Ashen for Player 11 (Dark Green) at (Center of Spider Cave Exit Spawn <gen>) facing Default building facing degrees
                Unit Group - Pick every unit in (Units in Spider Cave Exit Spawn <gen> matching ((Owner of (Matching unit)) Equal to Player 11 (Dark Green))) and do (Actions)
                    Loop - Actions
                        Unit - Order (Picked unit) to Patrol To (Random point in Ashen Spider Region <gen>)
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units in Ashen Spider Region <gen> matching ((Owner of (Picked unit)) Equal to Player 11 (Dark Green)))) Equal to 7
            Then - Actions
                Unit - Create 3 Spider Ashen for Player 11 (Dark Green) at (Center of Spider Cave Exit Spawn <gen>) facing Default building facing degrees
                Unit Group - Pick every unit in (Units in Spider Cave Exit Spawn <gen> matching ((Owner of (Matching unit)) Equal to Player 11 (Dark Green))) and do (Actions)
                    Loop - Actions
                        Unit - Order (Picked unit) to Patrol To (Random point in Ashen Spider Region <gen>)
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units in Ashen Spider Region <gen> matching ((Owner of (Picked unit)) Equal to Player 11 (Dark Green)))) Equal to 8
            Then - Actions
                Unit - Create 2 Spider Ashen for Player 11 (Dark Green) at (Center of Spider Cave Exit Spawn <gen>) facing Default building facing degrees
                Unit Group - Pick every unit in (Units in Spider Cave Exit Spawn <gen> matching ((Owner of (Matching unit)) Equal to Player 11 (Dark Green))) and do (Actions)
                    Loop - Actions
                        Unit - Order (Picked unit) to Patrol To (Random point in Ashen Spider Region <gen>)
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units in Ashen Spider Region <gen> matching ((Owner of (Picked unit)) Equal to Player 11 (Dark Green)))) Equal to 9
            Then - Actions
                Unit - Create 1 Spider Ashen for Player 11 (Dark Green) at (Center of Spider Cave Exit Spawn <gen>) facing Default building facing degrees
                Unit Group - Pick every unit in (Units in Spider Cave Exit Spawn <gen> matching ((Owner of (Matching unit)) Equal to Player 11 (Dark Green))) and do (Actions)
                    Loop - Actions
                        Unit - Order (Picked unit) to Patrol To (Random point in Ashen Spider Region <gen>)
            Else - Actions

What is happening is whenever p1/p2/p3/p4 enters the region it spawns 10 every time... It's like it doesn't know how to count the spiders already in the region and just spawns 10...

And yes i know im using the right regions so thats not the problem.

Here is a trigger that is basically the same function as this but a lot smaller. (this is what it was in the first place, before i broke it up thinking it would at least tell me where it was breaking --;)
Code:
Spawning Furblog
    Events
        Unit - A unit enters Ashen Furblogs Region <gen>
    Conditions
        (Number of units in (Units in Ashen Furblogs Region <gen>)) Less than or equal to 5
        Or - Any (Conditions) are true
            Conditions
                (Owner of (Triggering unit)) Equal to Player 1 (Red)
                (Owner of (Triggering unit)) Equal to Player 2 (Blue)
                (Owner of (Triggering unit)) Equal to Player 3 (Teal)
                (Owner of (Triggering unit)) Equal to Player 4 (Purple)
    Actions
        Unit - Create (0 + (5 - (Number of units in (Units in Ashen Furblogs Region <gen> matching ((Matching player) Equal to Player 11 (Dark Green)))))) Furbolg Ashen for Player 11 (Dark Green) at (Random point in Ashen Furblog Spawn <gen>) facing Default building facing degrees
        Unit Group - Pick every unit in (Units in Ashen Furblog Spawn <gen> matching ((Owner of (Matching unit)) Equal to Player 11 (Dark Green))) and do (Actions)
            Loop - Actions
                Unit - Order (Picked unit) to Patrol To (Random point in Ashen Furblogs Region <gen>)
 
Level 2
Joined
Jul 10, 2004
Messages
11
DarkShadow said:
Simple. In the second (small) code, you have the "Unit Group - Pick All Units..."-action. I'm missing this action in the first code. So if the function checks the value of "Picked Units", it will always return 0.

umm... that action doesn't spawn anything. It just tells the units to go patrol a random spot. That action works fine for the most part.

i tried setting the number of units as a var and then do 10-(var), but that didn't work either --;

i tried this... and it still kept spawning even though they was 10+ units in the region...

Code:
Spawning Spiders
    Events
        Unit - A unit enters Ashen Spider Region <gen>
    Conditions
        (Number of units in (Units in Ashen Spider Region <gen>)) Less than or equal to 10
        Or - Any (Conditions) are true
            Conditions
                (Owner of (Triggering unit)) Equal to Player 1 (Red)
                (Owner of (Triggering unit)) Equal to Player 2 (Blue)
                (Owner of (Triggering unit)) Equal to Player 3 (Teal)
                (Owner of (Triggering unit)) Equal to Player 4 (Purple)
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units in Ashen Spider Region <gen>)) Greater than 10
            Then - Actions
                Game - Display to (All players) the text: there's more than 1...
            Else - Actions
                Set spawn = (Number of units in (Units in Ashen Spider Region <gen>))
                Unit - Create (0 + (10 - spawn)) Spider Ashen for Player 11 (Dark Green) at (Random point in Spider Cave Exit Spawn <gen>) facing Default building facing degrees
                Unit Group - Pick every unit in (Units in Spider Cave Exit Spawn <gen> matching ((Owner of (Matching unit)) Equal to Player 11 (Dark Green))) and do (Actions)
                    Loop - Actions
                        Unit - Order (Picked unit) to Patrol To (Random point in Ashen Spider Region <gen>)
 
Level 13
Joined
May 5, 2004
Messages
1,330
I guess we had a small missunderstanding here. All I was talking about is that you should change the "Picked Unit"-variable (red text) to a "Matching Unit"-variable, else it will use a "Picked Unit"-variable that is always 0 (you should realize what's the result for the code).


Ragter said:
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in (Units in Ashen Spider Region <gen> matching ((Owner of (Picked unit)) Equal to Player 11 (Dark Green)))) Equal to 0
Then - Actions

To your last code...hmm, can't see a mistake there, dunno why that one shouldn't work. If you don't get it to work, you can send me the map, I'll see what I can do. Just tell me.
 
Level 2
Joined
Jul 10, 2004
Messages
11
DarkShadow said:
I guess we had a small missunderstanding here. All I was talking about is that you should change the "Picked Unit"-variable (red text) to a "Matching Unit"-variable, else it will use a "Picked Unit"-variable that is always 0 (you should realize what's the result for the code).


Ragter said:
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in (Units in Ashen Spider Region <gen> matching ((Owner of (Picked unit)) Equal to Player 11 (Dark Green)))) Equal to 0
Then - Actions

To your last code...hmm, can't see a mistake there, dunno why that one shouldn't work. If you don't get it to work, you can send me the map, I'll see what I can do. Just tell me.

hence my confusion:(

the strange thing is that the var caps out at 10...

when i enter the region a 2nd time 10-10=10 --; should be 10-10=0...

Then when i enter the region the 3rd time it spawns another 10... but the strange thing is the var is still at 10... Even though there was 20 mobs in the region when it counted, so it shoulda been 20 but it was 10 and still spawned another 10.

How should i send you the map? Via warcraft 3, aim, pm, download link??


EDIT: i'm finding that the var isn't holding any data... it justs holds the default number of 0...

Code:
Spawning Spiders
    Events
        Unit - A unit enters Ashen Spider Region <gen>
    Conditions
        (Number of units in (Units in Ashen Spider Region <gen> matching ((Owner of (Matching unit)) Equal to Player 11 (Dark Green)))) Less than or equal to 9
        Or - Any (Conditions) are true
            Conditions
                (Owner of (Triggering unit)) Equal to Player 1 (Red)
                (Owner of (Triggering unit)) Equal to Player 2 (Blue)
                (Owner of (Triggering unit)) Equal to Player 3 (Teal)
                (Owner of (Triggering unit)) Equal to Player 4 (Purple)
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Number of units in (Units in Ashen Spider Region <gen>)) Greater than 10
            Then - Actions
                Game - Display to (All players) the text: there's more than 1...
            Else - Actions
                Set spawn = (Number of units in (Units in Ashen Spider Region <gen> matching ((Owner of (Matching unit)) Equal to Player 11 (Dark Green))))
                Unit - Create (0 + (10 - spawn)) Spider Ashen for Player 11 (Dark Green) at (Random point in Spider Cave Exit Spawn <gen>) facing Default building facing degrees
                Unit Group - Pick every unit in (Units in Spider Cave Exit Spawn <gen> matching ((Owner of (Matching unit)) Equal to Player 11 (Dark Green))) and do (Actions)
                    Loop - Actions
                        Unit - Order (Picked unit) to Patrol To (Random point in Ashen Spider Region <gen>)
 
Status
Not open for further replies.
Top