• 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] Problem using UnitMoveToAsProjectile

Status
Not open for further replies.
The World Editor dislikes this line
JASS:
call UnitMoveToAsProjectile (v, 0.5, x, y, 0.00)
in a spell that throws a unit

Full code:
JASS:
function Trig_Throw_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A058' 
endfunction 



function Trig_Throw_Actions takes nothing returns nothing
    local unit t
    local unit v        = GetSpellTargetUnit()
    local unit c        = GetTriggerUnit()
    local real x        = GetUnitX(c)
    local real y        = GetUnitY(c)
    
    call ShowUnitHide(v)                                            
    call TriggerSleepAction (5.00)
    call CreateNUnitsAtLoc( 1, 'opeo', GetOwningPlayer(c), PolarProjectionBJ(GetUnitLoc(c), ( 100.00 + ( 100.00 * I2R(GetUnitAbilityLevelSwapped('A058', c)) ) ), GetUnitFacing(c)), bj_UNIT_FACING )
    set t = GetLastCreatedUnit ()
    call SetUnitPositionLoc( v, GetUnitLoc(c) )
    call ShowUnitShow(v)
    call PauseUnitBJ( true, c )
    call SetUnitAnimation( c, "spell" )
    call TriggerSleepAction( 1.07 )
    call PauseUnitBJ( false, c )
    call UnitMoveToAsProjectile (v, 0.5, x, y, 0.00)
    call UnitDamageTargetBJ( c, v, ( 100.00 + ( 50.00 * I2R(GetUnitAbilityLevelSwapped('A058', c)) ) ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endfunction

//===========================================================================
function InitTrig_Throw takes nothing returns nothing
    set gg_trg_Throw = CreateTrigger(  )
    call TriggerRegisterUnitEvent( gg_trg_Throw, gg_unit_O005_0998, EVENT_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Throw, Condition( function Trig_Throw_Conditions ) )
    call TriggerAddAction( gg_trg_Throw, function Trig_Throw_Actions )
endfunction

JASScraft gives me no errors, but for the line in question I get this error: Undeclared Function UnitMoveToAsProjectile

I was wondering if there was a file you needed to make it work, like you do for the CS cache.

I don't know anything about the CS cache, but my friend says you need it to make certain spells (like knockback) work properly.
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Replacing BJs with natives is the most easiest thing in the world, what you need is a jass editor (JassCraft for example), then all your problems are solved.

About JASS, it's better to not modify GUI converted to JASS, because that is crappy work, what you need to do is write your own lines in JASS (meaning from the scratch). Only exception would be events/conditions, I think.....
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
It can't fix all of them, and it's still bad coding practice... preprocessors are always slightly less efficient than hand-coding it, it just depends on what, and if it's actually worth the bother of doing it yourself; with stuff like NewGen, it would be hell to. It's easy to code properly sans most BJs, though.

And the functions for moving a unit normally are

JASS:
native          SetUnitX            takes unit whichUnit, real newX returns nothing
native          SetUnitY            takes unit whichUnit, real newY returns nothing
native          SetUnitPosition     takes unit whichUnit, real newX, real newY returns nothing
native          SetUnitPositionLoc  takes unit whichUnit, location whichLocation returns nothing
 
Thats all fine and I see your point, but the problem still remains: The MoveUnitToAsProjectile doesnt work, I suppose I could always use a knockback funstion, but the code that doesnt work actually gives an arc in it so it looks like the unit is being phsycally thrown, which is of course the point of a spell that throws a unit.
 
Status
Not open for further replies.
Top