• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Skills returning hero to mid of map, help please =(

Status
Not open for further replies.
Level 2
Joined
Oct 31, 2007
Messages
14
Two skills used in this map are causing the heroes to warp to the middle of the map, if they order-move just as the spell pops off. I've tried to fix this before but unfortunately my knowledge of JASS is too poor to do the job. Any help would be a miracle, thanks a bunch in advance.

I'm aware as someone has told me before, these triggers are a bit messy, a bit being kind. I didn't make them, I'm just tryin' to learn how to make'm work (right) and fix them.
 
Last edited:
Level 2
Joined
Oct 31, 2007
Messages
14
I've tried applying local variables, as someone told me once before. JassCraft isn't reporting any errors, but I must've done something wrong, since I still have the glitch when using the skill and order-moving as it pops off. I'm thinking I'm not setting something right or not using the correct local variables when I'm calling, any insight would be great.

Code:
function O91737 takes nothing returns nothing
        local unit localunit1 = null
        local location localloc1 = null
    if(O91551())then
	set localunit1=GetSpellAbilityUnit()
        set localloc1=GetUnitLoc(localunit1)
        call TriggerSleepAction(0.10)
        set bj_forLoopBIndex=1
        set bj_forLoopBIndexEnd=GetUnitAbilityLevelSwapped('A024',localunit1)
        loop
            exitwhen bj_forLoopBIndex>bj_forLoopBIndexEnd
            call UnitAddItemByIdSwapped('I00H',GetSpellAbilityUnit())
            set bj_forLoopBIndex=bj_forLoopBIndex+1
        endloop
        call RemoveLocation(localloc1)
        set localloc1=PolarProjectionBJ(GetUnitLoc(GetSpellTargetUnit()),50.00,GetUnitFacing(GetSpellTargetUnit()))
        call SetUnitFacingToFaceUnitTimed(localunit1,GetSpellTargetUnit(),0.01)
        call SetUnitPositionLocFacingLocBJ(localunit1,localloc1,localloc1)
        call AddSpecialEffectLocBJ(localloc1,"Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl")
        call DestroyEffectBJ(GetLastCreatedEffectBJ())
        call RemoveLocation(localloc1)
    else
    endif
 
Level 7
Joined
Oct 5, 2007
Messages
118
Here's the mistake:

Code:
        call RemoveLocation(localloc1)
....
        call SetUnitPositionLocFacingLocBJ(localunit1,localloc1,localloc1)
If you try to move a unit to a removed location, it will be located in the middle (0 / 0) of the map. Just remove this RemoveLocation there, it it should be fine.
 
Level 2
Joined
Oct 31, 2007
Messages
14
I'm definitely gonna try that ASAP, thanks!
---Yep, it totally worked, you're seriously my JASS hero, thanks a million man!
 
Last edited:
Status
Not open for further replies.
Top