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

[Trigger] bullet not spawning correct place?

Status
Not open for further replies.
Level 10
Joined
Sep 21, 2007
Messages
517
I have a really annoying problem here... i used x and y intercepts and some math to calculate a bullets movement, anyhow, the spawning place of the bullet can sometimes be in the casters x and y intercept location and sometimes it spawns to the left of the caster and goes to the angle from there. Can anyone tell me why? the bullet does have locust (collision off) and spawns in the casters x and y intercept.
Here is the trigger:
  • ShootingStart
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sniper Shot
    • Actions
      • Custom script: local unit u = GetTriggerUnit()
      • Custom script: local real x = GetUnitX(u)
      • Custom script: local real y = GetUnitY(u)
      • Custom script: local location t = GetSpellTargetLoc()
      • Custom script: local real distX = GetLocationX(t) - x
      • Custom script: local real distY = GetLocationY(t) - y
      • Custom script: local real dist = SquareRoot(distX*distX + distY*distY)
      • Custom script: local real dx = distX/dist*udg_BulletSpeed*udg_Time
      • Custom script: local real dy = distY/dist*udg_BulletSpeed*udg_Time
      • Custom script: local real angle = bj_RADTODEG*Atan2(distY, distX)
      • Custom script: call RemoveLocation(t)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • i Less than 8192
        • Then - Actions
          • Set i = (i + 1)
        • Else - Actions
          • Set i = 0
          • Set i = (i + 1)
      • Custom script: set udg_Bullet[udg_i] = CreateUnit(GetOwningPlayer(u), 'e000', x, y, angle)
      • Custom script: call AddFlying(udg_Bullet[udg_i])
      • Custom script: set udg_BulletMoveX[udg_i] = dx
      • Custom script: set udg_BulletMoveY[udg_i] = dy
      • Unit - Set the custom value of Bullet[i] to i
      • Set Bullet_Dist[i] = Bullet_Max_Dist
      • Unit Group - Add Bullet[i] to BulletGroup
      • Trigger - Turn on MovingBullet <gen>
Object Values for dummy
cast backswing: 0
blend time: 0
maximum pitch angle: 0
maximum roll angle: 0
projectile impact z: 70
projectile launch z: 70
propulsion window degrees: 60
ms: 1
turnrate: 3 (max)
collision: 0 (also added locust)
movement type: foot
+rep

EDIT: CAN THIS BE DELETED? (wrong forum) SORRY.
[SOLVED]
 
Last edited:
Status
Not open for further replies.
Top