- Joined
- May 11, 2010
- Messages
- 278
Yadda yadda, projectile system, yadda yadda.
The unit is created in a corner of the map, instead of where it should be.
How do I fix this? Is there anything else I've done wrong? (Yes, this leaks. I know. Will fix.)
Poise Break and ExtraEffect[] is currently two empty triggers (I haven't made them yet).
-
Projectile Test
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Projectile Test
-
Actions
- Set projectileMaxIndex = (projectileMaxIndex + 1)
- Set TempNumber = (Player number of (Owner of (Triggering unit)))
- Set ProjectileCaster[projectileMaxIndex] = (Triggering unit)
- -------- The unit that casts the ability. --------
- Set ProjectileTarget[projectileMaxIndex] = TargetofPlayer[TempNumber]
- -------- The target the attack will be aimed at. --------
- Set ProjectileDamage[projectileMaxIndex] = (20.00 x (DamageModifier[TempNumber] x DamageReduction[(Player number of (Owner of Target[maxIndex]))]))
- -------- The damage the attack will deal. --------
- -------- Change only the "1.00". --------
- Set ProjectileRange[projectileMaxIndex] = 500.00
- -------- How far the projectile will travel. --------
- Set ProjectileDuration[projectileMaxIndex] = 2.00
- -------- The max time the projectile will spend in the air. --------
- Set ProjectileImpactArea[projectileMaxIndex] = 75.00
- -------- How close to a unit the projectile must get to hit. --------
- Set ProjectilePoiseDamage[projectileMaxIndex] = 0
- -------- How much the enemies poise will be reduced. --------
- Set ProjectileAnimation[projectileMaxIndex] = attack
- -------- The animation the caster will play. --------
- Set ProjectileModelType[projectileMaxIndex] = Peasant
- -------- The model of the projectile. It's a unit. --------
- Set ProjectileManaGen[projectileMaxIndex] = 5.00
- -------- How much mana will be generated from the attack. --------
- Set ProjectileSoundLaunch[projectileMaxIndex] = StormBoltLaunch <gen>
- -------- The sound that plays on launch. --------
- Set ProjectileSoundImpact[projectileMaxIndex] = ThunderBoltMissileDeath <gen>
- -------- The sound that plays on hit. --------
- Set ProjectileExtraEffect[projectileMaxIndex] = None <gen>
- -------- Does the ability have any extra effects? Choose trigger here. --------
- -------- Last, plays the animation and sets the last variables. --------
- Wait 0.00 seconds
- Unit - Order (Triggering unit) to Stop
- Unit - Make (Triggering unit) face ProjectileTarget[projectileMaxIndex] over 0.00 seconds
- Animation - Play (Triggering unit)'s ProjectileAnimation[projectileMaxIndex] animation
- Set TempPoint = (Position of (Triggering unit))
- Sound - Play ProjectileSoundLaunch[projectileMaxIndex] at 100.00% volume, located at TempPoint with Z offset 0.00
- Unit - Create 1 ProjectileModelType[projectileMaxIndex] for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
- Set ProjectileModel[projectileMaxIndex] = (Last created unit)
- Set TempPoint2 = (Position of ProjectileTarget[projectileMaxIndex])
- Set ProjectileAngle[projectileMaxIndex] = (Angle from TempPoint to TempPoint2)
- Set ProjectileEndPoint[projectileMaxIndex] = (TempPoint offset by ProjectileRange[projectileMaxIndex] towards ProjectileAngle[projectileMaxIndex] degrees)
- Set ProjectileTickMovement[projectileMaxIndex] = (ProjectileRange[projectileMaxIndex] / (ProjectileDuration[projectileMaxIndex] x 0.03))
- -------- Runs the triggers. --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- projectileMaxIndex Equal to 1
-
Then - Actions
- Trigger - Turn on ProjectileLoop <gen>
- Else - Actions
-
If - Conditions
- -------- Runs the triggers. --------
-
Events
-
ProjectileLoop
-
Events
- Time - Every 0.03 seconds of game time
- Conditions
-
Actions
-
For each (Integer ProjectileTempIndex) from 1 to projectileMaxIndex, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ProjectileDuration[ProjectileTempIndex] Greater than 0.00
-
Then - Actions
- Set ProjectileDuration[ProjectileTempIndex] = (ProjectileDuration[ProjectileTempIndex] - 0.03)
- Set ProjectileTempPoint[1] = (Position of ProjectileModel[ProjectileTempIndex])
- Set ProjectileTempPoint[2] = (ProjectileTempPoint[1] offset by ProjectileTickMovement[ProjectileTempIndex] towards ProjectileAngle[ProjectileTempIndex] degrees)
- Unit - Move ProjectileModel[ProjectileTempIndex] instantly to ProjectileTempPoint[2]
- Set TempGroup = (Units within ProjectileImpactArea[ProjectileTempIndex] of ProjectileTempPoint[2] matching (((Matching unit) belongs to an ally of (Owner of ProjectileCaster[ProjectileTempIndex])) Equal to False))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in TempGroup) Greater than or equal to 1
-
Then - Actions
-
Unit Group - Pick every unit in TempGroup and do (Actions)
-
Loop - Actions
- Unit - Cause ProjectileCaster[ProjectileTempIndex] to damage (Picked unit), dealing ProjectileDamage[ProjectileTempIndex] damage of attack type Chaos and damage type Normal
- Set TempNumber = (Player number of (Owner of (Picked unit)))
- Set PoiseCurrent[TempNumber] = (PoiseCurrent[TempNumber] - ProjectilePoiseDamage[ProjectileTempIndex])
- Set PoiseTime[TempNumber] = PoiseRecoveryTime
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- PoiseCurrent[TempNumber] Less than or equal to 0
-
Then - Actions
- Trigger - Run Poise Break <gen> (ignoring conditions)
- Else - Actions
-
If - Conditions
- Trigger - Run ExtraEffect[TempIndex] (ignoring conditions)
-
Loop - Actions
- Unit - Set mana of ProjectileCaster[ProjectileTempIndex] to ((Mana of ProjectileCaster[ProjectileTempIndex]) + ProjectileManaGen[ProjectileTempIndex])
- Sound - Play ProjectileSoundImpact[ProjectileTempIndex] at 100.00% volume, located at TempPoint2 with Z offset 0.00
- -------- Index Recycling --------
- Trigger - Run ProjectileIndexRecycle <gen> (ignoring conditions)
-
Unit Group - Pick every unit in TempGroup and do (Actions)
- Else - Actions
-
If - Conditions
-
Else - Actions
- Unit - Remove ProjectileModel[ProjectileTempIndex] from the game
- Floating Text - Create floating text that reads Miss! at ProjectileEndPoint[ProjectileTempIndex] with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 10.00% transparency
- Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
- Floating Text - Change (Last created floating text): Disable permanence
- Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
- -------- Index Recycling --------
- Trigger - Run ProjectileIndexRecycle <gen> (ignoring conditions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
For each (Integer ProjectileTempIndex) from 1 to projectileMaxIndex, do (Actions)
-
Events
-
ProjectileIndexRecycle
- Events
- Conditions
-
Actions
- Set ProjectileAngle[TempIndex] = ProjectileAngle[projectileMaxIndex]
- Set ProjectileCaster[ProjectileTempIndex] = ProjectileCaster[projectileMaxIndex]
- Set ProjectileDamage[ProjectileTempIndex] = ProjectileDamage[projectileMaxIndex]
- Set ProjectileDuration[ProjectileTempIndex] = ProjectileDuration[projectileMaxIndex]
- Set ProjectileEndPoint[ProjectileTempIndex] = ProjectileEndPoint[projectileMaxIndex]
- Set ProjectileExtraEffect[ProjectileTempIndex] = ProjectileExtraEffect[projectileMaxIndex]
- Set ProjectileImpactArea[ProjectileTempIndex] = ProjectileImpactArea[projectileMaxIndex]
- Set ProjectileManaGen[ProjectileTempIndex] = ProjectileManaGen[projectileMaxIndex]
- Set ProjectileModel[ProjectileTempIndex] = ProjectileModel[projectileMaxIndex]
- Set ProjectilePoiseDamage[ProjectileTempIndex] = ProjectilePoiseDamage[projectileMaxIndex]
- Set ProjectileRange[ProjectileTempIndex] = ProjectileRange[projectileMaxIndex]
- Set ProjectileSoundImpact[ProjectileTempIndex] = ProjectileSoundImpact[projectileMaxIndex]
- Set ProjectileTickMovement[ProjectileTempIndex] = ProjectileTickMovement[projectileMaxIndex]
- Set projectileMaxIndex = (projectileMaxIndex - 1)
- Set ProjectileTempIndex = (ProjectileTempIndex - 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- projectileMaxIndex Equal to 0
-
Then - Actions
- Trigger - Turn off (This trigger)
- Skip remaining actions
- Else - Actions
-
If - Conditions
How do I fix this? Is there anything else I've done wrong? (Yes, this leaks. I know. Will fix.)
Poise Break and ExtraEffect[] is currently two empty triggers (I haven't made them yet).