• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[JASS] Trigger doing NOTHING

Status
Not open for further replies.
Alright so what is supossed to happen:

Hero uses spell, launches into air, sfx, everyone around him gets damaged and sent flying away looking toward the hero.

What does happen:

Hero uses spell, stays on ground, sfx, nothing, nope, nada

The Jass

JASS:
scope Sharenzaki
globals
    unit Cstr = GetSpellAbilityUnit()
    group Targ
    location Sot
    real drag = 5
    integer Dama = R2I(GetUnitStateSwap(UNIT_STATE_LIFE, Cstr))
    integer damage = (((Dama + GetHeroStatBJ(bj_HEROSTAT_STR, GetLastCreatedUnit(), false)) / 2) * (GetUnitAbilityLevel(Cstr, 'A009' )))
endglobals
private function Trig_Sharenzaki_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A009' ) ) then
        return false
    endif
    return true
endfunction

private function Trig_Sharenzaki_Func002001003001 takes nothing returns boolean
    return ( GetUnitFlyHeight(GetFilterUnit()) <= 10 )
endfunction

private function Trig_Sharenzaki_Func002001003002 takes nothing returns boolean
    return ( IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(Cstr)) == true )
endfunction

private function Trig_Sharenzaki_Func002001003 takes nothing returns boolean
    return GetBooleanAnd( Trig_Sharenzaki_Func002001003001(), Trig_Sharenzaki_Func002001003002() )
endfunction

private function Trig_Sharenzaki_Func002A takes nothing returns nothing
    call PauseUnitBJ( true, GetEnumUnit() )
    call GroupAddUnitSimple( GetEnumUnit(), Targ )
endfunction

private function Trig_Sharenzaki_FuncCust takes nothing returns nothing
    set Sot = PolarProjectionBJ(GetUnitLoc(Cstr), drag, AngleBetweenPoints(GetUnitLoc(Cstr), GetUnitLoc(GetEnumUnit())))
    call SetUnitPositionLocFacingLocBJ(GetEnumUnit(), Sot, GetUnitLoc(Cstr))
endfunction

private function Trig_Sharenzaki_Func005A takes nothing returns nothing
    call ForGroupBJ( Targ, function Trig_Sharenzaki_FuncCust)
endfunction

private function Trig_Sharenzaki_FuncCust02 takes nothing returns nothing
    set drag = (drag - 0.1)
endfunction

private function Trig_Sharenzaki_FuncCust03 takes nothing returns nothing
    call PauseUnitBJ( false, GetEnumUnit())
    call UnitDamageTargetEx( Cstr, GetEnumUnit(), damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_ATTACK, true)
endfunction

private function Trig_Sharenzaki_Actions takes nothing returns nothing
    local timer spud
    local timer spt
    local effect abba = AddSpecialEffectTargetUnitBJ( "weapon", Cstr, "Abilities\\Weapons\\ChimaeraAcidMissile\\ChimaeraAcidMissile.mdl" )
    call ForGroupBJ( GetUnitsInRangeOfLocMatching(( 200.00 + ( I2R(GetUnitAbilityLevelSwapped('A009', Cstr)) * 50.00 ) ), GetUnitLoc(Cstr), Condition(function Trig_Sharenzaki_Func002001003)), function Trig_Sharenzaki_Func002A)
    call GroupRemoveUnitSimple( Cstr, Targ )
    call UnitAddAbilityBJ( 'Amrf', Cstr )
    call SetUnitTimeScalePercent( Cstr, 50 )
    call SetUnitFlyHeightBJ( Cstr, 1000, 2.00 )
    call TriggerSleepAction(2.00)
    call SetUnitFlyHeightBJ( Cstr, 0, 1.00 )
    call TriggerSleepAction(1.00)
    call TimerStart(spud, 0.02, true, function Trig_Sharenzaki_Func005A) 
    call TimerStart(spt, 0.02, true, function Trig_Sharenzaki_FuncCust02)
    call TriggerSleepAction(1.00)  
    call DestroyTimer(spud) 
    call DestroyTimer(spt) 
    call ForGroupBJ(Targ, function Trig_Sharenzaki_FuncCust03)
    call PauseUnitBJ( false, Cstr)
    call DestroyEffectBJ(abba)
    call SetUnitTimeScalePercent( Cstr, 100 )
    call UnitRemoveAbilityBJ( 'Amrf', Cstr )
    set abba = null
    set spt = null
    set spud = null
    set Cstr = null
    set Targ = null
    set Sot = null
endfunction

//===========================================================================
public function InitTrig takes nothing returns nothing
    local trigger trg = CreateTrigger()
    call TriggerAddAction(trg, function Trig_Sharenzaki_Actions)
    call TriggerAddCondition(trg, Condition(function Trig_Sharenzaki_Conditions))
    call TriggerRegisterDamageEvent(trg)
    set trg = null
endfunction
endscope
 
Level 7
Joined
Mar 16, 2008
Messages
348
JASS:
integer damage = (((Dama + GetHeroStatBJ(bj_HEROSTAT_STR,GetLastCreatedUnit(), false)) / 2) * (GetUnitAbilityLevel(Cstr, 'A009' )))
GetLastCreatedUnit()
Shouldnt that be Cstr?I only read the first lines :p if that doesn't work ill read the rest.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Main/First problem is here:
JASS:
globals
    unit Cstr = GetSpellAbilityUnit()
    group Targ
    location Sot
    real drag = 5
    integer Dama = R2I(GetUnitStateSwap(UNIT_STATE_LIFE, Cstr))
    integer damage = (((Dama + GetHeroStatBJ(bj_HEROSTAT_STR, GetLastCreatedUnit(), false)) / 2) * (GetUnitAbilityLevel(Cstr, 'A009' )))
endglobals
Should look like this:
JASS:
globals
    unit Cstr
    group Targ
    location Sot
    real drag=5
    integer Dama
    integer damage
endglobals
All the variables should be "set" in the function Trig_Sharenzaki_Actions
 
Hmm both right, will test that out

Ok now it looks like this

JASS:
scope Sharenzaki
globals
    unit Cstr
    group Targ
    location Sot
    real drag
    integer Dama
    integer damage
endglobals
private function Trig_Sharenzaki_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A009' ) ) then
        return false
    endif
    return true
endfunction

private function Trig_Sharenzaki_Func002001003001 takes nothing returns boolean
    return ( GetUnitFlyHeight(GetFilterUnit()) <= 10 )
endfunction

private function Trig_Sharenzaki_Func002001003002 takes nothing returns boolean
    return ( IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(Cstr)) == true )
endfunction

private function Trig_Sharenzaki_Func002001003 takes nothing returns boolean
    return GetBooleanAnd( Trig_Sharenzaki_Func002001003001(), Trig_Sharenzaki_Func002001003002() )
endfunction

private function Trig_Sharenzaki_Func002A takes nothing returns nothing
    call PauseUnitBJ( true, GetEnumUnit() )
    call GroupAddUnitSimple( GetEnumUnit(), Targ )
endfunction

private function Trig_Sharenzaki_FuncCust takes nothing returns nothing
    set Sot = PolarProjectionBJ(GetUnitLoc(Cstr), drag, AngleBetweenPoints(GetUnitLoc(Cstr), GetUnitLoc(GetEnumUnit())))
    call SetUnitPositionLocFacingLocBJ(GetEnumUnit(), Sot, GetUnitLoc(Cstr))
endfunction

private function Trig_Sharenzaki_Func005A takes nothing returns nothing
    call ForGroupBJ( Targ, function Trig_Sharenzaki_FuncCust)
endfunction

private function Trig_Sharenzaki_FuncCust02 takes nothing returns nothing
    set drag = (drag - 0.1)
endfunction

private function Trig_Sharenzaki_FuncCust03 takes nothing returns nothing
    call PauseUnitBJ( false, GetEnumUnit())
    call UnitDamageTargetEx( Cstr, GetEnumUnit(), damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_ATTACK, true)
endfunction

private function Trig_Sharenzaki_Actions takes nothing returns nothing
    local timer spud
    local timer spt
    local effect abba = AddSpecialEffectTargetUnitBJ( "weapon", Cstr, "Abilities\\Weapons\\ChimaeraAcidMissile\\ChimaeraAcidMissile.mdl" )
    set Cstr = GetSpellAbilityUnit()
    set Dama = R2I(GetUnitStateSwap(UNIT_STATE_LIFE, Cstr))
    set drag = 5
    set damage = (((Dama + GetHeroStatBJ(bj_HEROSTAT_STR, Cstr, false)) / 2) * (GetUnitAbilityLevel(Cstr, 'A009' )))
    call ForGroupBJ( GetUnitsInRangeOfLocMatching(( 200.00 + ( I2R(GetUnitAbilityLevelSwapped('A009', Cstr)) * 50.00 ) ), GetUnitLoc(Cstr), Condition(function Trig_Sharenzaki_Func002001003)), function Trig_Sharenzaki_Func002A)
    call GroupRemoveUnitSimple( Cstr, Targ )
    call UnitAddAbilityBJ( 'Amrf', Cstr )
    call SetUnitTimeScalePercent( Cstr, 50 )
    call SetUnitFlyHeightBJ( Cstr, 1000, 2.00 )
    call TriggerSleepAction(2.00)
    call SetUnitFlyHeightBJ( Cstr, 0, 1.00 )
    call TriggerSleepAction(1.00)
    call TimerStart(spud, 0.02, true, function Trig_Sharenzaki_Func005A) 
    call TimerStart(spt, 0.02, true, function Trig_Sharenzaki_FuncCust02)
    call TriggerSleepAction(1.00)  
    call DestroyTimer(spud) 
    call DestroyTimer(spt) 
    call ForGroupBJ(Targ, function Trig_Sharenzaki_FuncCust03)
    call PauseUnitBJ( false, Cstr)
    call DestroyEffectBJ(abba)
    call SetUnitTimeScalePercent( Cstr, 100 )
    call UnitRemoveAbilityBJ( 'Amrf', Cstr )
    set abba = null
    set spt = null
    set spud = null
    set Cstr = null
    set Targ = null
    set Sot = null
endfunction

//===========================================================================
public function InitTrig takes nothing returns nothing
    local trigger trg = CreateTrigger()
    call TriggerAddAction(trg, function Trig_Sharenzaki_Actions)
    call TriggerAddCondition(trg, Condition(function Trig_Sharenzaki_Conditions))
    call TriggerRegisterDamageEvent(trg)
    set trg = null
endfunction
endscope

Ok.. still does the same exact thing...
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
Spiwn is right :
All the variables must be "set" in the function Trig_Sharenzaki_Actions.

And if you use an InitTrig function in a scope, the trigger name must be the scope name or the InitTrig<ScopeName> won't never called.

Personally i use a scope with an initializer, so i don't care about the trigger name.
 
Last edited:
Level 12
Joined
Apr 27, 2008
Messages
1,228
Why would he want to do that :D
It is unnecessary(most of the time) when using JNGP.
I will examine the code ;)
Edit: Yes, this it too incomplete( I mean you use systems, that are not present in the code, nor posts).
I second the Troll-Brain: Attach the map.
Or some map.
 
Level 3
Joined
Jun 3, 2008
Messages
52
Attach files by posting a reply to this thread, and then look for "Manage Attachments" in the advanced mode of the editor.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
No, it is not a bad thing.
But that is still unnecessary. Just type some wrong thing connected with vJAss
Example:
struct a
b
endstruct
Ofcourse there are a lot more syntax mistakes that do this.
Will give you an error, and will show you most of the war3map.j
So far, I haven't had any compilation bug.
 
Level 11
Joined
Apr 6, 2008
Messages
760
lots of BJ replace them with have they acctly are for e.g

JASS:
function ForGroupBJ takes group whichGroup, code callback returns nothing
    // If the user wants the group destroyed, remember that fact and clear
    // the flag, in case it is used again in the callback.
    local boolean wantDestroy = bj_wantDestroyGroup
    set bj_wantDestroyGroup = false

    call ForGroup(whichGroup, callback)

    // If the user wants the group destroyed, do so now.
    if (wantDestroy) then
        call DestroyGroup(whichGroup)
    endif
endfunction

JASS:
function UnitAddAbilityBJ takes integer abilityId, unit whichUnit returns boolean
    return UnitAddAbility(whichUnit, abilityId)
endfunction

JASS:
function SetUnitFlyHeightBJ takes unit whichUnit, real newHeight, real rate returns nothing
    call SetUnitFlyHeight(whichUnit, newHeight, rate)
endfunction

JASS:
function GroupRemoveUnitSimple takes unit whichUnit, group whichGroup returns nothing
    call GroupRemoveUnit(whichGroup, whichUnit)
endfunction

JASS:
function PauseUnitBJ takes boolean pause, unit whichUnit returns nothing
    call PauseUnit(whichUnit, pause)
endfunction

dont use BJ use what is inside them for e.g


call ForGroup(whichGroup, callback)

call SetUnitFlyHeight(whichUnit, newHeight, rate)


and call TriggerSleepAction(2.00) they are bad!

well i think u know the point and here i did fix ur script but it will needs alot of work like getting rid of waits and all those small unessary functions

JASS:
scope Sharenzaki initializer Init //Better then InitTrig thing
globals
    unit Cstr
    group Targ
    location Sot
    real drag = 5
    integer Dama
    integer damage
endglobals
private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A009'
endfunction

private function Trig_Sharenzaki_Func002001003001 takes nothing returns boolean
    return ( GetUnitFlyHeight(GetFilterUnit()) <= 10 )
endfunction

private function Trig_Sharenzaki_Func002001003002 takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(Cstr))
endfunction

private function Trig_Sharenzaki_Func002001003 takes nothing returns boolean
    return GetBooleanAnd( Trig_Sharenzaki_Func002001003001(), Trig_Sharenzaki_Func002001003002() )
endfunction

private function Trig_Sharenzaki_Func002A takes nothing returns nothing
    call PauseUnit(GetEnumUnit(),true)
endfunction

private function Trig_Sharenzaki_FuncCust takes nothing returns nothing
    local unit Enum = GetEnumUnit()
    set Sot = PolarProjectionBJ(GetUnitLoc(Cstr), drag, AngleBetweenPoints(GetUnitLoc(Cstr), GetUnitLoc(Enum)))
    call SetUnitPositionLoc(Enum,Sot)
    call SetUnitFacing(Enum,AngleBetweenPoints(GetUnitLoc(Enum),GetUnitLoc(Cstr)))
endfunction

private function Trig_Sharenzaki_Func005A takes nothing returns nothing
    call ForGroup( Targ, function Trig_Sharenzaki_FuncCust)
endfunction

private function Trig_Sharenzaki_FuncCust02 takes nothing returns nothing
    set drag = (drag - 0.1)
endfunction

private function Trig_Sharenzaki_FuncCust03 takes nothing returns nothing
    call PauseUnit(GetEnumUnit(),false )
    call UnitDamageTargetEx( Cstr, GetEnumUnit(), damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_ATTACK, true)
endfunction

private function Actions takes nothing returns nothing
    local timer spud = CreateTimer()
    local timer spt = CreateTimer()
    local effect abba = AddSpecialEffectTarget("Abilities\\Weapons\\ChimaeraAcidMissile\\ChimaeraAcidMissile.mdl",Cstr,"weapon")
    set Cstr = GetTriggerUnit()
    set Dama = R2I(GetUnitState(Cstr,UNIT_STATE_LIFE))
    set damage = (Dama + GetHeroStr(Cstr,false)/2)*(GetUnitAbilityLevel(Cstr, 'A009' ))
    call GroupEnumUnitsInRange(Targ,GetLocationX(GetUnitLoc(Cstr)),GetLocationY(GetUnitLoc(Cstr)),200.00+(I2R(GetUnitAbilityLevel(Cstr,'A009'))*50.00),Filter(function Trig_Sharenzaki_Func002001003))
    call ForGroup(Targ,function Trig_Sharenzaki_Func002A)
    call GroupRemoveUnit(Targ,Cstr)
    call UnitAddAbility(Cstr,'Amrf') 
    call SetUnitTimeScale(Cstr,.5)
    call SetUnitFlyHeight(Cstr,1000,2.00 )
    call TriggerSleepAction(2.00) 
    call SetUnitFlyHeight( Cstr, 0, 1.00 )
    call TriggerSleepAction(1.00)
    call TimerStart(spud, 0.02, true, function Trig_Sharenzaki_Func005A)
    call TimerStart(spt, 0.02, true, function Trig_Sharenzaki_FuncCust02)
    call TriggerSleepAction(1.00)
    call DestroyTimer(spud)
    call DestroyTimer(spt)
    call ForGroup(Targ, function Trig_Sharenzaki_FuncCust03)
    call PauseUnit(Cstr,false)
    call DestroyEffect(abba)
    call SetUnitTimeScale( Cstr, 100 )
    call UnitRemoveAbility(Cstr,'Amrf')
    set abba = null
    set spt = null
    set spud = null
    set Cstr = null
    set Targ = null
    set Sot = null
endfunction

private function Init takes nothing returns nothing
    local trigger trg = CreateTrigger()
    call TriggerAddAction(trg, function Actions)
    call TriggerAddCondition(trg, Condition(function Conditions))
    call TriggerRegisterDamageEvent(trg)
    set trg = null
endfunction
endscope


and this isnt even MUI, i would recommend using a struct
 
Status
Not open for further replies.
Top