Best Answer Gambit, 26 June 2022 - 05:41 AM
Hello again brother.
...for example Player_GetEntities returns an Egroup, and I wonder if I can randomly select individual entities in the Egroup.
To select an individual entity, you need to us the EGroup_GetSpawnedEntityAt function.
Here is an example:
EGroup_Clear(EGroup_CreateIfNotFound("eg_TheNameYouWannaCallIt")) local total = EGroup_CountSpawned("eg_TheNameYouWannaCallIt") -- All the entities of the EGroup local rnd = World_GetRand(1,total) -- Indexing starts from 1. local entityID = EGroup_GetSpawnedEntityAt("eg_TheNameYouWannaCallIt",rnd)
... Or something.
The entityID is of course a random entity, chosen from the EG.
Aside from these group objects I've been trying to print the players name with Player_GetDisplayName. But it prints out "table: 312B0D10" does this mean the LocString object is a table? and if so how do I get the display name out of it?
Player_GetDisplayName, indeed returns an array with more info. What you seek is the first element of that array. In other words:
local player_name = Player_GetDisplayName(playerID)[1]
And lastly I've been trying to get an alert to show up with the following line:
UIWarning_Show("hello World")but it seems it doesn't do anything, I feel I'm missing something but I don't know what.
Try:
Util_MissionTitle("hello World")
... But remember, if a different event is running, then you may miss this one...
There is an alternative for this. You can try calling a function from your current function:
function YOUR_FUNCTION() ... Rule_Add(Rule_Display_Your_Message) ... end function Rule_Display_Your_Message() if not Event_IsAnyRunning() then Util_MissionTitle("hello World") Rule_Remove(Rule_Display_Your_Message) end endGo to the full post