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
 
Show the code, as that part works as it should. And use Jass Help forum for jass questions.
 
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)
 
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?
 
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.
 
It does, it has to, there's no question about it. For some reason your if was always true when you were testing it.
 
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?
 
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
 
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."
 
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 !
 
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
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top