Jump to content

How to find/access Groups that are 'client' slots?


Recommended Posts

Posted

I'm trying to access groups that are marked as client slots in MP. Using the typical Group.getByName() always returns nil for these groups.

 

Is there any other way I can access the groups? I just want to check if the group is nil or not.

Developer of Kaukasus Insurgency - a customizable Dynamic PvE Campaign with cloud hosting and stats tracking. (Alpha)

 

http://kaukasusinsurgency.com/

Posted

All of the data that can be returned from the group functions, except for controller which isn't useful on clients anyways, can be derived from the mission file itself. You can access the mission table via env.mission. From there you can iterate everything and build a DB of data that you find useful from there. For instance this is the mist code for building DBs...

 

https://github.com/mrSkortch/MissionScriptingTools/blob/master/mist.lua#L117

 

From there you just need to know a common way to access it. For instance this DB table is indexed by the unit name of any unit with the skill of player or client.

 

https://github.com/mrSkortch/MissionScriptingTools/blob/master/Example%20DBs/mist_DBs_humansByName.lua

 

Depending what you need you can use only the data in that table or use the group name to access the DBs.groupsByName table for the data in there. For instance the units and figuring out how many from the client group are alive.

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

Posted

Thanks Pikey and Grimes,

 

I was looking at how the Moose CLIENT class got it's information about client slots and see it was using very similar code to iterate through the env.mission table for units with skill 'client' (those are some big nested loops ;) )

 

Is there a shorter way of iterating through the table so that I only need to iterate maybe [countries][groups] ? If there isn't it's fine, i was just curious if I could reduce my code to maybe 2 to 3 loop iterations instead of the 4 that are there.

Developer of Kaukasus Insurgency - a customizable Dynamic PvE Campaign with cloud hosting and stats tracking. (Alpha)

 

http://kaukasusinsurgency.com/

Posted

It isn't a big deal if it is something you run once just to populate the data. If you know the coalition and country then it is pretty straight forward, but that will only iterate for that specific country in a coalition.

 

for index, groupData in pairs (env.mission.coalition.blue.USA) do

 

end

The right man in the wrong place makes all the difference in the world.

Current Projects:  Grayflag ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...