• 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] GetSpellTargetLoc() not working

Status
Not open for further replies.
Level 2
Joined
Jan 18, 2018
Messages
11
i made a spell that will create a unit and make it face to where the spell target location is the problem is
this
Code:
GetSpellTargetLoc()
is not working
but when i make the unit face the GetSpellTargetLoc() the unit faces the middle of the map
the spell is an edited impale spell i removed the buffs and effects
and wrote some jass to get it to summon the unit after i cast the impale spell
 
Level 2
Joined
Jan 18, 2018
Messages
11
here are the parts of the code that are changing where the unit is facing
Code:
function Spell_Actions takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local location loc = GetSpellTargetLoc()
    local unit Unit
    set Unit = CreateUnit(GetOwningPlayer(caster), 'h003', 0, 0, 0)
    call SetUnitFacingToFaceLocTimed(Unit, loc, 0.01)
    set Caster = null
    set Unit = null
    set loc = null
endfunction
 
Level 2
Joined
Jan 18, 2018
Messages
11
btw iam using newgen WE
this is it
call TriggerRegisterAnyUnitEventBJ(Spell, EVENT_PLAYER_UNIT_SPELL_EFFECT)
 
Level 26
Joined
Aug 18, 2009
Messages
4,099
Yes, I am sorry, did not see that post before. I think otherwise it looks okay, you immediately save the event response and I doubt you do something complex as cancelling the ability on the cast event, which could cause peculiarities. Nor do I believe that 'Impale' does anything special regarding that. Can you provide a test map?
 
Level 2
Joined
Jan 18, 2018
Messages
11
Yes, I am sorry, did not see that post before. I think otherwise it looks okay, you immediately save the event response and I doubt you do something complex as cancelling the ability on the cast event, which could cause peculiarities. Nor do I believe that 'Impale' does anything special regarding that. Can you provide a test map?

how can i pm you
 
Level 2
Joined
Jan 18, 2018
Messages
11
Last edited:
Level 2
Joined
Jan 18, 2018
Messages
11
It works for me but you are moving the unit after issuing the facing directive. Facing is a timed unit command. It can be cancelled by various means. Why not just state the angle in the unit constructor? And the caster will face the target point anyway.

OHHH ya its because i was spawning it in 0,0 changing the facing then changing the location it should be changing the location then changing the facing thanks for helping me

btw i know that it faces the target point anyway but when there's a small change in the angle it wont change it
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
OHHH ya its because i was spawning it in 0,0 changing the facing then changing the location it should be changing the location then changing the facing thanks for helping me
Why not create the unit where you need it with the appropriate facing? I would imagine that being easier to code and more efficient.
 
Status
Not open for further replies.
Top