View Single Post
crazydog
AlliedModders Donor
Join Date: Jan 2006
Old 04-14-2011 , 14:56   Re: Force TF2 bot to build sentry at location
Reply With Quote #9

Quote:
Originally Posted by wgooch View Post
You could try creating a prop_dynamic with a model and teleporting that instead, however I'm not seeing any problems with the code though.

You could try teleporting the entity before DispatchSpawn, it should still end up in the right position when it is spawned.
Well, using this code:
Code:
#include <sourcemod> #include <sdktools> #define PLUGIN_VERSION "1.0" public OnPluginStart(){     HookEvent("teamplay_round_start", Event_RoundStarted, EventHookMode_PostNoCopy); } public Action:Event_RoundStarted(Handle:Event, const String:name[], bool:broadcast){     new entity = -1;     while ((entity = FindEntityByClassname(entity, "bot_hint_sentrygun")) != INVALID_ENT_REFERENCE) {         PrintToServer("%i", entity);         AcceptEntityInput(entity, "Kill");     }     PrintToServer("removed all sentries");         new sentrypos = CreateEntityByName("bot_hint_sentrygun");     PrintToServer("New Entity ID is %i", sentrypos);     if (DispatchKeyValue(sentrypos, "TeamNum", "2"))         PrintToServer("TeamNum set successfully");     else         PrintToServer("Error setting TeamNum");     if (DispatchKeyValue(sentrypos, "angles", "0 130 0"))         PrintToServer("angles set successfully");     else         PrintToServer("Error setting angles");             new Float:origin[3] = {-1654.0, 2372.0, -453.0};     new Float:angle[3] = {0.0, 177.0, 0.0};     TeleportEntity(sentrypos, origin, angle, NULL_VECTOR);             if(DispatchSpawn(sentrypos))         PrintToServer("Entity spawned successfully");     else         PrintToServer("Error spawning entity");             new prop = CreateEntityByName("prop_dynamic");     PrintToServer("New Entity ID is %i", prop);     SetEntityModel(prop, "models/buildables/sentry1_blueprint.mdl");     TeleportEntity(prop, origin, angle, NULL_VECTOR);     if(DispatchSpawn(prop))         PrintToServer("Entity spawned successfully");     else         PrintToServer("Error spawning entity"); }
Everything seems to work right. All the tests are successful, and I get a sentry blueprint spawning, but the bot engies do not want to build at the location where the hint is. Any ideas?

I'm thinking maybe it is really a "hint", so they won't always build there.
crazydog is offline