- Joined
- Jul 17, 2006
- Messages
- 145
ok well iv noticed that whenever you pick every unit in a unit group and do <actions>, it sometimes tends to to work if you use certian functions such as "triggersleepaction()" etc. I dont know if thats the case here, (at least i hope not, i dont wanna have to remake this script again O__O) but that it is because of some stupid mistake i made.
Im also assuming that it picks one unit in a group, does the actions, and moves onto the next one. hence the use of a global var in this script
This script has passed the blizzard syntax check and the JassCraft syntax check. It runs the game without crashing, it just simply dosent work.
What this script _should_ do is pick every circle of power on the map, then create a rifleman at that position and give it some stationary buffs. then, it should pick every unit within 500 of the circle of type (building A000, a barracks) and also a tower, which i dont have in this map (im making a demo map for someone, just to showcase the trigger) and convert them to the player it made the rifleman for. it should do this for every player in turn, so that each player has an even (or almost even) number of "bases"
any help would be apricated. thx in advance
Im also assuming that it picks one unit in a group, does the actions, and moves onto the next one. hence the use of a global var in this script
This script has passed the blizzard syntax check and the JassCraft syntax check. It runs the game without crashing, it just simply dosent work.
What this script _should_ do is pick every circle of power on the map, then create a rifleman at that position and give it some stationary buffs. then, it should pick every unit within 500 of the circle of type (building A000, a barracks) and also a tower, which i dont have in this map (im making a demo map for someone, just to showcase the trigger) and convert them to the player it made the rifleman for. it should do this for every player in turn, so that each player has an even (or almost even) number of "bases"
JASS:
function Trig_Barracks_Setup_Func001001002 takes nothing returns boolean
return ( GetUnitTypeId(GetEnumUnit()) == 'ncp2' )
// circle of power
endfunction
function Trig_Barracks_Setup_Func001Func002001003001 takes nothing returns boolean
return ( GetUnitTypeId(GetEnumUnit()) == 'h000' )
endfunction
// yes i realize they are the same, but they will be changed. regardless, this should still work
function Trig_Barracks_Setup_Func001Func002001003002 takes nothing returns boolean
return ( GetUnitTypeId(GetEnumUnit()) == 'h000' )
endfunction
function Trig_Barracks_Setup_Func001Func002001003 takes nothing returns boolean
return GetBooleanOr( Trig_Barracks_Setup_Func001Func002001003001(), Trig_Barracks_Setup_Func001Func002001003002() )
endfunction
//===========================================================================
function Trig_Barracks_Setup_Func001Func002A takes nothing returns nothing
call SetUnitOwner( GetEnumUnit(), ConvertedPlayer(udg_SetupPlayerNumber), true )
endfunction
function Trig_Barracks_Setup_Func001A takes nothing returns nothing
local group g = GetUnitsInRangeOfLocMatching(500.00, GetUnitLoc(GetLastCreatedUnit()), Condition(function Trig_Barracks_Setup_Func001Func002001003))
local unit u
local location l = GetUnitLoc(GetEnumUnit())
loop
set udg_SetupPlayerNumber = udg_SetupPlayerNumber + 1
exitwhen udg_SetupPlayerNumber > 12
exitwhen GetPlayerSlotState(ConvertedPlayer(udg_SetupPlayerNumber)) == PLAYER_SLOT_STATE_PLAYING
endloop
if (udg_SetupPlayerNumber > 12) then
set udg_SetupPlayerNumber = 1
endif
set u = CreateUnitAtLoc(ConvertedPlayer(udg_SetupPlayerNumber), 'hrif', l, bj_UNIT_FACING)
call UnitAddAbility(u, 'A000') //stationary ability, pretty much a 100% self-slow
call AttachBoolean(u, "stationary", true)
call ForGroupBJ( g, function Trig_Barracks_Setup_Func001Func002A )
call RemoveLocation(l)
set g = null
set u = null
set l = null
endfunction
function Trig_Barracks_Setup_Actions takes nothing returns nothing
local group g = GetUnitsOfPlayerMatching(Player(PLAYER_NEUTRAL_PASSIVE), Condition(function Trig_Barracks_Setup_Func001001002))
call ForGroupBJ( g, function Trig_Barracks_Setup_Func001A )
set g = null
endfunction
//===========================================================================
function InitTrig_Barracks_Setup takes nothing returns nothing
set gg_trg_Barracks_Setup = CreateTrigger( )
call TriggerAddAction( gg_trg_Barracks_Setup, function Trig_Barracks_Setup_Actions )
endfunction
any help would be apricated. thx in advance