Soldat Talk > Need Help? Report Bugs!

Bot has ID 56

(1/2) > >>

asdf?:
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.

Savage:
Show us the code so maybe some1 will help you

asdf?:
Here's example code + output.

Moroes:
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: ---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.
--- End code ---

Irlandec:

--- Quote from: Moroes on June 19, 2018, 01:48:46 pm ---Protests anyone?

--- End quote ---

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.

Navigation

[0] Message Index

[#] Next page

Go to full version