Warcraft III resources & community, 2003–2006 · archived

Targetting points and offsets

10 posts
#1

Targetting points and offsets

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

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)
#2
Only problem i can see: the units might not have the spell

Also, a few things...

-Fix those darn leaks :?
-Array Indexes start at 0, not 1
#3
PurplePoot
-Array Indexes start at 0, not 1


When you play hide&seek with your friends, and they tell you to count to 10, you dont start at 0, do you? (just pointing out that for the sake of clarity its better to start with 1, even though the 0 can be used too)
#4
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.
#5
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
#6
It should work. Maybe you're removing the units before they can finish the spell, or maybe your impale itself is messed up. Also, make sure your impale's orderstring is "impale"
#7
I've been reading your first post, and its not quite clear what is the problem.

Could you please clafiry:

1. What excacly happens with that trigger?
2. What would u want to happen?
#8
PurplePootOn 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--
#9
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.
#10
PurplePoot
But, my point was, in the future, if you go into real programming and you're using, say, Java for starters :P


Who the hell will use the world editor as a bouncing board to programming? :roll: