• 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.

ID for player slot status in JASS [to run AI Script]

Status
Not open for further replies.
Level 14
Joined
Dec 12, 2009
Messages
1,027
I was wondering if any other users know what the player slot status identities are (in JASS). Below is a cut-out from a custom AI script (converted into JASS) that I think is responsible for limiting the AI to computer-controlled players that are in 1-12.
//===========================================================================
function TotalFoodProduced takes nothing returns integer
return GetPlayerState(ai_player,PLAYER_STATE_RESOURCE_FOOD_CAP)
endfunction

If a player leaves, AI scripts can't run because that player slot is set to user.
Players 13-16 also can't run AI scripts because they can't be assigned to computer players.

My question:
GetPlayerState(ai_player... is where the script is preset to a computer player. What would I need to change that to in order for a script to work for a user (one who left the game or is AFK) & what would I need to change that to for a neutral player (Hostile/Victim/Extra/Passive) to run it? The player state can't be changed in game (constant defined in the lobby apparently) and I use all player slots in my map.

Steps after that would include: How do I import that back into a map?

If this question as answered already please link me to the answer. All of my ideas for search terms proved fruitless...

//\\o0//\\
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,259
I was wondering if any other users know what the player slot status identities are (in JASS). Below is a cut-out from a custom AI script (converted into JASS) that I think is responsible for limiting the AI to computer-controlled players that are in 1-12.
That function appears to be responsible for returning the food cap for the player. As hinted by it returning "player state" and not "player slot state" and that the constant used is "resource food cap".

GetPlayerState(ai_player... is where the script is preset to a computer player.
I looks like a global player variable to me.
What would I need to change that to in order for a script to work for a user (one who left the game or is AFK) & what would I need to change that to for a neutral player (Hostile/Victim/Extra/Passive) to run it? The player state can't be changed in game (constant defined in the lobby apparently) and I use all player slots in my map.
I do not think you can start AI for non-computer slots. Doing so does nothing as the game has not allocated them thought processes so they cannot make decisions. Maybe I am just too used to SC2 where this is the case.

Anyway here are all the player states...
JASS:
constant native GetPlayerState takes player whichPlayer,playerstate whichPlayerState returns integer
PLAYER_STATE_ALLIED_VICTORY
PLAYER_STATE_FOOD_CAP_CEILING
PLAYER_STATE_GAME_RESULT
PLAYER_STATE_GIVES_BOUNTY
PLAYER_STATE_GOLD_GATHERED
PLAYER_STATE_GOLD_UPKEEP_RATE
PLAYER_STATE_LUMBER_GATHERED
PLAYER_STATE_LUMBER_UPKEEP_RATE
PLAYER_STATE_NO_CREEP_SLEEP
PLAYER_STATE_OBSERVER
PLAYER_STATE_OBSERVER_ON_DEATH
PLAYER_STATE_PLACED
PLAYER_STATE_RESOURCE_FOOD_CAP
PLAYER_STATE_RESOURCE_FOOD_USED
PLAYER_STATE_RESOURCE_GOLD
PLAYER_STATE_RESOURCE_HERO_TOKENS
PLAYER_STATE_RESOURCE_LUMBER
PLAYER_STATE_UNFOLLOWABLE

And here are all the player slot states and controller states...
JASS:
native GetPlayerSlotState takes player whichPlayer returns playerslotstate
PLAYER_SLOT_STATE_EMPTY
PLAYER_SLOT_STATE_LEFT
PLAYER_SLOT_STATE_PLAYING

native GetPlayerController takes player whichPlayer returns mapcontrol
MAP_CONTROL_COMPUTER
MAP_CONTROL_CREEP
MAP_CONTROL_NEUTRAL
MAP_CONTROL_NONE
MAP_CONTROL_RESCUABLE
MAP_CONTROL_USER
 
Status
Not open for further replies.
Top