My first attempt at JASS scripting

Reaction score
456
set gg_trg_OneTargetOmniSlash = CreateTrigger( )

instead of

set gg_Trig_OneTargetOmniSlash = CreateTrigger( )
 

Hatebreeder

So many apples
Reaction score
381
set gg_trg_OneTargetOmniSlash = CreateTrigger( )

instead of

set gg_Trig_OneTargetOmniSlash = CreateTrigger( )

I am sorry for posting the same stuff, again, but it doesn't seem to work... I tried alot of stuff...
JASS:
function Trig_Condition takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction
function Trig_Actions takes nothing returns nothing
    local unit Caster = GetTriggerUnit()
    local unit Target = GetSpellTargetUnit()
    local location CasterLocation
    local location TargetLocation
    local integer Integer
    local real Angle
    local location PolarProjection
    
    loop
        exitwhen Integer >= 5
        // Define Locals
        set Angle = 360.00 / I2R(Integer)
        set CasterLocation = Location( GetUnitX(Caster),GetUnitY(Caster))
        set TargetLocation = Location( GetUnitX(Target),GetUnitY(Target))
        set PolarProjection = PolarProjectionBJ(TargetLocation,50.00,Angle)
        // Actions
        call UnitDamageTarget(Caster,Target,2.55 * GetHeroStr(Caster,true),true,false,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
        call SetUnitPositionLoc(Caster,PolarProjection)
        call AddSpecialEffectLoc("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl",TargetLocation)
        call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl",TargetLocation))
        // End Actions, Clear up leaks
        call RemoveLocation(CasterLocation)
        call RemoveLocation(TargetLocation)
        call PolledWait(0.35)
        set Integer = ( Integer + 1 )
    endloop
    
    set Caster = null
    set Target = null
    set CasterLocation = null
    set TargetLocation = null
    set Integer = 0
endfunction

//===========================================================================
function InitTrig_OneTargetOmniSlash takes nothing returns nothing
    set gg_trg_OneTargetOmniSlash = CreateTrigger()
    call TriggerAddAction( gg_trg_OneTargetOmniSlash, function Trig_Actions )
    call TriggerAddCondition( gg_trg_OneTargetOmniSlash, Condition( function Trig_Condition))
endfunction

I have added a Trigger for the Conditions, and it works, just that stupid set gg_trg gives me errors >.<
 

0zaru

Learning vJASS ;)
Reaction score
60
That variable must have the same name that your trigger. Or else use a local trigger.
 

Hatebreeder

So many apples
Reaction score
381
I found a Bug in JASS New Gen...
When you change the name of the Trigger, and click on, Syntax check, it gives you an error. If you Save, then it doesn't...
 

SFilip

Gone but not forgotten
Reaction score
634
Syntax Check doesn't "know" about your global variables unless they're defined in the same thing.
It's not a bug, you can just ignore messages like that. Remember - if it saves then everything is OK.
 

Hatebreeder

So many apples
Reaction score
381
Hmmm... My Spell doesn't work whatsoever...
Well, that's not so important, at least I got some JASS expirience.
Thanks to all, +REP from me =)
 

SerraAvenger

Cuz I can
Reaction score
234
1. you have to initialise the variables before using them! ( angle / Integer without a valid Integer will return an error , so will Integer + 1 )
2. you cannot divide by 0

However, you made good progress! It was really easy to understand your code : ) gj

local integer Integer = 0

should solve some of the problems
 
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