- Joined
- Jan 7, 2005
- Messages
- 7,550
[JASS=Hi. I have been playing around with JASSNewGen and I would like to get some feedback on this code]
function Trig_BoardIn_Actions takes nothing returns nothing
local unit tempunt = GetEnteringUnit()
local rect temprect = gg_rct_TempArea
local location temploc = GetRandomLocInRect(temprect)
call SetUnitPositionLoc(tempunt, temploc)
call RemoveLocation(temploc)
call SetUnitOwner(tempunt, PLAYER_NEUTRAL_PASSIVE, false)
if tempunt == gg_unit_Othr_0213 then
call ThrallIsBoarding()
call DisableTrigger(GetTriggeringTrigger())
endif
set tempunt = null
set temprect = null
set temploc = null
endfunction
function ThrallIsBoarding takes nothing returns nothing
local group TempingRedGroup
call ForGroup(GetUnitsOfPlayerAll(Player(0)), RemoveUnit(GetEnumUnit()))
set TempingRedGroup = GetLastCreatedGroup()
call DestroyGroup(TempingRedGroup)
call BJDebugMSG("This function is working.")
set TempingRedGroup = null
endfunction
//===========================================================================
function InitTrig_BoardIn takes nothing returns nothing
set gg_trg_BoardIn = CreateTrigger()
call TriggerRegisterEnterRectSimple(gg_trg_BoardIn, gg_rct_TutorialSetSail)
call TriggerAddAction(gg_trg_BoardIn, function Trig_BoardIn_Actions)
endfunction[/code]
The syntax Checker yelled at me because of undeclared variables (such as gg_rct_TempArea, which DOES exist, gg_unit_Othr_0213, etc).
It also says "Can't convert Nothing to Code" on the ForGroup part. Perhaps I misunderstood the function.
What I'm basically trying to do is removing all the units owned by player once gg_unit_Othr_0213 enters the rect.
function Trig_BoardIn_Actions takes nothing returns nothing
local unit tempunt = GetEnteringUnit()
local rect temprect = gg_rct_TempArea
local location temploc = GetRandomLocInRect(temprect)
call SetUnitPositionLoc(tempunt, temploc)
call RemoveLocation(temploc)
call SetUnitOwner(tempunt, PLAYER_NEUTRAL_PASSIVE, false)
if tempunt == gg_unit_Othr_0213 then
call ThrallIsBoarding()
call DisableTrigger(GetTriggeringTrigger())
endif
set tempunt = null
set temprect = null
set temploc = null
endfunction
function ThrallIsBoarding takes nothing returns nothing
local group TempingRedGroup
call ForGroup(GetUnitsOfPlayerAll(Player(0)), RemoveUnit(GetEnumUnit()))
set TempingRedGroup = GetLastCreatedGroup()
call DestroyGroup(TempingRedGroup)
call BJDebugMSG("This function is working.")
set TempingRedGroup = null
endfunction
//===========================================================================
function InitTrig_BoardIn takes nothing returns nothing
set gg_trg_BoardIn = CreateTrigger()
call TriggerRegisterEnterRectSimple(gg_trg_BoardIn, gg_rct_TutorialSetSail)
call TriggerAddAction(gg_trg_BoardIn, function Trig_BoardIn_Actions)
endfunction[/code]
The syntax Checker yelled at me because of undeclared variables (such as gg_rct_TempArea, which DOES exist, gg_unit_Othr_0213, etc).
It also says "Can't convert Nothing to Code" on the ForGroup part. Perhaps I misunderstood the function.
What I'm basically trying to do is removing all the units owned by player once gg_unit_Othr_0213 enters the rect.