SpellsJASS Problems

Status
Not open for further replies.
Level 11
Joined
Mar 30, 2008
Messages
666
I have a problem with this JASS,when I save tha map,ERROR!What can I do to repair all those thousands of errors?
JASS:
function Trig_Grenade_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A003'
endfunction
function movegrenade takes nothing returns nothing
  local timer t = GetExpiredTimer()
  local unit g = GetHandleUnit(t, "g")
  local unit cast = GetHandleUnit(t, "cast")
  local location caster = GetUnitLoc(cast)
  local location gl = GetUnitLoc(g)
  local real x = GetHandleReal(t, "x")
  local real y = GetHandleReal(t, "y")
  local location targp = Location(x, y)
  local real dist = DistanceBetweenPoints(gl, targp)
  local real maxdist = DistanceBetweenPoints(caster, targp)
  local real height = JumpParabola(dist, maxdist, 1.70)
    call SetUnitPositionLoc(g, PolarProjectionBJ(gl, maxdist/50.00, AngleBetweenPoints(gl, targp)))
    call SetUnitFlyHeight(g, height, 0)
    call RemoveLocation(caster)
    call RemoveLocation(gl)
    call RemoveLocation(targp)
    set caster = null
    set gl = null
    set targp = null
endfunction
function Trig_Grenade_Actions takes nothing returns nothing
  local timer t = CreateTimer()
  local unit cast = GetTriggerUnit()
  local location caster = GetUnitLoc(cast)
  local location targp = GetSpellTargetLoc()
  local location temp
  local location temppoint
  local unit g
  local real r = DistanceBetweenPoints(caster, targp)/(DistanceBetweenPoints(caster, targp)/50.00)*.016579
  local real x = GetLocationX(targp)
  local real y = GetLocationY(targp)
    set temp = PolarProjectionBJ(caster, 25.00, AngleBetweenPoints(caster, targp))
    call CreateNUnitsAtLoc(1, 'H004',GetOwningPlayer(cast), temp, AngleBetweenPoints(caster, targp))
    set g = GetLastCreatedUnit()
    call SetHandleHandle(t, "cast", cast)
    call SetHandleReal(t, "x", x)
    call SetHandleReal(t, "y", y)
    call SetHandleHandle(t, "g", g)
    call TimerStart(t, 0.02, true, function movegrenade)
    call TriggerSleepAction(r)
    call DestroyTimer(t)
    call KillUnit(g)
    set temppoint = GetUnitLoc(g)
    call UnitDamagePointLoc(g, 0.00, 256.00, temppoint, 500.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE)
    call DestroyEffect(AddSpecialEffectLoc("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl", temppoint))
    call RemoveUnit(g)
    call RemoveLocation(caster)
    call RemoveLocation(targp)
    call FlushHandleLocals(t)
    call RemoveLocation(temp)
    call RemoveLocation(temppoint)
    set temppoint = null
    set temp = null
    set t = null
    set caster = null
    set targp = null
    set g = null
    set cast = null
endfunction

//===========================================================================
function InitTrig_Real_Grenade takes nothing returns nothing
    set gg_trg_Real_Grenade = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Real_Grenade, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_Real_Grenade, Condition(function Trig_Grenade_Conditions))
    call TriggerAddAction(gg_trg_Real_Grenade, function Trig_Grenade_Actions)
endfunction
JASS:
function Trig_GrenadeB_Func001A takes nothing returns nothing
  local unit u = GetEnumUnit()
  local location l = GetUnitLoc(u)
  local real maxdist = I2R(GetUnitUserData(u))
  local location temppoint = GetUnitLoc(u)
  local location temppoint2 = Location(I2R(GetItemUserData(UnitItemInSlot(u, 0))), I2R(GetItemUserData(UnitItemInSlot(u, 1))))
  local real dist = DistanceBetweenPoints(temppoint, temppoint2)
  local real height = JumpParabola(dist, maxdist, 1.40)
  local location temppoint3 = PolarProjectionBJ(l, 10.00, GetUnitFacing(u))
    if GetUnitFlyHeight(u) >= 6.00 then
        call SetUnitPositionLoc(u, temppoint3)
        call SetUnitFlyHeight(u, height, 0)
    else
        call KillUnit(u)
        call UnitDamagePointLoc(u, 0.00, 256.00, temppoint, 500.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE)
        call DestroyEffect(AddSpecialEffectLoc("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl", temppoint))
        call GroupRemoveUnitSimple(u, udg_Grenades)
        call RemoveUnit(u)
    endif
    call RemoveLocation(temppoint)
    call RemoveLocation(temppoint2)
    call RemoveLocation(temppoint3)
    call RemoveLocation(l)
    set l = null
    set u = null
    set temppoint = null
    set temppoint2 = null
    set temppoint3 = null
endfunction
function Trig_GrenadeB_Actions takes nothing returns nothing
    call ForGroup(udg_Grenades, function Trig_GrenadeB_Func001A)
endfunction

//===========================================================================
function InitTrig_GrenadeB takes nothing returns nothing
    set gg_trg_GrenadeB = CreateTrigger(  )
    call TriggerRegisterTimerEventPeriodic( gg_trg_GrenadeB, 0.02 )
    call TriggerAddAction( gg_trg_GrenadeB, function Trig_GrenadeB_Actions )
endfunction
 

Attachments

  • JASSProblem.JPG
    JASSProblem.JPG
    177.7 KB · Views: 95
Level 19
Joined
Aug 24, 2007
Messages
2,888
Hmm it seems fine to me
Try disabling those triggers and testing again I dont think the error comes from these
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
NoNZealot, JumpParabola is a standard function which no one ever edits, and it's almost definitely not vJass because they use the handle vars.

cHeRoL, did you import the Handle Vars into your map header along with that JumpParabola function? And you need it in the header, not in an arbitrary trigger (The latter can cause bugs).
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
cHeRoL, did you import the Handle Vars into your map header along with that JumpParabola function? And you need it in the header, not in an arbitrary trigger (The latter can cause bugs).

I think that's why NoNZealot asked if the JumpParabola function is in vJass, because it can't be in a trigger if it's not.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
I think that's why NoNZealot asked if the JumpParabola function is in vJass, because it can't be in a trigger if it's not.
Read his post again, that's not at all how it's worded :p.

Hmm did you see any private,scope, or library word on ANY TRIGGER you have imported? Maybe this is for NewGen. Can we see the JumpParabola() function here?
Bold and nonbold sections seem separate.
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Yeah, we figured that out :)

You just got one -rep, don't feel so bad about it, it's quite common, everyone has at least one minus rep.

cHeRoL, there is no point in blindly importing stuff if you don't have a clue what it is. You always have to know just a little bit of everything. I, for example, don't know how to model, but I know some basic stuff, terms, technics etc. So I don't have much trouble importing because if I ran into a problem with importing I can (almost) always fix it, I don't have to ask someone to describe me the process in details.

I suggest you learn some JASS, just a little bit so you understand the basic concept.
 
Level 3
Joined
Feb 24, 2008
Messages
67
cHeRoL, I would advise you not to copy anything JASS directly into from another map into your map. There are a lot of functions not defined because of several reasons.

1. Handle variables are not defined, thus causing problems with the code.
2. Your ability Id is something else in your map. Not 'A003'
3. Your trigger name is different than the one stated in the code.

And many more errors, I'm no great shakes in JASS, I only know the basics. I would suggest you to go learn some basic JASS about what are handle variables and how to write codes in JASS before importing JASS based spells into your map.

Ask yourself, do you truly understand what your copied JASS code does without any external reference? If no, there's your problem. Here is a good place to start.
 
Status
Not open for further replies.
Top