Data Realms Fan Forums http://45.55.195.193/ |
|
Same-team turrent unselectablility http://45.55.195.193/viewtopic.php?f=73&t=17204 |
Page 1 of 3 |
Author: | whitty [ Tue Nov 24, 2009 4:27 pm ] |
Post subject: | 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? |
Author: | CrazyMLC [ Tue Nov 24, 2009 4:34 pm ] |
Post subject: | Re: Same-team turrent unselectablility |
http://www.datarealms.com/wiki/index.ph ... ntrollable Check the wiki next time, k? |
Author: | whitty [ Tue Nov 24, 2009 4:50 pm ] |
Post subject: | 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; |
Author: | Abdul Alhazred [ Tue Nov 24, 2009 5:42 pm ] |
Post subject: | 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. |
Author: | CrazyMLC [ Tue Nov 24, 2009 5:46 pm ] |
Post subject: | 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. |
Author: | Abdul Alhazred [ Tue Nov 24, 2009 6:33 pm ] |
Post subject: | 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 |
Author: | CrazyMLC [ Tue Nov 24, 2009 6:36 pm ] |
Post subject: | 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 ... |
Author: | Abdul Alhazred [ Tue Nov 24, 2009 6:40 pm ] |
Post subject: | Re: Same-team turrent unselectablility |
But that is a syntax error! |
Author: | CrazyMLC [ Tue Nov 24, 2009 6:47 pm ] |
Post subject: | Re: Same-team turrent unselectablility |
It should work. You even said yourself, it is a function. |
Author: | whitty [ Tue Nov 24, 2009 6:49 pm ] |
Post subject: | Re: Same-team turrent unselectablility |
Doesn't work for me. |
Author: | Abdul Alhazred [ Tue Nov 24, 2009 6:51 pm ] |
Post subject: | 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 |
Author: | whitty [ Tue Nov 24, 2009 6:59 pm ] |
Post subject: | Re: Same-team turrent unselectablility |
I get no errors in the console but the turrets don't end up getting placed. |
Author: | CrazyMLC [ Tue Nov 24, 2009 7:08 pm ] |
Post subject: | Re: Same-team turrent unselectablility |
On second thought, I think I made a mistake. You cant set functions, can you? |
Author: | whitty [ Tue Nov 24, 2009 7:11 pm ] |
Post subject: | 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. |
Author: | Grif [ Tue Nov 24, 2009 11:50 pm ] |
Post subject: | 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 |
Page 1 of 3 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |