AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How do I spawn a bot after I create it?? (https://forums.alliedmods.net/showthread.php?t=27671)

Geesu 04-26-2006 15:29

How do I spawn a bot after I create it??
 
Basically I can create the bots, but how do I spawn them?

Code:
        engfunc( EngFunc_CreateFakeClient, "" );         engfunc( EngFunc_CreateFakeClient, "" );         engfunc( EngFunc_CreateFakeClient, "" );         engfunc( EngFunc_CreateFakeClient, "" );         engfunc( EngFunc_CreateFakeClient, "" );         new players[32], iPlayerNum, id, i;         get_players( players, iPlayerNum, "b" );         for ( i = 0; i < iPlayerNum; i++ )         {             id = players[i];             if ( is_user_bot( id ) && !is_user_alive( id ) )             {                 server_print( "Spawning %d", id );                 spawn( id );             }         }

The above doesn't work

Des12 04-26-2006 18:04

I think you need two spawns:

Code:
engfunc( EngFunc_CreateFakeClient, "" );         engfunc( EngFunc_CreateFakeClient, "" );         engfunc( EngFunc_CreateFakeClient, "" );         engfunc( EngFunc_CreateFakeClient, "" );         engfunc( EngFunc_CreateFakeClient, "" );         new players[32], iPlayerNum, id, i;         get_players( players, iPlayerNum, "b" );         for ( i = 0; i < iPlayerNum; i++ )         {             id = players[i];             if ( is_user_bot( id ) && !is_user_alive( id ) )             {                 server_print( "Spawning %d", id );                 spawn( id );                 spawn( id );             }         }

Urahara 04-26-2006 18:45

Ohayo Geesu-san! :D

that particular FM function returns the ID of the bot Geesu-san! if you will simply make it connect using the dllfunc for clientconnect im sure you will get a fully functional bot, nyaah? :D

if not please try putinserver as you see bots are clients too and must not be simply forcibly spawned like that no no they get sad if they are not properly spawned :D

something along these lines works for ESF and SVEN Geesu-san!

Code:

public spawn_bot(id)
{
        new ent = engfunc(EngFunc_CreateFakeClient,"Urahara")
        if(!ent) return 0;

        set_user_info(ent,"model","BLEACHurahara")

        dllfunc(DLLFunc_ClientPutInServer,ent)

        finish_spawn(ent)

        return ent;
}


where finish_spawn is equivilent to a generic list of DispatchKeys though a ClientConnect should work better! :D

p3tsin 04-27-2006 09:09

uh, what comes after running ClientConnect and ClientPutInServer?
i tried cs_set_user_team() and it makes the bot spawn correctly, but it still acts like if it was in spectator mode (teleporting around the map to the spots where cameras are located)


All times are GMT -4. The time now is 05:03.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.