Raised This Month: $51 Target: $400
 12% 

Force TF2 bot to build sentry at location


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
crazydog
AlliedModders Donor
Join Date: Jan 2006
Old 04-06-2011 , 17:57   Force TF2 bot to build sentry at location
Reply With Quote #1

What would be the simplest way to force a bit Engineer to build a sentru in a specific spot?
crazydog is offline
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 04-06-2011 , 23:37   Re: Force TF2 bot to build sentry at location
Reply With Quote #2

disallow him to build a sentry in another places?
Leonardo is offline
crazydog
AlliedModders Donor
Join Date: Jan 2006
Old 04-06-2011 , 23:45   Re: Force TF2 bot to build sentry at location
Reply With Quote #3

Quote:
Originally Posted by Leonardo View Post
disallow him to build a sentry in another places?
Heh.

One thing I thought of was simply firing the player_builtobject event and tying it to a bot, but the problem is I would want the engie to go there first, and not be distracted and build a sentry elsewhere first.
crazydog is offline
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 04-06-2011 , 23:53   Re: Force TF2 bot to build sentry at location
Reply With Quote #4

errr... fake walk?
create timer and teleport engie on each tick? :O
ooomg
Leonardo is offline
wgooch
Member
Join Date: Dec 2008
Old 04-09-2011 , 20:51   Re: Force TF2 bot to build sentry at location
Reply With Quote #5

You could try messing with the "bot_hint_sentrygun" entity used in tr_dustbowl.
I assume that if you spawn it somewhere, the nearest bot on the specified team (TeamNum keyvalue) would build there.

Note: In tr_dustbowl, it is directly centered in the ground so that it's origin is touching the floor.
wgooch is offline
crazydog
AlliedModders Donor
Join Date: Jan 2006
Old 04-10-2011 , 02:09   Re: Force TF2 bot to build sentry at location
Reply With Quote #6

Quote:
Originally Posted by wgooch View Post
You could try messing with the "bot_hint_sentrygun" entity used in tr_dustbowl.
I assume that if you spawn it somewhere, the nearest bot on the specified team (TeamNum keyvalue) would build there.

Note: In tr_dustbowl, it is directly centered in the ground so that it's origin is touching the floor.
Ahhh! I was looking in cp_dustbowl. Thanks for reminding me it's a different map! I would have found the entity but you saved me a bunch of time. Thanks a ton.

Last edited by crazydog; 04-10-2011 at 02:11.
crazydog is offline
crazydog
AlliedModders Donor
Join Date: Jan 2006
Old 04-10-2011 , 17:33   Re: Force TF2 bot to build sentry at location
Reply With Quote #7

Alright, so first of all, this is my first time doin' much with entities, so I apologize if I do anything facepalmingly stupid.

Firstly, the code I'm trying
Code:
#include <sourcemod> #include <sdktools> #define PLUGIN_VERSION "1.0" public OnPluginStart(){     HookEvent("round_start", Event_RoundStarted, EventHookMode_PostNoCopy);     //HookEvent("player_builtobject", Event_NewBuilding); } public Action:Event_RoundStarted(Handle:Event, const String:name[], bool:broadcast){     new entity = -1;     while ((entity = FindEntityByClassname(entity, "bot_hint_sentrygun")) != INVALID_ENT_REFERENCE) {         PrintToChatAll("%i", entity);         AcceptEntityInput(entity, "Kill");     }         new sentrypos = CreateEntityByName("bot_hint_sentrygun");     PrintToChatAll("New Entity ID is %i", sentrypos);     if (DispatchKeyValue(sentrypos, "TeamNum", "2"))         PrintToChatAll("TeamNum set successfully");     else         PrintToChatAll("Error setting TeamNum");     if (DispatchKeyValue(sentrypos, "angles", "0 130 0"))         PrintToChatAll("angles set successfully");     else         PrintToChatAll("Error setting angles");     if(DispatchSpawn(sentrypos))         PrintToChatAll("Entity spawned successfully");     else         PrintToChatAll("Error spawning entity");     new Float:origin[3] = {2193.2, 1566.7, 64.96};     new Float:angle[3] = {0.0, 130.0, 0.0};     TeleportEntity(sentrypos, origin, angle, NULL_VECTOR); }

All the tests show success:
Code:
removed all sentries
New Entity ID is 402
TeamNum set successfully
angles set successfully
Entity spawned successfully
However, bots don't seem to want to build at the position I teleport it to, which may be because it's not properly teleporting, but there's no return value for TeleportEntity.

What's the best way to test that it teleported correctly?

Last edited by crazydog; 04-11-2011 at 03:39.
crazydog is offline
wgooch
Member
Join Date: Dec 2008
Old 04-10-2011 , 19:11   Re: Force TF2 bot to build sentry at location
Reply With Quote #8

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.
wgooch is offline
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
psychonic

BAFFLED
Join Date: May 2008
Old 04-15-2011 , 10:19   Re: Force TF2 bot to build sentry at location
Reply With Quote #10

Try placing them with Stripper.
psychonic is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:13.


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