Unit standing on Animal

Status
Not open for further replies.

ShenLong Kazama

Level 5
I wanna make a unit standing on an animal. The unit should for example be normal sized and stand on a 4 or 6 scaled wolf. I tried it already but the unit doesn't stand on the right spot and the unit is as big as the animal. I made a picture in photoshop how it sould look like. Any idea how i can make this?

Dr. Boom

Level 16
Well you mean now how to do this in the editor with triggers? =O

In this case can to something like:

-Every 0.03 seconds.
JASS:
``````local real f = GetUnitFacing(Wolf) - 180.
local real x = GetUnitX(Wolf) ± 0. * Cos(f * bj_DEGTORAD)
local real y = GetUnitY(Wolf) ± 0. * Sin(f * bj_DEGTORAD)
local real h = GetUnitFlyHeight(Wolf) + 200.

call SetUnitX(Dude,x)
call SetUnitY(Dude,y)
call SetUnitFacing(Dude,GetUnitFacing(Wolf))
call SetUnitFlyHeight(Dude,h,GetUnitFlyHeight(Dude)``````

Hint:
The ± 0 is the distance from the center of the wolf. Possible you have to change this value into - xx or + xx to get the current point.
The + 200. is the height, how high the dude should be over the wolf

Hope this help

Greetings and Peace
Dr. Boom

waveseeker

Level 8
Lilly riding a two-headed wolf, while the stars rain down from the heaven to destroy the world?

Win.

ShenLong Kazama

Level 5
I have no idea how i use jass. Is there a way to make this work with the normnal triggers?

Dr. Boom

Level 16
I have no idea how i use jass. Is there a way to make this work with the normnal triggers?

No! No shit GUI from me!

1) Create a new trigger and name it how you want (with no spaces)

2) When you copy the following trigger and past it into your created trigger:
JASS:
``````function TNActions takes nothing returns nothing
local unit dude = gg_unit_hpea_0001
local unit wolf = gg_unit_Hpal_0000
local real f = GetUnitFacing(wolf) - 180.
local real x = GetUnitX(wolf) + 0. * Cos(f * bj_DEGTORAD)
local real y = GetUnitY(wolf) + 0. * Sin(f * bj_DEGTORAD)
local real h = GetUnitFlyHeight(wolf) + 200.

call SetUnitX(dude,x)
call SetUnitY(dude,y)
call SetUnitFacing(dude,GetUnitFacing(wolf))
call SetUnitFlyHeight(dude,h,GetUnitFlyHeight(dude))

set wolf = null
set dude = null
endfunction

function InitTrig_TriggerName takes nothing returns nothing
local trigger t = CreateTrigger()

call TriggerRegisterTimerEvent(t,0.04,true)
call TriggerAddAction(t,function TNActions)

set t = null
endfunction``````

3) Now you you replace the TriggerName (in the InitTrig function) with the name you chose for the trigger.

4) Also you have to replace "gg_unit_hpea_0001" with the code of the dude and "gg_unit_Hpal_0000" with the code of the wolf.

5) now test it and you got a nice jass code.

Edit: You can just copy the whole code and use jass instead of copy each line into GUi custom script -_-

Greetings and Peace
Dr. Boom

Bribe

Level 51
This:

JASS:
``````function InitTrig_TriggerName takes nothing returns nothing
local trigger t = CreateTrigger()

call TriggerRegisterTimerEvent(t,0.04,true)
call TriggerAddAction(t,function TNActions)

set t = null
endfunction``````

Should definitely be this:

JASS:
``````function InitTrig_TriggerName takes nothing returns nothing
call TimerStart(CreateTimer(), 0.03125, true, function TNActions)
endfunction``````

Bribe

Level 51
Shorter lines of code, makes more sense, the InitTrig function will be faster, a timer with a callback executes faster than a trigger with a timer event... and finally 0.03125 as a timeout holds the best visual realism/efficiency ratio.

ShenLong Kazama

Level 5
Is there no way to use that in the normal triggers?

Dr. Boom

Level 16
Moin moin -_-;

Well I don't understand how you can ruin the whole thing, because you want use a GUI trigger ... bad stuff, but lets see if this work:

• Test
• Events
• Time - Every 0.04 seconds of game time
• Conditions
• Actions
• Set Dude = No unit
• Set Wolf = No unit
• Set Height = ((Current flying height of Wolf) + 200.00)
• Set Loc1 = (Position of Wolf)
• Set Loc2 = (Loc1 offset by 0.00 towards ((Facing of Wolf) - 180.00) degrees)
• Unit - Move Dude instantly to Loc2, facing (Facing of Wolf) degrees
• Animation - Change Dude flying height to Height at (Current flying height of Dude)
• Custom script: call RemoveLocation(udg_Loc1)
• Custom script: call RemoveLocation(udg_Loc2)
Note:
height: is for the position over the wolf
loc2: change "0.00" is the position if the dude over the wolf isn't correct.
dude: you have to store the unit over the wolf in it
wolf: stores the wolf

Greetings and Peace
Dr. Boom

ShenLong Kazama

Level 5
I can't get it to work. Please make a test map.

tw3ye

Level 7
I can't get it to work. Please make a test map.

He would have to make unit and set all ofsets to the wolf ... u should cofig it to youre self LOL dude =.=
he gave u all u need... going eat in min

if i get time il get u video how to do it

Edit: may i recomend adding a special effect owerhead using the ilidian(deamonhunter) (edit2)( special effect do resize with unit )FAIL

Last edited:

Magtheridon96

Level 36
Well you mean now how to do this in the editor with triggers? =O

In this case can to something like:

-Every 0.03 seconds.
Jass:
local real f = GetUnitFacing(Wolf) - 180.
local real x = GetUnitX(Wolf) ± 0. * Cos(f * bj_DEGTORAD)
local real y = GetUnitY(Wolf) ± 0. * Sin(f * bj_DEGTORAD)
local real h = GetUnitFlyHeight(Wolf) + 200.

call SetUnitX(Dude,x)
call SetUnitY(Dude,y)
call SetUnitFacing(Dude,GetUnitFacing(Wolf))
call SetUnitFlyHeight(Dude,h,GetUnitFlyHeight(Dude)

Hint:
The ± 0 is the distance from the center of the wolf. Possible you have to change this value into - xx or + xx to get the current point.
The + 200. is the height, how high the dude should be over the wolf

Hope this help

Greetings and Peace
Dr. Boom

You forgot to say "moin moin"

Status
Not open for further replies.

Replies
3
Views
1K
Replies
11
Views
767
Replies
9
Views
1K
Replies
11
Views
958
Replies
6
Views
3K