• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] Cannon trigger system doesn't work properly

Status
Not open for further replies.

TKF

TKF

Level 19
Joined
Nov 29, 2006
Messages
1,267
I cannot see what's wrong with this trigger

  • Adding Projectiles System
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Port Cannons
    • Actions
      • -------- Port Cannon Slot 1 --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Port Cannons
          • (Item-class of (Item carried by (Triggering unit) in slot 1)) Equal to Artifact
        • Then - Actions
          • Set RandomAngle = ((Facing of (Triggering unit)) + (Random real number between 70.00 and 90.00))
          • Set TempPoint2 = (Position of (Triggering unit))
          • Set TempPoint1 = (TempPoint2 offset by (Random real number between 10.00 and 64.00) towards RandomAngle degrees)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item carried by (Triggering unit) in slot 1) Equal to (Item carried by (Triggering unit) of type Basic Cannon (Cannon))
            • Then - Actions
              • Unit - Create 1 Cannon Ball for (Owner of (Triggering unit)) at TempPoint1 facing RandomAngle degrees
              • Unit - Add Basic Cannon (Projectile) to (Last created unit)
              • Unit Group - Add (Last created unit) to MoveSlow
              • Unit - Add a 1.32 second Generic expiration timer to (Last created unit)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item carried by (Triggering unit) in slot 1) Equal to (Item carried by (Triggering unit) of type Sail Ripper (Cannon))
                • Then - Actions
                  • Unit - Create 1 Sail Ripper for (Owner of (Triggering unit)) at TempPoint1 facing RandomAngle degrees
                  • Unit Group - Add (Last created unit) to MoveSlow
                  • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Item carried by (Triggering unit) in slot 1) Equal to (Item carried by (Triggering unit) of type Basic Culverine (Cannon))
                    • Then - Actions
                      • Unit - Create 1 Culverine Ball for (Owner of (Triggering unit)) at TempPoint1 facing RandomAngle degrees
                      • Unit Group - Add (Last created unit) to MoveFast
                      • Unit - Add a 0.85 second Generic expiration timer to (Last created unit)
                    • Else - Actions
          • Custom script: call RemoveLocation(udg_TempPoint1)
          • Custom script: call RemoveLocation(udg_TempPoint2)
        • Else - Actions
      • -------- Port Cannon Slot 3 --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Port Cannons
          • (Item-class of (Item carried by (Triggering unit) in slot 3)) Equal to Artifact
        • Then - Actions
          • Set RandomAngle = ((Facing of (Triggering unit)) + (Random real number between 80.00 and 100.00))
          • Set TempPoint2 = (Position of (Triggering unit))
          • Set TempPoint1 = (TempPoint2 offset by (Random real number between 10.00 and 64.00) towards RandomAngle degrees)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item carried by (Triggering unit) in slot 3) Equal to (Item carried by (Triggering unit) of type Basic Cannon (Cannon))
            • Then - Actions
              • Unit - Create 1 Cannon Ball for (Owner of (Triggering unit)) at TempPoint1 facing RandomAngle degrees
              • Unit - Add Basic Cannon (Projectile) to (Last created unit)
              • Unit Group - Add (Last created unit) to MoveSlow
              • Unit - Add a 1.32 second Generic expiration timer to (Last created unit)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item carried by (Triggering unit) in slot 3) Equal to (Item carried by (Triggering unit) of type Sail Ripper (Cannon))
                • Then - Actions
                  • Unit - Create 1 Sail Ripper for (Owner of (Triggering unit)) at TempPoint1 facing RandomAngle degrees
                  • Unit Group - Add (Last created unit) to MoveSlow
                  • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Item carried by (Triggering unit) in slot 3) Equal to (Item carried by (Triggering unit) of type Basic Culverine (Cannon))
                    • Then - Actions
                      • Unit - Create 1 Culverine Ball for (Owner of (Triggering unit)) at TempPoint1 facing RandomAngle degrees
                      • Unit Group - Add (Last created unit) to MoveFast
                      • Unit - Add a 0.85 second Generic expiration timer to (Last created unit)
                    • Else - Actions
          • Custom script: call RemoveLocation(udg_TempPoint1)
          • Custom script: call RemoveLocation(udg_TempPoint2)
        • Else - Actions
      • -------- Port Cannon Slot 5 --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Port Cannons
          • (Item-class of (Item carried by (Triggering unit) in slot 5)) Equal to Artifact
        • Then - Actions
          • Set RandomAngle = ((Facing of (Triggering unit)) + (Random real number between 90.00 and 110.00))
          • Set TempPoint2 = (Position of (Triggering unit))
          • Set TempPoint1 = (TempPoint2 offset by (Random real number between 10.00 and 64.00) towards RandomAngle degrees)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item carried by (Triggering unit) in slot 5) Equal to (Item carried by (Triggering unit) of type Basic Cannon (Cannon))
            • Then - Actions
              • Unit - Create 1 Cannon Ball for (Owner of (Triggering unit)) at TempPoint1 facing RandomAngle degrees
              • Unit - Add Basic Cannon (Projectile) to (Last created unit)
              • Unit Group - Add (Last created unit) to MoveSlow
              • Unit - Add a 1.32 second Generic expiration timer to (Last created unit)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item carried by (Triggering unit) in slot 5) Equal to (Item carried by (Triggering unit) of type Sail Ripper (Cannon))
                • Then - Actions
                  • Unit - Create 1 Sail Ripper for (Owner of (Triggering unit)) at TempPoint1 facing RandomAngle degrees
                  • Unit Group - Add (Last created unit) to MoveSlow
                  • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Item carried by (Triggering unit) in slot 5) Equal to (Item carried by (Triggering unit) of type Basic Culverine (Cannon))
                    • Then - Actions
                      • Unit - Create 1 Culverine Ball for (Owner of (Triggering unit)) at TempPoint1 facing RandomAngle degrees
                      • Unit Group - Add (Last created unit) to MoveFast
                      • Unit - Add a 0.85 second Generic expiration timer to (Last created unit)
                    • Else - Actions
          • Custom script: call RemoveLocation(udg_TempPoint1)
          • Custom script: call RemoveLocation(udg_TempPoint2)
        • Else - Actions

The ship only fires 1 projectile, instead of 3 when the inventory is full. I've tried different solutions, but I cannot fix it. Neither can't I see what's wrong with the trigger causing it only to make 1 cannonballs instead of 3.
 
FoA:
(Ability being cast) Equal to Port Cannons
in all the conditions inside the actions block are just slowing this down.
Help me debug this one:
swap the items in the inventory and say which one fired.
P.s. Are you sure all the items are artifacts?
 
They are all artifacts

btw I've fixed the problem

  • (Item carried by (Triggering unit) in slot 1) Equal to (Item carried by (Triggering unit) of type Basic Cannon (Cannon))
Doesn't work properly

But
  • (Item-type of (Item carried by (Triggering unit) in slot 1)) Equal to Basic Cannon (Cannon)
This works.
 
Oh, yeah.
When I see such a long code, I tend to avoid examining it thoroughly ;)
 
Status
Not open for further replies.
Back
Top