HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Hero unresponsive

01-20-2007, 07:51 PM#1
The_AwaKening
My own quote from the Jump Template Thread: made by emjlr3
Quote:
For some reason after using this spell, the hero becomes unresponsive to issued orders if he is in a control group. This bug doesn't happen if the hero is selected alone; Only in a group.

For example: If I right click my group to run to the east side of the map. Then I right click the west side of the map before the group ever reaches the initial target, the rest of my group will turn the other direction, but my one hero with the jump ability continues to the first ordered spot before turning back.

I thought maybe it was the pathing, but I removed that part and it still does it.

I've also tried commenting every part of the trigger basically except the setunitposition including the FyTrick_Id. I just can't figure out what is causing this behavior, and I'm thinking no one reads the posts in the spell section.

Here is the trigger: Note: I've changed it a bit from the original to eliminate some callbacks

Collapse JASS:
constant function Jump_Template_Fly_TrickId takes nothing returns integer
    return 'A04V' //Rawcode of the Fly Trick ability
endfunction

constant function Jump_Template_ThunderClapId takes nothing returns integer
    return 'AHtc' //Rawcode of the Ability used to damage
endfunction

// ****************************************************************************
function Jump_Template_Parabola takes real dist, real maxdist,real curve returns real
    local real t = (dist*2)/maxdist-1
    return (-t*t+1)*(maxdist/curve)
endfunction

function Jump_Template_Move takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit u = GetHandleUnit(t,"u")
    local unit d
    local real maxdist = GetHandleReal(t,"maxdist")
    local real ang = GetHandleReal(t,"ang")
    local real movedist = GetHandleReal(t,"movedist")       
    local real x = GetHandleReal(t,"x")
    local real y = GetHandleReal(t,"y")
    local real dist = SquareRoot((GetUnitX(u)-x)*(GetUnitX(u)-x) + (GetUnitY(u)-y)*(GetUnitY(u)-y))    
    local real height = Jump_Template_Parabola(dist,maxdist,1.75)
    local integer i = GetHandleInt(t,"i") 
    local integer level = GetHandleInt(t,"level")   
    
    call SetUnitPosition(u, GetUnitX(u) + movedist * Cos(ang * bj_DEGTORAD) , GetUnitY(u) + movedist * Sin(ang * bj_DEGTORAD))   
    call SetUnitFlyHeight(u,height,null)
    call SetHandleInt(t,"i",i + 1)

    if i == 50 then
        call SetUnitTimeScalePercent(u, 100)
    elseif i == 100 then
        call PauseUnit( u,false )
        call SetUnitPathing( u, true ) 
        call SetUnitFlyHeight(u,GetUnitDefaultFlyHeight(u),9999) 
        set x = GetUnitX(u) + 50 * Cos(ang * bj_DEGTORAD)
        set y = GetUnitY(u) + 50 * Sin(ang * bj_DEGTORAD) 
        set d = CreateUnit(GetOwningPlayer(u),'e003',x,y,0)
        call UnitApplyTimedLife(d,'BTLF',2)
        call UnitAddAbility(d,Jump_Template_ThunderClapId())
        call SetUnitAbilityLevel(d,Jump_Template_ThunderClapId(),GetUnitAbilityLevel(u,'A04W'))
        call IssueImmediateOrder(d,"thunderclap")
        call QueueUnitAnimation(u,"stand ready")
        call PauseTimer(t)
        call FlushHandleLocals(t)
        call DestroyTimer(t)
    endif
    
    set t = null
    set u = null            
endfunction

function Jump_Template_Actions takes nothing returns nothing    
    local timer t = CreateTimer()
    local unit u = GetTriggerUnit()
    local integer level = GetUnitAbilityLevel(u,'A04W')
    local real ux = GetUnitX(u)
    local real uy = GetUnitY(u)   
    local location l = GetSpellTargetLoc() 
    local real ang = bj_RADTODEG * Atan2((GetLocationY(l)-uy),(GetLocationX(l)-ux))
    local real x = GetLocationX(l) - 50 * Cos(ang * bj_DEGTORAD)
    local real y = GetLocationY(l) - 50 * Sin(ang * bj_DEGTORAD)    
    
    call SetHandleHandle(t,"u",u)
    call SetHandleReal(t,"x",x)
    call SetHandleReal(t,"y",y)
    call SetHandleReal(t,"maxdist", SquareRoot((ux-x)*(ux-x) + (uy-y)*(uy-y)))
    call SetHandleReal(t,"ang",ang)   
    call SetHandleReal(t,"movedist",SquareRoot((ux-x)*(ux-x) + (uy-y)*(uy-y))/100)
    call SetHandleInt(t,"i",0) 
    call SetHandleInt(t,"level",level)
   
    call PauseUnit( u,true )
    call SetUnitPathing( u, false )
    call UnitAddAbility( u,Jump_Template_Fly_TrickId() )
    call UnitRemoveAbility( u,Jump_Template_Fly_TrickId() )
    call SetUnitAnimation(u, "attack slam") 
    call SetUnitTimeScalePercent(u, 30)    
    call TimerStart(t,.01,true,function Jump_Template_Move)          
    
    set t = null
    set u = null 
    call RemoveLocation(l)
    set l = null   
endfunction

//===========================================================================
function Jump_Template_Conditions takes nothing returns boolean  
    return GetSpellAbilityId() == 'A04W'
endfunction

function InitTrig_Jump_Template takes nothing returns nothing
    set gg_trg_Jump_Template = CreateTrigger(  )
    call TriggerAddCondition( gg_trg_Jump_Template, Condition( function Jump_Template_Conditions ) )
    call TriggerAddAction( gg_trg_Jump_Template, function Jump_Template_Actions )
endfunction

Here is the link to the Spell thread. http://wc3campaigns.net/showthread.php?t=81308
01-21-2007, 07:03 PM#2
WNxCryptic
I'm not real experienced with JASS, so the possibility of me spotting an issue with your code is extremely unlikely.

However, what you can do is systematically remove (be sure to keep a backup of your map, obviously) parts of your jump system code. Obviously the jump may not function, depending on what you remove, but you said the issue is simply when ording the unit to move when selected in a group of other units.

To narrow it down and making sure that its a problem with having your Jump code in the map, remove ALL the jump code and then test the map to see if the problem is reoccuring. If not, then you obviously removed the set of code corresponding to the problem, if the problem still reoccurs, then its something else, no doubt.
01-21-2007, 07:37 PM#3
The_AwaKening
I've basically done all that. I removed the trigger and run the ability with no trigger. Everything is fine. I've also tried removing individual parts of the trigger. The only part of the trigger I haven't removed is the SetUnitPosition and the parabola. And it's only the hero using the ability that becomes unresponsive.
01-21-2007, 08:02 PM#4
WNxCryptic
So removing chunks of your code does nothing?

What about leaving the code itself and removing the ability from the hero? Perhaps you might try remaking the "jump" ability using a different base-ability and reworking your code to accomodate that? It could be queueing actions up incorrectly.
01-21-2007, 08:37 PM#5
Ammorth
I was playing an RPG a while back and hero became unresponsive after certain events in the game happend. The mapper simply included a "-fix" command that reset the hero. try pausing then unpausing the hero, or hiding and unhiding (etc.)
01-22-2007, 03:11 AM#6
grim001
This is because you are using SetUnitPosition... Change it to use SetUnitX and SetUnitY and I believe you will fix this problem as well as improving performance...
01-23-2007, 12:38 AM#7
The_AwaKening
Are you sure, or just guessing? SetUnitPosition is a native also and I've never had trouble with it before. I'll give it a shot anyway.

Edit: Tested this theory and it's not the problem. I've also tried to hide/unhide, pause/unpause the unit and it doesn't work either.

The odd thing is like I stated earlier, it is only happening when the player has more than one hero selected in a group. In fact, try opening up emjrl3's template and add a hero so that you have 2. You'll see what I mean.
01-24-2007, 12:59 AM#8
The_AwaKening
**Bump**

I've found the line of code causing the bug. It's pausing the unit at start of effect and then unpausing at end. Is there anything else I could do instead of pausing the unit, or is there a line of code I could add at the end to fix the problem?
01-24-2007, 02:06 AM#9
Szythe
You could always create a trigger caster which casts a stun on the unit as an alternative to pausing it. This method has an added bonus of remembering your heroes orders, and you can order him while stunned so he carries out the order the instant he is unstunned. Overall, it allows for the user to have more control, though its not a huge difference
01-24-2007, 04:26 AM#10
The_AwaKening
This works, but with a small side effect. I can't have the unit animation "attack slam" work if the unit is stunned. I may use this idea as a last resort if there is nothing else I can do.
01-24-2007, 04:43 AM#11
Pyrogasm
How about just setting it's movespeed to 0 and/or making it ignore issued orders during the jump?
01-24-2007, 05:03 AM#12
The_AwaKening
I don't know of any other way to make a unit ignore an issued order other than pausing it.
01-24-2007, 01:26 PM#13
grim001
You could stun the real unit and replace it with a dummy that plays the animation... a pain but it seems you don't have many options left
01-25-2007, 05:17 AM#14
Pyrogasm
Quote:
Originally Posted by The_AwaKening
I don't know of any other way to make a unit ignore an issued order other than pausing it.
Trigger:
Collapse Events
Unit - A unit is issued an order targeting a point
Unit - A unit is issued an order targeting an object
Unit - A unit is issued an order with no target
Collapse Conditions
Unit type of (Triggering Unit) equal to Your Unit
Collapse Actions
Unit - Order (Triggering Unit) to Stop
That, combined with a loop that constantly keeps it facing forwards (or towards the jump point) might do the trick.

But then again, I could be wrong.
01-25-2007, 10:04 AM#15
Ryude
Do you really need to pause the unit? I don't pause my unit when jumping and it never showed any problems. I also never make the unit invulnerable.