Raised This Month: $ Target: $400
 0% 

TF2 Remote Control Sentry Guns


Post New Thread Reply   
 
Thread Tools Display Modes
CnB|Omega
Junior Member
Join Date: Feb 2009
Old 07-02-2009 , 02:00   Re: TF2 Remote Control Sentry Guns
Reply With Quote #21

Quote:
Originally Posted by naris View Post
Do the dispensers work correctly? When you move them with the ztf2grab plugin, the dispensers don't heal in their new position, yet the old position still heals people.
No, they dont. They still heal people at the old position. Im trying to figure out how to fix this. I have a hunch that its an entity spawned at the dispenser location that does the healing. They still give ammo though.

This is what I have so far. It just uses a blanket cvar multiplier for how far they teleport.

Code:
sm_sentry - Start remote controlling your sentry gun.
sm_remote_off - Stop remote controlling your buildings.
sm_enter - Start remote controlling your teleport entrance.
sm_exit - Start remote controlling your teleport exit.
sm_disp - Start remote controlling your dispenser.
sm_remote_god - Gives the building you're currently controlling godmode.
Currently all commands require the ROOT flag, I usually do that when Im developing/testing plugins I write/mod.

I am still an amature when it comes to sourcemod scripting compared to others. I honestly dont know how to fix the OnGameFrame issue, but I know its possible since L. Duke managed it in his zGrabber plugin. Hopefully we can come up with a really good version of this together as this plugin could be really fun if it didn't take so much server resources.

Edit : Your version is definately much cleaner than mine Naris.
Attached Files
File Type: sp Get Plugin or Get Source (remotebuildings.sp - 416 views - 11.7 KB)

Last edited by CnB|Omega; 07-02-2009 at 02:43.
CnB|Omega is offline
CnB|Omega
Junior Member
Join Date: Feb 2009
Old 07-02-2009 , 02:39   Re: TF2 Remote Control Sentry Guns
Reply With Quote #22

Quote:
Originally Posted by Sexual Harassment Panda View Post
1)Variable speed based on level) make level 1's go faster than people, level 2's as fast as people, and level 3's slower than people
Checking the level of the senty would either be m_iUpgradeLevel or m_iState. Probably m_iUpgradeLevel, but Im not sure. Would just have to check the level of the sentry, then run a switch statement to set a coefficient and use the coefficient in the speed calculation.

One issue that would arise that I can think of is when and how often to check the level of the sentry to determine if its level has changed since it last checked.
CnB|Omega is offline
retsam
Veteran Member
Join Date: Aug 2008
Location: so-cal
Old 07-02-2009 , 03:12   Re: TF2 Remote Control Sentry Guns
Reply With Quote #23

Yes it is m_iUpgradeLevel.

And to check to determine youd do something like this

Code:
HookEntityOutput("obj_sentrygun",          "OnObjectHealthChanged", objectHealthChanged);

public objectHealthChanged(const String:output[], caller, activator, Float:delay)
{
if(oldiLevel[caller] != GetEntProp(caller, Prop_Send, "m_iUpgradeLevel"))
    {
    oldiLevel[caller] = GetEntProp(caller, Prop_Send, "m_iUpgradeLevel"); 

   new Float:origin[3]; 
   GetEntPropVector(caller, Prop_Send, "m_vecOrigin", origin);
   if(oldiLevel[caller] == 1)
   ; do something at level 1
   if(oldiLevel[caller] == 2)
   ;do something at level 2

etc
Think thats close to right.

Last edited by retsam; 07-02-2009 at 03:16.
retsam is offline
CnB|Omega
Junior Member
Join Date: Feb 2009
Old 07-02-2009 , 16:16   Re: TF2 Remote Control Sentry Guns
Reply With Quote #24

wow, thanks Retsam. Im glad you guys have a firm grasp on entity properties. Im having a hard time really learning how to manipulate them. The sheer number is enough to give me a headache, along with very little documention on what each is supposed to do, plus I havent even got a clue what values are appropriate to pass into the entity. Is there a way to see the default values of an entity?

Anyways, I had a small revelation last night. The only difference between controlling a sentry versus controlling a dispensor, entrance, or exit, is simply a few strings.

Code:
   if(strcmp(classname, "obj_sentrygun") == 0)
   {
    if(GetEntDataEnt2(i, FindSendPropOffs("CObjectSentrygun","m_hBuilder")) == client)
    {
     remoteid = i;
     break;
    }
   }
To control a dispenser, you just need to change "obj_sentrygun" to "obj_dispenser", and "CObjectSentrygun" to "CObjectDispenser".

The whole plugin could be greatly simplified by having one remote function, and just pass the appropriate strings into the function. Unfortunately, Im having no luck. Keep getting argument type mismatch.

Code:
public Action:sentry(client, args)
{
 new String:strBuilding[255];
 Format(strBuilding, sizeof(strBuilding), "sentries");
 new String:clsBuilding[255];
 Format(clsBuilding, sizeof(clsBuilding), "obj_sentrygun");
 new String:objBuilding[255];
 Format(objBuilding, sizeof(objBuilding), "CObjectSentrygun");
 
 remoteon(client, strBuilding, clsBuilding, objBuilding);
}
public Action:remoteon(client, strBuilding, clsBuilding, objBuilding, args)
{
 if(GetConVarInt(remotecvar) != 1)
 {
  PrintToChat(client, "Remote %s are not enabled.", strBuilding);
  return Plugin_Handled;
 }
 if(TF2_GetPlayerClass(client) != TFClass_Engineer)
 {
  PrintToChat(client, "You are not an engineer.");
  return Plugin_Handled;
 }
 new remoteid = -1;
 new entcount = GetEntityCount();
 for(new i=0;i<entcount;i++)
 {
  if(IsValidEntity(i))
  {
   new String:classname[50];
   GetEdictClassname(i, classname, 50);
 
   if(strcmp(classname, clsBuilding) == 0)
   {
    if(GetEntDataEnt2(i, FindSendPropOffs(objBuilding,"m_hBuilder")) == client)
    {
     remoteid = i;
     break;
    }
   }
  }
 }
CnB|Omega is offline
CnB|Omega
Junior Member
Join Date: Feb 2009
Old 07-02-2009 , 17:57   Re: TF2 Remote Control Sentry Guns
Reply With Quote #25

After looking through L.Duke Zgrabber plugin, I figured out he just uses a timer to update the location of the buildings. This isnt too different from OnGameFrame, but it doesnt call the function as often, so it alleviates a ton of lag. (Results may vary based on your server fps. In my case, its only calling it 10x a second instead of...120~x a second)

Code:
new Handle:rTimer;
 
public OnMapStart()
{
 // start update timer
 rTimer = CreateTimer(0.1, UpdateBuildings, INVALID_HANDLE, TIMER_REPEAT);
}
public OnMapEnd()
{
 CloseHandle(rTimer);
}
//Change OnGameFrame to this ...
public Action:UpdateBuildings(Handle:timer)
Players on my servers dont report as much lag (some report none) and it actually makes the movement somewhat smoother and not as jerky. Downside is they do seem to move a bit slower, but thats easily fixed by increasing the movement speed.

Something else I find is he used a teleport vector, not a teleport position, getting a vector using SubtractVectors. I have yet to try this out yet to see how it might affect the plugin.

Last edited by CnB|Omega; 07-02-2009 at 18:02.
CnB|Omega is offline
naris
AlliedModders Donor
Join Date: Dec 2006
Old 07-02-2009 , 23:33   Re: TF2 Remote Control Sentry Guns
Reply With Quote #26

Quote:
Originally Posted by CnB|Omega View Post
The whole plugin could be greatly simplified by having one remote function, and just pass the appropriate strings into the function. Unfortunately, Im having no luck. Keep getting argument type mismatch.
I have already done this, and a few other things. I have also merge in the buildlimit plugin, for reasone that will become apparent by the time I finish it.

Anyway, here is what I have do far -- still not done yet though.
Attached Files
File Type: sp Get Plugin or Get Source (remote.sp - 391 views - 46.1 KB)
File Type: inc remote.inc (7.0 KB, 127 views)
naris is offline
Sexual Harassment Panda
Veteran Member
Join Date: Dec 2008
Location: San Diego, CA
Old 07-03-2009 , 01:36   Re: TF2 Remote Control Sentry Guns
Reply With Quote #27

I'm loving the progress here. I'm currently considering opening up a 24/7 server with this plugin as the "Draw" and am making a map for the plugin, as we have found that the strategy is much different. I'd love to help coding, but i really don't know anything about sourcemod. also, just checking, does the inc file go in data?
__________________

Last edited by Sexual Harassment Panda; 07-03-2009 at 01:41.
Sexual Harassment Panda is offline
retsam
Veteran Member
Join Date: Aug 2008
Location: so-cal
Old 07-03-2009 , 01:43   Re: TF2 Remote Control Sentry Guns
Reply With Quote #28

No they go in the scripting\include folder.
retsam is offline
naris
AlliedModders Donor
Join Date: Dec 2006
Old 07-03-2009 , 03:44   Re: TF2 Remote Control Sentry Guns
Reply With Quote #29

Quote:
Originally Posted by Sexual Harassment Panda View Post
does the inc file go in data?
.inc files are not needed on the server at all. You only need it if you want to call any of the native functions from another plugin.
naris is offline
naris
AlliedModders Donor
Join Date: Dec 2006
Old 07-03-2009 , 03:49   Re: TF2 Remote Control Sentry Guns
Reply With Quote #30

newer version with convar for fall speed among other things -- still not done yet...
Attached Files
File Type: sp Get Plugin or Get Source (remote.sp - 333 views - 48.5 KB)
File Type: inc remote.inc (7.0 KB, 134 views)
naris 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 09:44.


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