Fatal errors, and other unexplained stuff

kallieblakie

New Member
Reaction score
5
EDIT:
Fatal Error script.

What's wrong with this script? anyone can help?

JASS:
function Trig_Arrow_Elunes_Arrow_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'AOsh' ) ) then
        return false
    endif
    return true
endfunction

function Arrow_Move takes nothing returns nothing
    local timer Loop = GetExpiredTimer()
    local unit arrow = H2U(GetHandleHandle(Loop, "arrow"))
    local real Angle = GetHandleReal(Loop, "Angle")
    local integer Range = GetHandleInt(Loop, "Range")
    local real Speed = GetHandleReal(Loop, "Speed")
    local integer PlayerNo = GetHandleInt(Loop, "PlayerNo")
    local real distanceCurrent = GetHandleReal(Loop, "distanceCurrent")
    local location C = GetUnitLoc(arrow)
    local location Next
    local real x 
    local real y
    if  (R2I(distanceCurrent) <= Range) then
       set distanceCurrent = distanceCurrent + Speed
       call SetHandleReal (Loop, "distanceCurrent", distanceCurrent)
       set x = GetLocationX(C) + Speed*Cos(Angle*bj_DEGTORAD)
       set y = GetLocationY(C) + Speed*Sin(Angle*bj_DEGTORAD)
       call RemoveLocation(C)
       set Next = Location(x,y) 
       call SetUnitPositionLoc( arrow, Next )
       call RemoveLocation(Next)
       set arrow = null
    elseif (R2I(distanceCurrent) > Range) then
       call KillUnit(arrow)
       call PauseTimer(Loop) 
       call RemoveLocation(Next)
       call RemoveLocation(C)
       set arrow = null        
       call FlushHandleLocals(Loop)
       call DestroyTimer(Loop) 
        call DisplayTextToForce( GetPlayersAll(), "OVER" )
    endif
    set x = 0.00
    set y = 0.00
endfunction

function Trig_Arrow_Elunes_Arrow_Actions takes nothing returns nothing
    local timer Loop = CreateTimer()
    local unit caster = GetSpellAbilityUnit()    
    local location casterPosition = GetUnitLoc(caster)
    local location targetPosition = GetSpellTargetLoc()    
   
    local integer PlayerNo = GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))
    local integer radius = udg_Radius[PlayerNo]

    local real Angle = AngleBetweenPoints(casterPosition, targetPosition)
    local real x = GetLocationX(casterPosition) + 88*Cos(Angle*bj_DEGTORAD)
    local real y = GetLocationY(casterPosition) + 88*Sin(Angle*bj_DEGTORAD)    
    local real Scale = ( 100.00 * ( I2R(radius) / 80.00 ) )   
    local location shootPosition = Location(x,y) 


    local unit arrow = null

    local integer Range = udg_Range[PlayerNo]
    local real Speed = udg_Speed[PlayerNo]


    call CreateNUnitsAtLoc( 1, 'hpea', ConvertedPlayer(PlayerNo), shootPosition, Angle)
    set arrow = GetLastCreatedUnit()
    call SetUnitScalePercent( arrow, Scale, Scale, Scale )
    call SetUnitPathing( arrow, false )
    call RemoveLocation(shootPosition)
    call RemoveLocation(casterPosition)
    call RemoveLocation(targetPosition)    
    set x = 0.00
    set y = 0.00
   call SetHandleHandle(Loop, "arrow", arrow) //***********88
   call SetHandleReal(Loop, "Angle", Angle)  //***********88
   call SetHandleInt(Loop, "Range", Range)  //***********88
   call SetHandleReal(Loop, "Speed", Speed)  //***********88
   call SetHandleInt(Loop, "PlayerNo", PlayerNo) //*********88
    call TimerStart(Loop, 0.03, true, function Arrow_Move)
endfunction

function InitTrig_Arrow_Elunes_Arrow takes nothing returns nothing
    set gg_trg_Arrow_Elunes_Arrow = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Arrow_Elunes_Arrow, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Arrow_Elunes_Arrow, Condition( function Trig_Arrow_Elunes_Arrow_Conditions ) )
    call TriggerAddAction( gg_trg_Arrow_Elunes_Arrow, function Trig_Arrow_Elunes_Arrow_Actions )
endfunction
 
Reaction score
456
Show the code, as that part works as it should. And use Jass Help forum for jass questions.
 

polo2005

Wana start playing LoL? http://tinyurl.com/369as27
Reaction score
97
call RemoveUnit(and lets say the jazz code for example last created)
Edit: like
GetLastCreatedUnit = last created unit
GetTriggerUnit = triggering unit
GetSpellAbilityUnit = casting unit
GetSpellTargetUnit = taget unit of ability bien cast
GetAttackedUnitBJ = attacked unit
GetAttacker = attacking unit

for example: call RemoveUnit(GetTriggerUnit())

if you want a specific unit like a pig on the map, make a varrible:
Code:
Set unit_varrible = Footman 0001 <gen>

and then call RemoveUnit(udg_unit_varrible)
 

kallieblakie

New Member
Reaction score
5
Doesn't move on to the "else" section

Hi i'm trying to create potm's arrow, and this is part of the script.


JASS:
    if  (R2I(distanceCurrent) &lt;= Range) then
       set distanceCurrent = distanceCurrent + Speed
       call SetHandleReal (Loop, &quot;distanceCurrent&quot;, distanceCurrent)
       set x = GetLocationX(C) + Speed*Cos(Angle*bj_DEGTORAD)
       set y = GetLocationY(C) + Speed*Sin(Angle*bj_DEGTORAD)
       call RemoveLocation(C)
       set Next = Location(x,y) 
       call SetUnitPositionLoc( arrow, Next )
       call RemoveLocation(Next)
       set arrow = null
    else
       call PauseTimer(Loop) 
       call RemoveLocation(Next)
       call RemoveLocation(C)
       call KillUnit(arrow)
       set arrow = null        
       call FlushHandleLocals(Loop)
       call DestroyTimer(Loop) 
        call DisplayTextToForce( GetPlayersAll(), &quot;OVER&quot; )
    endif


The problem is, it doesn't run the "else" script, even though the conditions for the "if" is not valid. How do i make it run the "else" script?
 

Seannny

Why GUI when you can Jass?
Reaction score
46
have you set pig to anything?
are you sure you set it to a unit?
Caps are important, Is it capitalized properly?

Post the code please.
 

Silvenon

New Member
Reaction score
19
It does, it has to, there's no question about it. For some reason your if was always true when you were testing it.
 

kallieblakie

New Member
Reaction score
5
it runs the script if it falls within the "if" category, but doesn't run at all when it doesn't.

I've tried it, and the arrow moves within the "if" category, and stops there, doesn't get removed, neither does the message display. what's wrong?
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
Try this:
JASS:
    if  (R2I(distanceCurrent) &lt;= Range) then
       set distanceCurrent = distanceCurrent + Speed
       call SetHandleReal (Loop, &quot;distanceCurrent&quot;, distanceCurrent)
       set x = GetLocationX(C) + Speed*Cos(Angle*bj_DEGTORAD)
       set y = GetLocationY(C) + Speed*Sin(Angle*bj_DEGTORAD)
       call RemoveLocation(C)
       set Next = Location(x,y) 
       call SetUnitPositionLoc( arrow, Next )
       call RemoveLocation(Next)
       set arrow = null
    elseif (R2I(distanceCurrent) &gt; Range) then
       call PauseTimer(Loop) 
       call RemoveLocation(Next)
       call RemoveLocation(C)
       call KillUnit(arrow)
       set arrow = null        
       call FlushHandleLocals(Loop)
       call DestroyTimer(Loop) 
        call DisplayTextToForce( GetPlayersAll(), &quot;OVER&quot; )
    endif
 

kallieblakie

New Member
Reaction score
5
that worked. thanks !


by the way,

why does This script cause


"FATAL ERROR!
Exception 0xC0000000005 (ACCESS_VIOLATION) at 001B:6F30CE3F

The instruction at ~~~~~~~blah blah blah."
 

kallieblakie

New Member
Reaction score
5
Fatal Error. MAYBE DUE TO LEAKS

I've been getting this fatal error problem, and i'm positive it's from this trigger.


JASS:
function Trig_Arrow_Elunes_Arrow_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == &#039;AOsh&#039; ) ) then
        return false
    endif
    return true
endfunction

function Arrow_Move takes nothing returns nothing
    local timer Loop = GetExpiredTimer()
    local unit arrow = H2U(GetHandleHandle(Loop, &quot;arrow&quot;))
    local real Angle = GetHandleReal(Loop, &quot;Angle&quot;)
    local integer Range = GetHandleInt(Loop, &quot;Range&quot;)
    local real Speed = GetHandleReal(Loop, &quot;Speed&quot;)
    local integer PlayerNo = GetHandleInt(Loop, &quot;PlayerNo&quot;)
    local real distanceCurrent = GetHandleReal(Loop, &quot;distanceCurrent&quot;)
    local location C = GetUnitLoc(arrow)
    local location Next
    local real x 
    local real y
    if  (R2I(distanceCurrent) &lt;= Range) then
       set distanceCurrent = distanceCurrent + Speed
       call SetHandleReal (Loop, &quot;distanceCurrent&quot;, distanceCurrent)
       set x = GetLocationX(C) + Speed*Cos(Angle*bj_DEGTORAD)
       set y = GetLocationY(C) + Speed*Sin(Angle*bj_DEGTORAD)
       call RemoveLocation(C)
       set Next = Location(x,y) 
       call SetUnitPositionLoc( arrow, Next )
       call RemoveLocation(Next)
       set arrow = null
    elseif (R2I(distanceCurrent) &gt; Range) then
       call KillUnit(arrow)
       call PauseTimer(Loop) 
       call RemoveLocation(Next)
       call RemoveLocation(C)
       set arrow = null        
       call FlushHandleLocals(Loop)
       call DestroyTimer(Loop) 
        call DisplayTextToForce( GetPlayersAll(), &quot;OVER&quot; )
    endif
    set x = 0.00
    set y = 0.00
endfunction

function Trig_Arrow_Elunes_Arrow_Actions takes nothing returns nothing
    local timer Loop = CreateTimer()
    local unit caster = GetSpellAbilityUnit()    
    local location casterPosition = GetUnitLoc(caster)
    local location targetPosition = GetSpellTargetLoc()    
   
    local integer PlayerNo = GetConvertedPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))
    local integer radius = udg_Radius[PlayerNo]

    local real Angle = AngleBetweenPoints(casterPosition, targetPosition)
    local real x = GetLocationX(casterPosition) + 88*Cos(Angle*bj_DEGTORAD)
    local real y = GetLocationY(casterPosition) + 88*Sin(Angle*bj_DEGTORAD)    
    local real Scale = ( 100.00 * ( I2R(radius) / 80.00 ) )   
    local location shootPosition = Location(x,y) 


    local unit arrow = null

    local integer Range = udg_Range[PlayerNo]
    local real Speed = udg_Speed[PlayerNo]


    call CreateNUnitsAtLoc( 1, &#039;hpea&#039;, ConvertedPlayer(PlayerNo), shootPosition, Angle)
    set arrow = GetLastCreatedUnit()
    call SetUnitScalePercent( arrow, Scale, Scale, Scale )
    call SetUnitPathing( arrow, false )
    call RemoveLocation(shootPosition)
    call RemoveLocation(casterPosition)
    call RemoveLocation(targetPosition)    
    set x = 0.00
    set y = 0.00
   call SetHandleHandle(Loop, &quot;arrow&quot;, arrow) //***********88
   call SetHandleReal(Loop, &quot;Angle&quot;, Angle)  //***********88
   call SetHandleInt(Loop, &quot;Range&quot;, Range)  //***********88
   call SetHandleReal(Loop, &quot;Speed&quot;, Speed)  //***********88
   call SetHandleInt(Loop, &quot;PlayerNo&quot;, PlayerNo) //*********88
    call TimerStart(Loop, 0.03, true, function Arrow_Move)
endfunction

function InitTrig_Arrow_Elunes_Arrow takes nothing returns nothing
    set gg_trg_Arrow_Elunes_Arrow = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Arrow_Elunes_Arrow, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Arrow_Elunes_Arrow, Condition( function Trig_Arrow_Elunes_Arrow_Conditions ) )
    call TriggerAddAction( gg_trg_Arrow_Elunes_Arrow, function Trig_Arrow_Elunes_Arrow_Actions )
endfunction





I'm new to JASS so I don't know if there's any leaks. Anyone Please help !
 

Cohadar

master of fugue
Reaction score
209
EDIT: shit, wrong thread.
The most strangest thing happened, I posted in one thread, and that thread instantly dissapeared !!
and my post ended up here???

EDIT2:
Well since I am here lemme try to help:
Locust units cannot be picked by "pick every unit in an area" trigger.
Are you doing that?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top