0 Members and 2 Guests are viewing this topic.
procedure SpawnBots();var i: byte; NewPlayer: TNewPlayer;begin for i := 1 to 20 do begin NewPlayer := TNewPlayer.Create; try NewPlayer.Name := 'Test bot!'; NewPlayer.Team := 1; // important! NewPlayer.PantsColor := $FFFFFFFF; NewPlayer.SkinColor := $FFFFFFFF; Players.Add(NewPlayer, TJoinSilent); finally NewPlayer.Free; // important! end; end;end;procedure OnPlayerRespawn(Player: TActivePlayer);begin WriteLn(inttostr(Player.ID));end;procedure Init;var i: Byte;begin for i := 1 to 32 do Players[i].OnAfterRespawn := @OnPlayerRespawn; end;begin Init; SpawnBots();end.
Protests anyone?
You'd better not mix SC2 with SC3, ActivateServer is SC2 procedure. There's no need to use SC2 anymore afaik, I believe most of the features were replaced in SC3 and you can use libraries for more advanced stuff.I couldn't replicate that behaviour tho, but you should set legacy to false(0) in the scripts config and test with SC3 only tho.I'd suggest using only this page for your future scripting https://wiki.soldat.pl/index.php/Category:ScriptCore_3I feel like adding deprecated status to SC2 page. Protests anyone?Something like this could work. Should work as cmd too, just see the wiki and assign the event handlers to whatever you want.Code: [Select]procedure SpawnBots();var i: byte; NewPlayer: TNewPlayer;begin for i := 1 to 20 do begin NewPlayer := TNewPlayer.Create; try NewPlayer.Name := 'Test bot!'; NewPlayer.Team := 1; // important! NewPlayer.PantsColor := $FFFFFFFF; NewPlayer.SkinColor := $FFFFFFFF; Players.Add(NewPlayer, TJoinSilent); finally NewPlayer.Free; // important! end; end;end;procedure OnPlayerRespawn(Player: TActivePlayer);begin WriteLn(inttostr(Player.ID));end;procedure Init;var i: Byte;begin for i := 1 to 32 do Players[i].OnAfterRespawn := @OnPlayerRespawn; end;begin Init; SpawnBots();end.