Need someone to test my script

M

Maximus

Guest
Here is my script:
Code:
//===NovaBurst===
function NovaBurst takes integer  IndicatorRawCode returns nothing  //== Takes Raw Code of the Indicator. Needed to create the caster.
function NovaBurst takes integer  SkillRaw returns nothing          //== Takes Raw Code of the Damaging Ability. This deals damage. Must have default order string as thunderclap.
function NovaBurst takes integer  NovaEffect returns nothing        //== Takes Raw Code of the Nova Effect.
function NovaBurst takes integer  WhichPlayer returns nothing       //== Takes Player Number of Casting Player.
function NovaBurst takes location Where returns nothing             //== Takes Position of The Target of Ability Being Cast.
function NovaBurst takes string   OrderString returns nothing       //== Order string of Nova Ability.

//== Local Declaration ==
    local unit    TempUnit
    local rect    TempRect
    local group   TempUnitGroup
    local integer TempInteger
//== Start the Effects ==
    set TempUnit      = GetLastCreatedUnit()
    set TempRect      = RectFromCenterSize(GetUnitLoc(GetSpellTargetUnit()), WhereRect, WhereRect)
    set TempUnitGroup = GetUnitsInRectMatching(TempRect, Condition( GetOwningPlayer(GetFilterUnit()) != Player(WhichPlayer) ))
    set TempInteger   = CountUnitsInGroup(TempUnitGroup)
    call CreateNUnitsAtLoc( 1, IndicatorRawCode, Player(WhichPlayer), Where, 0.00 )
    call UnitAddAbility( SkillRaw, TempUnit )
    call UnitApplyTimedLife( 2.00, 'BTLF', TempUnit )
    call IssueImmediateOrder( TempUnit, "thunderclap" )
    loop
        exitwhen TempInteger > 0
            set TempUnit = GroupPickRandomUnit(udg_TempUnitGroup)
            call CreateNUnitsAtLoc( 1, IndicatorRawCode, Player(WhichPlayer), Where, 0.00 )
            call UnitAddAbility( NovaEffect, GetLastCreatedUnit() )
            call UnitApplyTimedLife( 2.00, 'BTLF', GetLastCreatedUnit() )
            call IssueTargetOrder( GetLastCreatedUnit(), OrderString )
            call GroupRemoveUnitSimple( TempUnit, TempUnitGroup )
            set TempInteger   = CountUnitsInGroup(TempUnitGroup)
    endloop
    set TempUnit      = null
    set TempRect      = null
    set TempUnitGroup = null
    set TempInteger   = null
    call RemoveRect(TempRect)
    call DestroyGroup(TempUnitGroup)
endfunction
If it wrong, then please, write the right one. :banghead:

Well, I saved the map and when Validating Map Script it makes all triggers in my map error.
 
C

CryptWizard

Guest
Ummm... it's (sorry for being blunt) in the completely wrong format.
JASS differers to other programming languages in these ways:
- No function prototyping (VB, C, C++, Java, etc.)
- No function/variable/other stuff overloading
- The correct syntax for a function is:
Code:
function name takes whatittakes returns thetypeitreturns
function body
endfunction
And as I said before, theres no function prototyping, so whereever you use the keyword function, the code has to follow.
 
M

Maximus

Guest
Now I updated it, will this works:
Code:
//===NovaBurst===
function NovaBurst takes integer NovaBurstIndicatorRawCode, integer NovaBurstSkillRaw, integer NovaBurstWhichPlayer, real NovaBurstArea, location NovaBurstWhere, string NovaBurst OrderString returns nothing
//== Local Declaration ==
    local unit    TempUnit
    local rect    TempRect
    local group   TempUnitGroup
    local integer TempInteger
//== Start the Effects ==
    set TempUnit      = GetLastCreatedUnit()
    set TempRect      = RectFromCenterSize(GetUnitLoc(GetSpellTargetUnit()), NovaBurstArea(), NovaBurstArea())
    set TempUnitGroup = GetUnitsInRectMatching(TempRect, Condition( GetOwningPlayer(GetFilterUnit()) != Player(NovaBurstwhichPlayer()) ))
    set TempInteger   = CountUnitsInGroup(TempUnitGroup)
    call CreateNUnitsAtLoc( 1, NovaBurstIndicatorRawCode(), Player(NovaBurstWhichPlayer()), NovaBurstWhere(), 0.00 )
    call UnitAddAbility( NovaBurstSkillRaw(), TempUnit )
    call UnitApplyTimedLife( 2.00, 'BTLF', TempUnit )
    call IssueImmediateOrder( TempUnit, "thunderclap" )
    loop
        exitwhen TempInteger > 0
            set TempUnit = GroupPickRandomUnit(TempUnitGroup)
            call CreateNUnitsAtLoc( 1, NovaBurstIndicatorRawCode(), Player(NovaBurstWhichPlayer()), NovaBurstWhere(), 0.00 )
            call UnitAddAbility( NovaEffect, GetLastCreatedUnit() )
            call UnitApplyTimedLife( 2.00, 'BTLF', GetLastCreatedUnit() )
            call IssueTargetOrder( GetLastCreatedUnit(), NovaBurstOrderString() )
            call GroupRemoveUnitSimple( TempUnit, TempUnitGroup )
            set TempInteger   = CountUnitsInGroup(TempUnitGroup)
    endloop
    set TempUnit      = null
    set TempRect      = null
    set TempUnitGroup = null
    set TempInteger   = null
    call RemoveRect(TempRect)
    call DestroyGroup(TempUnitGroup)
endfunction

Also, how to start handle variables?
 

Chocobo

White-Flower
Reaction score
409
Code:
function NovaBurst takes integer NovaBurstIndicatorRawCode, integer NovaBurstSkillRaw, integer NovaBurstWhichPlayer, real NovaBurstArea, location NovaBurstWhere, string NovaBurst OrderString returns nothing
    local unit TempUnit=GetLastCreatedUnit()
    local rect TempRect=RectFromCenterSize(GetUnitLoc(GetSpellTargetUnit()), NovaBurstArea(), NovaBurstArea())
    local group TempUnitGroup=(GetUnitsInRectMatching(TempRect, Condition( GetOwningPlayer(GetFilterUnit()) != Player(NovaBurstwhichPlayer()) ))
    local integer TempInteger=(CountUnitsInGroup(TempUnitGroup)
    call CreateNUnitsAtLoc(1, NovaBurstIndicatorRawCode(), Player(NovaBurstWhichPlayer()), NovaBurstWhere(), 0.00 )
    call UnitAddAbility(NovaBurstSkillRaw(), TempUnit )
    call UnitApplyTimedLife(2.00, 'BTLF', TempUnit )
    call IssueImmediateOrder(TempUnit, "thunderclap" )
    loop
        exitwhen TempInteger > 0
            set TempUnit=GroupPickRandomUnit(TempUnitGroup)
            call CreateNUnitsAtLoc(1, NovaBurstIndicatorRawCode(), Player(NovaBurstWhichPlayer()), NovaBurstWhere(), 0.00 )
            call UnitAddAbility(NovaEffect, GetLastCreatedUnit() )
            call UnitApplyTimedLife(2.00, 'BTLF', GetLastCreatedUnit() )
            call IssueTargetOrder(GetLastCreatedUnit(), NovaBurstOrderString() )
            call GroupRemoveUnitSimple(TempUnit, TempUnitGroup )
            set TempInteger=CountUnitsInGroup(TempUnitGroup )
    endloop
    set TempUnit=null
    set TempRect=null
    set TempUnitGroup=null
    set TempInteger=null
    call RemoveRect(TempRect)
    call DestroyGroup(TempUnitGroup)
endfunction

You should specify directly locals when they are declared.
 
M

Maximus

Guest
That didn't work too. :banghead:
It makes error in all of the triggers in the map.
 

SFilip

Gone but not forgotten
Reaction score
634
Code:
    set TempUnit=null
    set TempRect=null
    set TempUnitGroup=null
    set TempInteger=null
    call RemoveRect(TempRect)
    call DestroyGroup(TempUnitGroup)
here you first remove the content of a variable and then try to remove it...that doesn't remove the leak so you need to use
Code:
    call RemoveRect(TempRect)
    call DestroyGroup(TempUnitGroup)
    set TempUnit=null
    set TempRect=null
    set TempUnitGroup=null
    set TempInteger=null

and the variable declaring part is wrong. first of all
Condition( GetOwningPlayer(GetFilterUnit()) != Player(WhichPlayer) ))
you can't put a condition this way. you need to make a function like this
Code:
function Something takes nothing returns boolean
    return GetOwningPlayer(GetFilterUnit()) != Player(NovaBurstwhichPlayer())
endfunction
and then use the condition as Condition(function Something)

also you have a couple extra ( there that should be removed. and there is also a location leak.
the final local declaration part would then be
Code:
    local unit TempUnit=GetLastCreatedUnit()
    local location TempLoc=GetUnitLoc(GetSpellTargetUnit())
    local rect TempRect=RectFromCenterSize(TempLoc, NovaBurstArea(), NovaBurstArea())
    local group TempUnitGroup=GetUnitsInRectMatching(TempRect, Condition(function Something)
    local integer TempInteger=CountUnitsInGroup(TempUnitGroup)
    call RemoveLocation(TempLoc)
 
M

Maximus

Guest
Forgotten to remove the Leak. :banghead:
Thanks to post the right one. Finally I got the last result. :D
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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