I am an experienced programmer but I'm having difficulties handing the transition to Osiris.
Firstly, I'm assuming there's some script somewhere that runs when the level loads to say "For every player, spawn a Dummy at their corresponding start point" or something similar. It makes the dummy a Player and adds them to the party. Where is this? I've scoured the pre-created scripts and found no references to the Dummy character. I know the wiki's character creation process is still a WIP but in the meantime I'd at least like to configure what characters get assigned to joining players.
Secondly, how might I execute a script that I wish to run once per player when they load into the level? For example, if I want to set the player's level to level 2 when they load in.
At first I thought I'd do
IF
GameEventSet("GAMEEVENT_GameStarted")
THEN
CharacterLevelUpTo(CHARACTERGUID_S_GLO_CharacterCreationDummy_001_da072fe7-fdd5-42ae-9139-8bd4b9fca406, 2);
Two problems with this. Firstly, it only applies to dummy 1 and I'd need to copy/paste it for 2/3/4. Which is messy and ugly and not dynamic enough for me.
Secondly, it doesn't work. When I load in, a little icon appears in the party portrait for my character to indicate the character leveled... but the level remains at "1" and I have no points to apply.
Now if I were doing this in a normal language I'd have a function called when the game initializes, loop through all connected players, get their assigned characters then assign levels to them. But I don't know how to do that here.
So my question has three parts.
- Is "GameEventSet("GAMEEVENT_GameStarted")" an appropriate place to call such an event? I only want it to run once. Will this run when the players load? I have read a bit about setting flags and think I got the hang of it so I should be able to use a flag to prevent this from happening multiple times.
- How can I dynamically obtain all the players? I want to apply XP to each of them and not put in a fixed GUID character.
- Why isn't the CharacterLevelUpTo working as intended?