View unanswered posts | View active topics It is currently Thu Apr 18, 2024 4:05 pm



Reply to topic  [ 4 posts ] 
 TF2 Sentry Gun 
Author Message
User avatar

Joined: Mon Aug 29, 2011 9:26 pm
Posts: 28
Reply with quote
Post 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?


Tue Oct 18, 2011 8:35 pm
Profile
User avatar

Joined: Fri Aug 20, 2010 4:45 am
Posts: 911
Location: No Comment.
Reply with quote
Post Re: TF2 Sentry Gun
Sorry, but i can't help but anyway isn't there already a few topics about this?


Wed Oct 19, 2011 12:08 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13143
Location: Here
Reply with quote
Post 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.


Wed Oct 19, 2011 1:11 am
Profile
User avatar

Joined: Mon Aug 29, 2011 9:26 pm
Posts: 28
Reply with quote
Post Re: TF2 Sentry Gun
It works! Perfectly too! Thanks for your help!


Wed Oct 19, 2011 6:52 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.054s | 16 Queries | GZIP : Off ]