• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] What the hell is wrong here

Status
Not open for further replies.
Level 19
Joined
Aug 24, 2007
Messages
2,888
JASS:
//TESH.scrollpos=3
//TESH.alwaysfold=0
 function Trig_Fury_of_the_Sapphiron_Actions takes nothing returns nothing
    local group g
    local unit cu
if ( GetSpellAbilityId() == 'A00P' )  then
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 5
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call CreateNUnitsAtLoc( 1, 'h009', GetOwningPlayer(GetTriggerUnit()), GetRandomLocInRect(RectFromCenterSizeBJ(GetUnitLoc(GetTriggerUnit()), 100.00, 100.00)), bj_UNIT_FACING )
        call UnitApplyTimedLifeBJ( 0.01, 'BTLF', GetLastCreatedUnit() )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    set g = GetUnitsInRectAll(GetUnitsInRangeOfLocAll(800.00, GetUnitLoc(GetTriggerUnit())))
        loop
            set cu = FirstOfGroup(g)
            exitwhen cu = null
            if ((IsUnitType(GetEnumUnit(), UNIT_TYPE_MAGIC_IMMUNE) == false ) and ( IsUnitType(cu, UNIT_TYPE_STRUCTURE) == false ) and ( IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()),GetOwningPlayer(cu)) = true ) and (GetOwningPlayer(cu)) == true )) then
            call UnitDamageTargetBJ( GetTriggerUnit(), cu, 3000.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC )
            call CreateNUnitsAtLoc( 1, 'h005', GetOwningPlayer(GetTriggerUnit()), GetUnitLoc(cu), bj_UNIT_FACING )
            call UnitApplyTimedLifeBJ( 1.00, 'BTLF', GetLastCreatedUnit() )
            call IssueTargetOrderBJ( GetLastCreatedUnit(), "entanglingroots", cu)
            call GroupRemoveUnit(g,cu)
            endif
        endloop
    call DestroyGroup(g)
    endif
endfunction

//===========================================================================
function InitTrig_Fury_of_the_Sapphiron takes nothing returns nothing
    set gg_trg_Fury_of_the_Sapphiron = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Fury_of_the_Sapphiron, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddAction( gg_trg_Fury_of_the_Sapphiron, function Trig_Fury_of_the_Sapphiron_Actions )
endfunction
JASS:
    set g = GetUnitsInRectAll(GetUnitsInRangeOfLocAll(800.00, GetUnitLoc(GetTriggerUnit()))
TESH says error is here btw
This is my Fury of the Sapphiron spell which damages and casts entaglin rots spell(with crystal buff efect) on enemies nearby and I use units for some effects to make them bigger
Well It was okan in GUI but when I converted in jass and make some modifications on it, it got broken
NewGen WE gives error, normal WE doesnt give error but closes application with error the error drwatson gives This app applied invaild action blabla blabla
 
Last edited:
Level 19
Joined
Aug 24, 2007
Messages
2,888
Ive exitwhen :/ doesnt it end the loop
Edit
ok its fixed but It still gives error
I edited the tread check the trigger again
and where is purple btw Heey someone here need a hand :D
I'll make a spotlight with PurplePoot like in batman
 
Level 9
Joined
Aug 10, 2007
Messages
92
You made some small mistakes such as = instead of == on some lines, also yoru group was invalid, try this:

JASS:
function Trig_Fury_of_the_Sapphiron_Actions takes nothing returns nothing
    local group g
    local unit cu
if ( GetSpellAbilityId() == 'A00P' )  then
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 5
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call CreateNUnitsAtLoc( 1, 'h009', GetOwningPlayer(GetTriggerUnit()), GetRandomLocInRect(RectFromCenterSizeBJ(GetUnitLoc(GetTriggerUnit()), 100.00, 100.00)), bj_UNIT_FACING )
        call UnitApplyTimedLifeBJ( 0.01, 'BTLF', GetLastCreatedUnit() )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    set g = GetUnitsInRangeOfLocAll(800.00, GetUnitLoc(GetTriggerUnit()))
        loop
            set cu = FirstOfGroup(g)
            exitwhen cu == null
            if ((IsUnitType(cu, UNIT_TYPE_MAGIC_IMMUNE) == false ) and ( IsUnitType(cu, UNIT_TYPE_STRUCTURE) == false ) and ( IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()),GetOwningPlayer(cu)) == true  )) then
            call UnitDamageTargetBJ( GetTriggerUnit(), cu, 3000.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_MAGIC )
            call CreateNUnitsAtLoc( 1, 'h005', GetOwningPlayer(GetTriggerUnit()), GetUnitLoc(cu), bj_UNIT_FACING )
            call UnitApplyTimedLifeBJ( 1.00, 'BTLF', GetLastCreatedUnit() )
            call IssueTargetOrderBJ( GetLastCreatedUnit(), "entanglingroots", cu)
            call GroupRemoveUnit(g,cu)
            endif
        endloop
    call DestroyGroup(g)
    endif
endfunction
//===========================================================================
function InitTrig_Fury_of_the_Sapphiron takes nothing returns nothing
    set gg_trg_Fury_of_the_Sapphiron = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Fury_of_the_Sapphiron, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddAction( gg_trg_Fury_of_the_Sapphiron, function Trig_Fury_of_the_Sapphiron_Actions )
endfunction

It still leaks locations though, you need to take care of that.
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
yea Im quite new in jass yo very new actually :D tnx for help buddy
EDIT: Need help again it doesnt do 3000 damage it doesnt do damage anyway
Units are enemy and every other conditions are fine
BTW effects work
EDIT 2: FIXED just move the call GroupRemoveUnit(g,cu) after endif :)
Hey Im starting to get better :D
EDIT 3: Now I just need to reduce the leaks :)
 
Last edited:
Level 40
Joined
Dec 14, 2005
Messages
10,532
To help remove leaks, have a look at these 3 natives to replace your unit creation;

JASS:
native          CreateUnit          takes player id, integer unitid, real x, real y, real face returns unit
constant native GetUnitX            takes unit whichUnit returns real
constant native GetUnitY            takes unit whichUnit returns real
 
Level 9
Joined
Aug 10, 2007
Messages
92
Natives are one of reasons why you use JASS, it would be stupid to not use them.

JASS:
call CreateNUnitsAtLoc

replace that with

JASS:
local unit dummy = CreateUnit()

JASS:
UnitDamageTargetBJ

can be
JASS:
UnitDamageTarget()
´

Basically all the functions you used that ends with BJ can be replaced by native functions (that doesn't have BJ in their name). You need to study common.j to figure out what the native functins are called, this can easily be done in JASSCraft.
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
ah I use JASS for creating custom functions or making triggers shorter but thanks for tip anyway :)
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
ah sorry its because of I didnt know what native means in my language :D I checked in dictionary now I got it
 
Status
Not open for further replies.
Top