• 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.

Projectile Offset Problem.

Status
Not open for further replies.
Level 17
Joined
Nov 26, 2007
Messages
1,964
well i tried alot of things on this problem, but i cant figure out how to do it.
so basicly im making a projectile system where as, 3 cannon balls fire from either side of the ship.
I just need to figure out how to make them fire from the left/right side, and the other one will be easy to figure out.
so i thought i would edit/use Mini-me's projectile system code (thanks alot mini-me[I think he's the chieften of clan cbs]) , and modify it. So i did.

This is what i have so far:

  • Cannon Ball
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fire! (Neutral Hostile)
    • Actions
      • Set TempPoint1 = (Position of Human Battleship 0000 <gen>)
      • Set angle = ((Facing of Human Battleship 0000 <gen>) + 90.00)
      • Unit - Create 1 Cannon Ball for (Owner of (Triggering unit)) at TempPoint1 facing angle degrees
      • Custom script: call LaunchProjectile(bj_lastCreatedUnit, udg_angle, 10.00, 800.00, 3.60, true)
      • Unit - Create 1 Cannon Ball for (Owner of (Casting unit)) at ((Position of (Last created unit)) offset by (0.00, 80.00)) facing angle degrees
      • Custom script: call LaunchProjectile(bj_lastCreatedUnit, udg_angle, 10.00, 800.00, 3.60, true)
      • Unit - Create 1 Cannon Ball for (Owner of (Casting unit)) at ((Position of (Last created unit)) offset by (0.00, 80.00)) facing angle degrees
      • Custom script: call LaunchProjectile(bj_lastCreatedUnit, udg_angle, 10.00, 800.00, 3.60, true)
      • Custom script: call RemoveLocation(udg_TempPoint1)
this script works perfectly, except when the ship faces horisontally.
see when it faces vertically, it works like a charm, firing on the right cannon bow of the ship.




see it works yay!

but when it faces the other waayyy...





The balls dont fire right.... :wsad:

any help is appreciated guys, ill attach the map too if you wanna take a look.

oh also for another related problem i think

now udg_temppoint1 is a Temppoint 1 named variable. What if it was an array:

Temppoint 1 [Player number of (owner of (casting unit))]

whats the jass thing for that? sorry i hate jass and i dont know much about it :hohum:
 

Attachments

  • Cannon ball tests.w3x
    13.8 KB · Views: 66
Level 21
Joined
Aug 21, 2005
Messages
3,699
1. You're leaking 2 point locations every time you fire.
2. The problem is that you always create your units aligned vertically. Instead, create them depending on the angle your ship is facing.

EDIT: fixed your trigger.

  • Cannon Ball
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fire! (Neutral Hostile)
    • Actions
      • Set angle = (Facing of (Triggering unit))
      • Set TempPoint1 = (Position of Human Battleship 0000 <gen>)
      • Set TempPoint2 = (TempPoint1 offset by 80.00 towards angle degrees)
      • Set TempPoint3 = (TempPoint1 offset by -80.00 towards angle degrees)
      • Set angle = (angle + 90.00)
      • Unit - Create 1 Cannon Ball for (Owner of (Triggering unit)) at TempPoint1 facing angle degrees
      • Custom script: call LaunchProjectile(bj_lastCreatedUnit, udg_angle, 10.00, 800.00, 3.60, true)
      • Unit - Create 1 Cannon Ball for (Owner of (Triggering unit)) at TempPoint2 facing angle degrees
      • Custom script: call LaunchProjectile(bj_lastCreatedUnit, udg_angle, 10.00, 800.00, 3.60, true)
      • Unit - Create 1 Cannon Ball for (Owner of (Triggering unit)) at TempPoint3 facing angle degrees
      • Custom script: call LaunchProjectile(bj_lastCreatedUnit, udg_angle, 10.00, 800.00, 3.60, true)
      • Custom script: call RemoveLocation(udg_TempPoint1)
      • Custom script: call RemoveLocation(udg_TempPoint2)
      • Custom script: call RemoveLocation(udg_TempPoint3)
Oh yeah, and try basing your ability off "Channel". Otherwise you'll have to find a good ability for your "left" attack.
 
Last edited:
Status
Not open for further replies.
Top