View unanswered posts | View active topics It is currently Sat Dec 28, 2024 4:49 pm



Reply to topic  [ 31 posts ]  Go to page 1, 2, 3  Next
 Same-team turrent unselectablility 
Author Message
User avatar

Joined: Sat Jun 16, 2007 2:31 am
Posts: 2982
Location: Texas
Reply with quote
Post Same-team turrent unselectablility
I have this script making turrets on a dropship:

Code:
function Create(self)
   --working variables
   self.Turret = {};
   self.Turret.Team = 0;
   --create the turrets.
   self.Turret[1] = CreateACrab("WWM DS Turret MG");
   MovableMan:AddActor(self.Turret[1]);
   self.Turret[1].Offset = Vector(43,15);
   self.Turret[2] = CreateACrab("WWM DS Turret MG");
   MovableMan:AddActor(self.Turret[2]);
   self.Turret[2].Offset = Vector(-43,15);
end
function Destroy(self)
   for i = 1, #self.Turret do
      if MovableMan:IsActor(self.Turret[i]) == true then
         if self.Health < 1 then
            self.Turret[i]:GibThis()
         else
            self.Turret[i].ToDelete = true
         end
      end
   end
end
function Update(self)
   --update turret spatial properties
   for i = 1, #self.Turret do
      if MovableMan:IsActor(self.Turret[i]) == true then
         --basic turret position upkeep (so it doesn't fall at 999999m/s)
         self.Turret[i].Vel.X = 0;
         self.Turret[i].Vel.Y = 0;
         --update turret position
         self.Turret[i].RotAngle = self.RotAngle;
         self.Turret[i].Pos = self.Pos + self:RotateOffset(self.Turret[i].Offset)
      end
   end
end


What I would like to do is make them on the team of the dropship, but uncontrollable. How would you do that?


Tue Nov 24, 2009 4:27 pm
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Same-team turrent unselectablility
http://www.datarealms.com/wiki/index.ph ... ntrollable
Check the wiki next time, k?


Tue Nov 24, 2009 4:34 pm
Profile WWW
User avatar

Joined: Sat Jun 16, 2007 2:31 am
Posts: 2982
Location: Texas
Reply with quote
Post Re: Same-team turrent unselectablility
I've never had luck with the Wiki.

So, would my code look like this?
Code:
   self.Turret.IsControllable = false;


Tue Nov 24, 2009 4:50 pm
Profile
DRL Developer
DRL Developer

Joined: Tue Aug 11, 2009 5:09 am
Posts: 395
Reply with quote
Post Re: Same-team turrent unselectablility
whitty wrote:
I've never had luck with the Wiki.
So, would my code look like this?
Code:
   self.Turret.IsControllable = false;

IsControllable is a function, not a variable, so you have to call it like this:
Code:
self.Turret:IsControllable()

However, the description of IsControllable states "Tells wheter the player can switch control to this at all" so this function won't solve your problem. I'm not saying that what you asked for cannot be done, just that I have not been able to figure out a way of doing it. That is why I used lua based MGs on the Armed Dummy Dropship.


Tue Nov 24, 2009 5:42 pm
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Same-team turrent unselectablility
Actually, it works. (For me at least.)
Just set it to false and you wont be able to select it.


Tue Nov 24, 2009 5:46 pm
Profile WWW
DRL Developer
DRL Developer

Joined: Tue Aug 11, 2009 5:09 am
Posts: 395
Reply with quote
Post Re: Same-team turrent unselectablility
CrazyMLC wrote:
Actually, it works. (For me at least.)
Just set it to false and you wont be able to select it.

That is good news, but I still don't understand how. Could you perhaps point out what I'm doing wrong here (code from the coalition dropship):
Code:
function Create(self)
   self.Turret = {}
   self.Turret[1] = CreateACrab("Coalition Small MG Turret")
   self.Turret[1].Offset = Vector(-105,-10)
   self.Turret[1].IsControllable = false
   MovableMan:AddActor(self.Turret[1])
   self.Turret[2] = CreateACrab("Coalition Small MG Turret")
   self.Turret[2].Offset = Vector(105,-10)
   self.Turret[2].IsControllable = false
   MovableMan:AddActor(self.Turret[2])
end

function Update(self)
   for i = 1, #self.Turret do
      if MovableMan:IsActor(self.Turret[i]) then
         self.Turret[i].Vel = Vector(0,0)
         self.Turret[i].RotAngle = self.RotAngle
         self.Turret[i].Pos = self.Pos + self:RotateOffset(self.Turret[i].Offset)
      end
   end
end

function Destroy(self) --[[ ... ]] end


Tue Nov 24, 2009 6:33 pm
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Same-team turrent unselectablility
Abdul Alhazred wrote:
Code:
function Create(self)
   self.Turret = {}
   self.Turret[1] = CreateACrab("Coalition Small MG Turret")
   self.Turret[1].Offset = Vector(-105,-10)
   self.Turret[1]:IsControllable() = false -- Here
   MovableMan:AddActor(self.Turret[1])
   self.Turret[2] = CreateACrab("Coalition Small MG Turret")
   self.Turret[2].Offset = Vector(105,-10)
   self.Turret[2]:IsControllable() = false -- Here
   MovableMan:AddActor(self.Turret[2])
end

...


Tue Nov 24, 2009 6:36 pm
Profile WWW
DRL Developer
DRL Developer

Joined: Tue Aug 11, 2009 5:09 am
Posts: 395
Reply with quote
Post Re: Same-team turrent unselectablility
But that is a syntax error!


Tue Nov 24, 2009 6:40 pm
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Same-team turrent unselectablility
It should work. You even said yourself, it is a function.


Tue Nov 24, 2009 6:47 pm
Profile WWW
User avatar

Joined: Sat Jun 16, 2007 2:31 am
Posts: 2982
Location: Texas
Reply with quote
Post Re: Same-team turrent unselectablility
Doesn't work for me.


Tue Nov 24, 2009 6:49 pm
Profile
DRL Developer
DRL Developer

Joined: Tue Aug 11, 2009 5:09 am
Posts: 395
Reply with quote
Post Re: Same-team turrent unselectablility
I must have misunderstood you. What am I supposed to do at this line?
Code:
self.Turret[1]:IsControllable() = false -- Here


Tue Nov 24, 2009 6:51 pm
Profile
User avatar

Joined: Sat Jun 16, 2007 2:31 am
Posts: 2982
Location: Texas
Reply with quote
Post Re: Same-team turrent unselectablility
I get no errors in the console but the turrets don't end up getting placed.


Tue Nov 24, 2009 6:59 pm
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Same-team turrent unselectablility
On second thought, I think I made a mistake. You cant set functions, can you?


Tue Nov 24, 2009 7:08 pm
Profile WWW
User avatar

Joined: Sat Jun 16, 2007 2:31 am
Posts: 2982
Location: Texas
Reply with quote
Post Re: Same-team turrent unselectablility
From what I know of functions, no, they only have the input.

But I saw a while back someone showed a GIF of an ACrab with 2 uncontrollable turrets on either side of it.


Tue Nov 24, 2009 7:11 pm
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Same-team turrent unselectablility
Jesus crazyMLC you're useless

Abdul you were in the right the entire time, MLC's just dumb

setting functions honestly

anyways whitty uh
try spawning the actor indirectly; eg, make an instant-gib aemitter that gibs into the actor rather than actually spawning through lua. if you do presetname checks when you find the two turret actors it should be pretty reliable


Tue Nov 24, 2009 11:50 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 31 posts ]  Go to page 1, 2, 3  Next

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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.052s | 14 Queries | GZIP : Off ]