• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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