Data Realms Fan Forums
http://45.55.195.193/

TF2 Sentry Gun
http://45.55.195.193/viewtopic.php?f=1&t=25913
Page 1 of 1

Author:  Hunter0 [ Tue Oct 18, 2011 8:35 pm ]
Post subject:  TF2 Sentry Gun

I am making a sentry gun for my Team Fortress 2 mod but I don't know how to make a TDExplosive spawn my sentry ACrab (on the right team too) when it gibs on contact with something.
Can anyone help?

Author:  Sims_Doc [ Wed Oct 19, 2011 12:08 am ]
Post subject:  Re: TF2 Sentry Gun

Sorry, but i can't help but anyway isn't there already a few topics about this?

Author:  CaveCricket48 [ Wed Oct 19, 2011 1:11 am ]
Post subject:  Re: TF2 Sentry Gun

Hey, if you're gonna post just to say that other topics exist, at least link those topics.



@OP: The cleanest way to do this is with a quick Lua script attached to your TDExplosive, something like this:
Code:
function Create(self)

   self.alliedTeam = -1;
   self.enableDeploy = false;

end

function Update(self)

   if self.ID ~= self.RootID then
      local actor = MovableMan:GetMOFromID(self.RootID);
      if MovableMan:IsActor(actor) then
         self.alliedTeam = ToActor(actor).Team;
      end
   end

   if self:IsActivated() and self.ID == self.RootID then
      self.enableDeploy = true;
   end

end

function Destroy(self)

   if self.enableDeploy == true then
      self.deployActor = CreateACrab("Whatever your crab name is");
      self.deployActor.Team = self.alliedTeam;
      self.deployActor.Pos = self.Pos;
      self.deployActor.AIMode = 1;
      MovableMan:AddActor(self.deployActor);
   end

end

It's untested, so it may not work 100% guaranteed. There are also INI-only methods to gib actors as well, but they're a lot hackier.

Author:  Hunter0 [ Wed Oct 19, 2011 6:52 am ]
Post subject:  Re: TF2 Sentry Gun

It works! Perfectly too! Thanks for your help!

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/