HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

flying trouble

05-09-2008, 03:05 PM#1
ch6tal
i want that when a unit is moving/attacking it will be considred air and it will be at height 250 from the ground but when its not moving/attacking it will be considered ground and will be at height 0 from the ground

anyone has an idea of how to do this?
05-10-2008, 03:23 AM#2
Pyrogasm
Uhhh... the only way I can think of it would be to use a very fast periodic timer to see what it is doing at that particular moment and then, well actually then I don't know what I'd do because I don't think you can change a unit's "targeted as" at run-time.

Maybe then you could constantly Chaos-morph the unit between the two desired forms, or you could try using the Druid's morphing abilities instead.
05-10-2008, 09:15 AM#3
ch6tal
u think the periodic timer could work with multipule units that some of them are the same type?
05-11-2008, 06:09 AM#4
Pyrogasm
Yes. Be more specific and I might be able to help you.
05-11-2008, 07:02 AM#5
ArchWorm
Chaos is more convenient, imo. Whenever ordered, add it and whenever not, remove it.
05-11-2008, 12:05 PM#6
ch6tal
Trigger:
Events- Unit - is issued an order targeting a point
Events- Unit - is issued an order targeting an object
Conditions - (Unit-type of (triggering unit)) equal to unit{ground}
Actions Unit - Replace (triggering unit) with a unit{air} using The old unit's relative life and mana

this worked for the first part (when the unit moves/attacks)

Trigger:
Events - Unit is issued an order with no target
Conditions - (unit type of (triggering unit) equal to unit{air}
Actions Unit - Replace (triggering unit) eith a unit{ground} usint The old unit's relative life and mana

this trigger worked only when i told the unit to stop instead of working automaticly when the unit doesn't attack/move
05-11-2008, 05:46 PM#7
Quldan Elwood
I had the same problem with finding out if a unit was moving or not. This is what i came up with.
( I'm not sure how to put triggers into the text box so it's all types sorry)

Make the following variables.
All_units Unit Group Empty Unit Group
Real Real 0.00
Num_units integer 0
Unit_list Unit array [1] -none-
Unit_points_new Point array [1] -none-
Unit_points_old Point array [1] -none-

then make this trigger:

Stopped Unit:
Collapse Event-
Time - Every 0.10 seconds of game time
conditions-
Collapse Actions-
Set All_units = [Units in [playable map area]]
Set Num_units = [ number of units in All_units]
Collapse For each [integer A] from 1 to [Number of units in All_units], do actions
Collapse Loop- Actions
Set Unit_list [Integer A] = [Random unit from All_units]
Unit Group- remove Unit_list [integer A] from All_units
(end of loop)
For each [integer A] from 1 to [Num_units], do actions
Collapse (note: can't use Number of units in All_units b/c it's empty now)
Collapse Loop- Actions
Set Unit_points_new = [ Position of Unit_list [ Integer A]
Set Real (the variable) = [[[ x of Unit_points_new [Integer A]] - [x of Unit_points_old [Integer A]] + [ y of Unit_points_new [Integer A]] - [y of Unit_points_old [Integer A]]]
Collapse (----Real will equal 0 if the unit is in the same spot as before and don't worry about Unit_point_old yet----)
if (All conditions are true) then do (the actions), else do (else actions)
Collapse if- conditions
Real Equals 0.00
Current order of Unit_list [Integer A] not equal to [Order[move]]
Current order of Unit_list [Integer A] not equal to [Order[attack]]
Collapse Then-actions
( do actions for if the unit was stopped
Collapse Else- actions
( do actions for if the unit is moving or attacking)
(----End of loop---)
Collapse For each [integer A] from 1 to [Num_units], do actions
Collapse Loop- actions
Set Unit_points_old [Integer A] = [Postion of Unit_list [Integer A]]
( and thats where Unit_points_old comes in. for the first calculation since Unit_points_old is not set yet it will return a "unit is stopped" action)


Now this IS NOT COMPLETE. It will only work with 1 unit on the entire map but you can probably see what I was trying to do. ill continue working on it and hope to give you a trigger that works with all units. Until then i hope this helped.
05-11-2008, 05:55 PM#8
abriko
You should convert a gui trigger that working for 1 unit to jass with local variable. Not very difficult and better ^^
05-11-2008, 06:06 PM#9
Quldan Elwood
Don't know how to use JASS but with the problems I've been running into i should probably learn
05-11-2008, 08:27 PM#10
abriko
If it's just about using local variables, i think that is pretty easy. I'm just using jass for multi-instanceable spells and this fast and easy.
05-11-2008, 10:17 PM#11
ch6tal
i think figured it out

Trigger:
Events - Time - Every 1.00 second of game time
Actions - Unit Group - Pick every unit in (unit of type unit{air}) and do actions
Loop - Actions
If (All Conditions are True) then do (then Actions) else do (else Actions)
If - Conditions
(current order of (Picked Unit)) Not equal to (order(move)) and (current order of (Picked Unit)) Not equal to (order(attack))
Then - (the height and classification change)
Else - Do nothing

it works but when i tell the unit to move with the right mouse click instead of the Move order it still activates the trigger
05-12-2008, 01:10 AM#12
Quldan Elwood
If i am correct the "smart" order is a "right-click"
EDIT: i tested your trigger out with the "smart" command added and it worked so now both you and me have our "unit is not moving" trigger
05-17-2008, 03:25 PM#13
ch6tal
what does the actions "add/remove classification" do because i tried using them to change the "targeted as" but it didn't work and constant morphing isn't practical (too many triggers,and causes bugs in the triggers) is there a way to change the "targeted as" during the game?

p.s i replying here because it hasn't been a week since last post and i do it here and not in trigger forum because this thread already exists so why create a new one
05-17-2008, 04:29 PM#14
Pyrogasm
You can't change "Targeted As" without morphing.