Data Realms Fan Forums http://45.55.195.193/ |
|
Need someone who knows quite a bit of LUA http://45.55.195.193/viewtopic.php?f=73&t=19638 |
Page 1 of 2 |
Author: | PvtVain [ Sun Aug 29, 2010 7:28 am ] |
Post subject: | Need someone who knows quite a bit of LUA |
Alright, again i'm back with needed help I've tried many things and I can't get the LUA code to do as I need First off: I made a thread asking about invisibility without lua, and I see this is impossible so, I searched around the mod releases and at like page 8-11 I encounter the ghillie suit actor for CC and I checked it out and saw that it had a invisibility script, and I do credit him greatly, but I can't get the code to make myself invisibility instead of changing teams, so can anyone help? Code: function Create(self) self.curteam = self.Team self.shottimer = Timer(); end function Update(self) if self:GetController():IsState(Controller.BODY_CROUCH) then self.Team = 1 - self.curteam end if self:GetController():IsState(Controller.WEAPON_FIRE) then self.Team = self.curteam self.shottimer:Reset() end if self:GetController():IsState(Controller.MOVE_LEFT) then self.Team = self.curteam end if self:GetController():IsState(Controller.MOVE_RIGHT) then self.Team = self.curteam end if self:GetController():IsState(Controller.BODY_JUMP) then self.Team = self.curteam end if not(self.shottimer:IsPastRealMS(2000)) then self.Team = self.curteam end if self.Health <= .5 then self.Team = self.curteam end end function Destroy(self) self.Team = self.curteam end I took about the flashwhite coding line cause it just made my guy completely white :V |
Author: | 411570N3 [ Sun Aug 29, 2010 8:17 am ] |
Post subject: | Re: Need someone who knows quite a bit of LUA |
The code for actual invisibility is incredibly different and complicated. Aim lower. |
Author: | CrazyMLC [ Sun Aug 29, 2010 8:18 am ] |
Post subject: | Re: Need someone who knows quite a bit of LUA |
Instead of looking through the mod releases thread so tediously just use the Search function. It's on the red bar near the top of the forum site. viewtopic.php?f=61&t=14644&hilit=invisibility Quote: Stealth Chip This is a stealth module that allows your units to cloak when not excessively moving or shooting. Do note that hp damage will disable the cloak. Looking at the code for it I smashed together something. Code: function Visiblize() for i = 1,MovableMan:GetMOIDCount() - 1 do if MovableMan:GetMOFromID(i).RootID == self.ID then MovableMan:GetMOFromID(i).Scale = 1 end end end function Create(self) self.LastShot = Timer() self.Hurt = Timer() self.HP = self.Health end function Update(self) if self:GetController():IsState(Controller.BODY_CROUCH) then for i = 1,MovableMan:GetMOIDCount() - 1 do if MovableMan:GetMOFromID(i).RootID == self.ID then MovableMan:GetMOFromID(i).Scale = 0 end end end if self.HP ~= self.Health then self.Hurt:Reset() end self.HP = self.Health if self:GetController():IsState(Controller.WEAPON_FIRE) then self.LastShot:Reset() end if not(self.LastShot:IsPastRealMS(2000)) or not(self.Hurt:IsPastRealMS(2000)) or self:GetController():IsState(Controller.BODY_JUMP) or self:GetController():IsState(Controller.MOVE_RIGHT) or self:GetController():IsState(Controller.MOVE_LEFT) then Visiblize() end end function Destroy(self) Visiblize() end Basically what this does is it shrinks the size of the actor down to nothing to make it invisible. The HUD thing above the actor will still be visible, so this might not be everything you were hoping for. |
Author: | PvtVain [ Sun Aug 29, 2010 8:28 am ] |
Post subject: | Re: Need someone who knows quite a bit of LUA |
CrazyMLC wrote: Instead of looking through the mod releases thread so tediously just use the Search function. It's on the red bar near the top of the forum site. viewtopic.php?f=61&t=14644&hilit=invisibility Quote: Stealth Chip This is a stealth module that allows your units to cloak when not excessively moving or shooting. Do note that hp damage will disable the cloak. Looking at the code for it I smashed together something. Code: function Visiblize() for i = 1,MovableMan:GetMOIDCount() do if MovableMan:GetMOFromID(i).RootID == self.ID then MovableMan:GetMOFromID(i).Scale = 1 end end end function Create(self) self.LastShot = Timer() self.Hurt = Timer() self.HP = self.Health end function Update(self) if self:GetController():IsState(Controller.BODY_CROUCH) then for i = 1,MovableMan:GetMOIDCount() do if MovableMan:GetMOFromID(i).RootID == self.ID then MovableMan:GetMOFromID(i).Scale = 0 end end end if self.HP ~= self.Health then self.Hurt:Reset() end self.HP = self.Health if self:GetController():IsState(Controller.WEAPON_FIRE) then self.LastShot:Reset() end if not(self.LastShot:IsPastRealMS(2000)) or not(self.Hurt:IsPastRealMS(2000)) or self:GetController():IsState(Controller.BODY_JUMP) or self:GetController():IsState(Controller.MOVE_RIGHT) or self:GetController():IsState(Controller.MOVE_LEFT) then Visiblize() end end function Destroy(self) Visiblize() end Basically what this does is it shrinks the size of the actor down to nothing to make it invisible. The HUD thing above the actor will still be visible, so this might not be everything you were hoping for. Actually that's what i've been hoping for but after then I need to work on my personal mods sprites :V |
Author: | Geti [ Sun Aug 29, 2010 8:37 am ] |
Post subject: | Re: Need someone who knows quite a bit of LUA |
all of the curteam stuff is just setting a team, what're you Code: function Create(self) self.shottimer = Timer(); self.attachables = {}; for i = 1, MovableMan:GetMOIDCount() - 1 do local mo = MovableMan:GetMOFromID(i) if mo.RootID == self.ID and i ~= self.ID then table.insert(self.attachables, ToAttachable(mo)); end end end function Update(self) for k,v in ipairs(self.attachables) do if not MovableMan:ValidMO(v) then table.remove(self.attachables,k); end end if self:GetController():IsState(Controller.BODY_CROUCH) and self.shottimer:IsPastSimMS(200) then self:setScale(0); end if self:GetController():IsState(Controller.WEAPON_FIRE) then self:setScale(1); self.shottimer:Reset() else if self:GetController():IsState(Controller.MOVE_LEFT) or self:GetController():IsState(Controller.MOVE_RIGHT) or self:GetController():IsState(Controller.BODY_JUMP) self.Health <= 10 then self:setScale(1); end end function setScale(self,size) self.Scale = size; for k,v in ipairs(self.attachables) do v.Scale = size; end end FFS should've posted this a million years ago <_< triple ninja'd or whatever. |
Author: | PvtVain [ Sun Aug 29, 2010 8:44 am ] |
Post subject: | Re: Need someone who knows quite a bit of LUA |
This is what the script did :V Also look at the file name :smug: The 200 health was edited in the character. |
Author: | CrazyMLC [ Sun Aug 29, 2010 8:51 am ] |
Post subject: | Re: Need someone who knows quite a bit of LUA |
Small issue with the last script, looking at Geti's reminded me of it. I've updated the last post's script, try it again please... or try Geti's. |
Author: | PvtVain [ Sun Aug 29, 2010 9:00 am ] |
Post subject: | Re: Need someone who knows quite a bit of LUA |
Ill try both and see which one I like :V Crazy, your script did the same thing as it did. before Geti's, script didn't work either :V |
Author: | mail2345 [ Sun Aug 29, 2010 9:11 am ] |
Post subject: | Re: Need someone who knows quite a bit of LUA |
Get rid of the jetpack, feet and hand sprites. Lua can't touch them. Maybe move the jetpack sprite to the body, the hand sprite to the arm and the feet to the leg. |
Author: | PvtVain [ Sun Aug 29, 2010 9:15 am ] |
Post subject: | Re: Need someone who knows quite a bit of LUA |
I would take the stealth script from the darkstorm But I don't know what to take and or edit :V But of course I will credit whoever I get a script from. |
Author: | 411570N3 [ Sun Aug 29, 2010 9:21 am ] |
Post subject: | Re: Need someone who knows quite a bit of LUA |
Darkstorm's Yuurei script works by switching the sprites of everything. |
Author: | Geti [ Sun Aug 29, 2010 9:33 am ] |
Post subject: | Re: Need someone who knows quite a bit of LUA |
411570N3 wrote: Darkstorm's Yuurei script works by switching the sprites of everything. Also yeah you can't do much about the jet & hands than remove it |
Author: | 411570N3 [ Sun Aug 29, 2010 10:10 am ] |
Post subject: | Re: Need someone who knows quite a bit of LUA |
Ah. I stand corrected. The rest of it is sprite changes though, to allow it to continue to be vulnerable. The scripts in this thread would leave the actor invulnerable to most things. |
Author: | Lizardheim [ Sun Aug 29, 2010 11:27 am ] |
Post subject: | Re: Need someone who knows quite a bit of LUA |
You could still have leg sprites and hand sprites integrated into their apropriate limbs. And jetpack on body sprite, or as an attachment. |
Author: | 411570N3 [ Sun Aug 29, 2010 12:38 pm ] |
Post subject: | Re: Need someone who knows quite a bit of LUA |
Yeah, you really don't lose anything from integrating them in this way, seeing as they are barely visually dynamic in a way that is important. |
Page 1 of 2 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |