Official Soldat Forums

Soldat Talk => Need Help? Report Bugs! => Topic started by: asdf? on June 18, 2018, 05:12:37 pm

Title: Bot has ID 56
Post by: asdf? on June 18, 2018, 05:12:37 pm
After adding few bots to the game via script (creating them using TNewPlayer.Create (https://wiki.soldat.pl/index.php/TPlayers.Add)) one bot gets ID 56.
It displays and works normally in-game except for when it's taken from Event functions (https://wiki.soldat.pl/index.php/Category:Server_Scripting_Events) then it appears as 56.
Causes Server crash or a lot of 'out of range' errors in script.
Title: Re: Bot has ID 56
Post by: Savage on June 19, 2018, 10:19:13 am
Show us the code so maybe some1 will help you
Title: Re: Bot has ID 56
Post by: asdf? on June 19, 2018, 12:05:11 pm
Here (https://imgur.com/a/kRX7PQg)'s example code + output.
Title: Re: Bot has ID 56
Post by: Moroes on June 19, 2018, 01:48:46 pm
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_3 (https://wiki.soldat.pl/index.php/Category:ScriptCore_3)
I 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.
Title: Re: Bot has ID 56
Post by: Irlandec on June 19, 2018, 06:39:28 pm
Protests anyone?

I am protesting. SC3 should be shipped with all(!) working stuff with 1.8. Without any another revisions.
Some stuff from the Wiki is not working/bugged at the current official Soldat server version.
Title: Re: Bot has ID 56
Post by: soldat-game on June 20, 2018, 07:08:20 am
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_3 (https://wiki.soldat.pl/index.php/Category:ScriptCore_3)
I 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.

Do not add bots when you start the server. Will change the map.
Title: Re: Bot has ID 56
Post by: asdf? on June 20, 2018, 05:41:05 pm
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_3 (https://wiki.soldat.pl/index.php/Category:ScriptCore_3)
I 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.

thanks, that helped.
gonna use sc3 only from now on.