Warcraft III resources & community, 2003–2006 · archived

some help is needed

8 posts
#1

some help is needed

Hi,

Im writing a script that should move the target into the air and then slam it to the ground. I thought i could make it work but strange things happen.



function slamlift takes nothing returns nothing
    local real z2 = GetUnitFlyHeight(udg_slam) + 5.0
    call SetUnitFlyHeight(udg_slam,z2,0)
endfunction

function slamdecent takes nothing returns nothing
    local real z = GetUnitFlyHeight(udg_slam) - 12.5
    call SetUnitFlyHeight(udg_slam,z,0)
endfunction

function Trig_slameactions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local timer t = CreateTimer()
    local timer t2 = CreateTimer()
    local real z2  
    local real x = (GetUnitX(u) + 300.0)
    local real y = (GetUnitY(u) + 300.0)
    local real r = 10.0
  
    set udg_slam = GetSpellTargetUnit()
    set z2 = GetUnitFlyHeight(udg_slam) + 200.0 
    
// the lift       
    call TimerStart(t,0.04,true,function slamlift)
loop
    exitwhen r >= z2
    call TriggerSleepAction(0)
    set r = GetUnitFlyHeight(udg_slam) + 10.0
endloop       // works decent
    call PauseTimer(t)
// the descent
    call TimerStart(t2,0.04,true,function slamdecent)
loop
    exitwhen r <= 0
    call TriggerSleepAction(0)
    set r = GetUnitFlyHeight(udg_slam)
endloop         // doenst end
    
    call PauseTimer(t2)
    call DisplayTimedTextToPlayer(GetOwningPlayer(u),0,0,400,R2S(GetUnitFlyHeight(udg_slam))) // doesnt appear
    call DestroyTimer(t2)
    call DestroyTimer(t)
       
    set u = null
    set t = null
    set t2 = null
    set udg_slam = null
       
endfunction

//==== Init Trigger NewTrigger ====
function InitTrig_slam takes nothing returns nothing
    set gg_trg_slam = CreateTrigger()
    call TriggerRegisterUnitEvent(gg_trg_slam,gg_unit_Udea_0000,EVENT_UNIT_SPELL_CAST)
    call TriggerAddAction(gg_trg_slam, function Trig_slameactions)
endfunction


First of all, it doesnt work on ground units, only flying units get lifted and slammed to the ground.

second, when i add a line to create a message when the target gets slammed, so after the second loop, the message doesnt appear. Looks like the second loop doenst end.

The effect for the slam will be added later, when it works properly.

I could use some help

Thanks
#2
#1 - you have to add and remove crow form ( Amrf ) at the start of the trigger from ground units to adjust their fly height in that trigger.

#2 - Im pretty sure that a Timer is started in the same thread as its calling func, meaning TriggerSleepAction will cause strange conflictions. I may be wrong, however.
#3
exitwhen r <= 0

unit height has a minimum value and for some units probably can't fall down to zero. save it as
set z1 = GetUnitFlyHeight(udg_slam) + 5.0
set z2 = z1 + 200.0
and than set the exit condition as
exitwhen r <= z1

hope thet helps

First of all, it doesnt work on ground units, only flying units get lifted and slammed to the ground.

that part you control in object editor (allowed targets) and is not important here.
#4
i think the second bit has to do with the addition/removal of crow form

And for the toss up/down, i find using time as opposed to the heights themselves works better.
#5
Great, it works! :P

It indeed had to do with crowform. Seems like ground units have no 'fly'height off their own or something.

that part you control in object editor (allowed targets) and is not important here.


The spell could be targeted at ground units and the damage does get resolved but they just didnt move through the air.
Plus that im working with ROC, so modifying spell properties like that wont do for me.

Thanks! :D
#6
I think flyheight is just reserve for flying units, well, i wonder why... :P lol
#7
Next issue;

i want to add a specialeffect to the script and do the damage manually cos otherwise the damage and effect are resolved when the unit is in the air and that looks pretty lame :?

I use the following:

local effect e
      local real a = GetUnitAbilityLevel('psyc') * 100
      local real d = GetUnitAbilityLevel('psyc') * 75
.....
 call UnitDamagePoint(u,1.6,a,GetUnitX(udg_slam),GetUnitY(udg_slam),d,true,false,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNIVERSAL,WEAPON_TYPE_WHOKNOWS)
    set e = AddSpecialEffect("Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl",GetUnitX(udg_slam),GetUnitY(udg_slam))
...
call DestroyEffect(e)
set e = null


but jasshop gives me a error(not the first time indeed)

syntax error on the line with the addspecialeffect
and its says 'non valid escape sequences in string' for that same line.
What am i not seeing this time :roll: ?
#8
\ is a string handler in JASS

change each \ to \\