Hey, I'm new to coding in JASS, and I'm trying to convert my GUI triggers to JASS, and optimize them a bit, or write them in another way than the GUI converter thingy does. I just ran into a problem here in this script:
I'm writing it in JASS like this:
But there's some error in the set p = GetPlayersMatching(...)
Please help me out >.<
Thanks in advance
Trigger:
- Init
- Events
- Map initialization
- Conditions
- Actions
- Visibility - Disable black mask
- Player Group - Make (All players) treat (All players) as an Ally
- Set temp_player = (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User)))
- Player Group - Pick every player in temp_player and do (Actions)
- Loop - Actions
- Player Group - Add (Picked player) to farmers
- Player - Set (Picked player) Current gold to 80
- Player - Set (Picked player) Current lumber to 20
- Unit - Create 1 Farmer for (Picked player) at ((Picked player) start location) facing Default building facing degrees
- Loop - Actions
- Custom script: call DestroyForce(udg_temp_player)
- Player - Set Player 12 (Brown) Current gold to 1000
- Events
I'm writing it in JASS like this:
JASS:
function setstuff takes nothing returns nothing
call SetPlayerStateBJ(GetEnumPlayer(), PLAYER_STATE_RESOURCE_GOLD, 80)
call SetPlayerStateBJ(GetEnumPlayer(), PLAYER_STATE_RESOURCE_LUMBER, 20)
call CreateNUnitsAtLoc(1, 039;H001039;, GetEnumPlayer(), GetPlayerStartLocationLoc(GetEnumPlayer()), bj_UNIT_FACING)
endfunction
function actions takes nothing returns nothing
local force p
call FogMaskEnable(false)
call SetForceAllianceStateBJ(GetPlayersAll(), GetPlayersAll(), bj_ALLIANCE_ALLIED)
set p = GetPlayersMatching(GetBooleanAnd(GetPlayerSlotState(GetFilterPlayer()) == PLAYER_SLOT_STATE_PLAYING, GetPlayerController(GetFilterPlayer()) == MAP_CONTROL_USER))
call ForForce(p, function setstuff)
call DestroyForce(p)
set p = null
call SetPlayerStateBJ(Player(11), PLAYER_STATE_RESOURCE_GOLD, 1000)
endfunction
But there's some error in the set p = GetPlayersMatching(...)
Please help me out >.<
Thanks in advance