I cannot see what's wrong with this trigger
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.
-
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
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Custom script: call RemoveLocation(udg_TempPoint1)
- Custom script: call RemoveLocation(udg_TempPoint2)
- Else - Actions
-
If - Conditions
- -------- 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
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Custom script: call RemoveLocation(udg_TempPoint1)
- Custom script: call RemoveLocation(udg_TempPoint2)
- Else - Actions
-
If - Conditions
- -------- 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
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Custom script: call RemoveLocation(udg_TempPoint1)
- Custom script: call RemoveLocation(udg_TempPoint2)
- Else - Actions
-
If - Conditions
-
Events
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.