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

Targetting points and offsets

Status
Not open for further replies.
Level 2
Joined
Nov 19, 2006
Messages
11
Below Ill put part of a code of what Im trying to do.. Summoning 4 dummies each facing at each direction (N,S,E,W) i want them to cast and impale type spell directly infront of them but not whats not right (probably the offset, not sure how to work offset). help is much appreciated

Code:
Ice star
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Ice Star 
    Actions
        Set Icestarcaster = (Casting unit)
        Unit - Pause Icestarcaster
        Unit - Create 1 Ice Star Dummy for (Owner of Icestarcaster) at (Position of Icestarcaster) facing 90.00 degrees
        Set Icestardummy[1] = (Last created unit)
        Unit - Create 1 Ice Star Dummy for (Owner of Icestarcaster) at (Position of Icestarcaster) facing 0.00 degrees
        Set Icestardummy[2] = (Last created unit)
        Unit - Create 1 Ice Star Dummy for (Owner of Icestarcaster) at (Position of Icestarcaster) facing 180.00 degrees
        Set Icestardummy[3] = (Last created unit)
        Unit - Create 1 Ice Star Dummy for (Owner of Icestarcaster) at (Position of Icestarcaster) facing 270.00 degrees
        Set Icestardummy[4] = (Last created unit)
        Wait 0.30 seconds
        Unit - Order Icestardummy[1] to Undead Crypt Lord - Impale ((Position of Icestarcaster) offset by 256.00 towards 90.00 degrees)
        Unit - Order Icestardummy[2] to Undead Crypt Lord - Impale ((Position of Icestarcaster) offset by 256.00 towards 0.00 degrees)
        Unit - Order Icestardummy[3] to Undead Crypt Lord - Impale ((Position of Icestarcaster) offset by 256.00 towards 180.00 degrees)
        Unit - Order Icestardummy[4] to Undead Crypt Lord - Impale ((Position of Icestarcaster) offset by 256.00 towards 270.00 degrees)
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
On the other hand, when you play Write the JASS with your friends, you dont use BJs if you're trying to write efficient code, do you?

There is absolutely no reason to start at 1 :p. Well, you can, its just... meh, get used to starting at 0 :p. Basically everything does, and anyways, when you get into real programming (if you do, that is), then that 0 will make a large difference in memory allocation.
 
Level 2
Joined
Nov 19, 2006
Messages
11
thanks for the help but just to clarify, i have the spell on the units. but maybe something with the string activation is wrong. the way i have it 256 offset with 0 degrees should cause it to cast directly infront of the unit? or do i have to set the degrees as the point it is facing
 
Level 27
Joined
Feb 22, 2006
Messages
3,052
PurplePoot said:
On the other hand, when you play Write the JASS with your friends, you dont use BJs if you're trying to write efficient code, do you?

There is absolutely no reason to start at 1 :p. Well, you can, its just... meh, get used to starting at 0 :p. Basically everything does, and anyways, when you get into real programming (if you do, that is), then that 0 will make a large difference in memory allocation.
In indexes, it just stores it, it doesn't have to start anywhere.
I could set unit=var[2938] if I so wished, and then could access it later...
I see why using 0 in some things would be a good starting point, but indexes don't have starting points and ending points, just minimum point (0)

...This is bothering me. Is it indexes or indecies?
--donut3.5--
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Think its indexes

But, my point was, in the future, if you go into real programming and you're using, say, Java for starters :p

saying

i[2] = 1;

and

i[0] = 1;

will make a big difference, cause you have to say

int[] i = new int[15];

And you only have that many slots, as it allocates memory for that many slots.
 
Status
Not open for further replies.
Top