Author Topic: Bot has ID 56  (Read 3739 times)

0 Members and 1 Guest are viewing this topic.

Offline asdf?

  • Major(1)
  • Posts: 3
Bot has ID 56
« on: June 18, 2018, 05:12:37 pm »
After adding few bots to the game via script (creating them using TNewPlayer.Create) one bot gets ID 56.
It displays and works normally in-game except for when it's taken from Event functions then it appears as 56.
Causes Server crash or a lot of 'out of range' errors in script.

Offline Savage

  • Soldier
  • **
  • Posts: 155
Re: Bot has ID 56
« Reply #1 on: June 19, 2018, 10:19:13 am »
Show us the code so maybe some1 will help you

Offline asdf?

  • Major(1)
  • Posts: 3
Re: Bot has ID 56
« Reply #2 on: June 19, 2018, 12:05:11 pm »
Here's example code + output.

Offline Moroes

  • Soldier
  • **
  • Posts: 165
    • Soldat-Game.eu
Re: Bot has ID 56
« Reply #3 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
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.
« Last Edit: June 19, 2018, 02:04:23 pm by Moroes »

Offline Irlandec

  • Soldier
  • **
  • Posts: 176
Re: Bot has ID 56
« Reply #4 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.

Offline soldat-game

  • Camper
  • ***
  • Posts: 407
Re: Bot has ID 56
« Reply #5 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
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.

Offline asdf?

  • Major(1)
  • Posts: 3
Re: Bot has ID 56
« Reply #6 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
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.