View unanswered posts | View active topics It is currently Thu Dec 26, 2024 4:15 am



Reply to topic  [ 9 posts ] 
 Eye lasers 
Author Message
User avatar

Joined: Sat Nov 10, 2012 3:31 pm
Posts: 114
Location: Australia
Reply with quote
Post Eye lasers
I wish to use eye lasers for an ahuman (the head is where the gun is. I can't seem to attach the arms to the head), but I don't want it to be a continuous laser. I'm using an old laser script posted ages ago, as such:

What would I add to this to space out the shots more? And, as an aside, how would I go about making this spawn MOSParticles rather than AEmitters?
Sorry if this question is easily answered, I am not good with LUA. :(


Fri Nov 01, 2013 9:30 am
Profile WWW

Joined: Fri Nov 23, 2012 5:42 am
Posts: 143
Reply with quote
Post Re: Eye lasers
I'm not sure what you mean by space the shots out more? The script seems to fire one TA Laser every time you press the fire button. To make it fire MOSParticles, just change this line:

Code:
 local Emitter = CreateAEmitter("TA Laser", "Terran Alliance.rte")


to this:

Code:
 local Emitter = CreateMOSParticle("TA Laser", "Terran Alliance.rte")


You can also change the local Emitter to local MOSParticle (or whatever you want), but make sure to change the other places where Emitter is used as well.


Fri Nov 01, 2013 4:01 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Wed Sep 05, 2007 4:14 am
Posts: 3966
Location: Canadida
Reply with quote
Post Re: Eye lasers
Code:
local \Var\ = \etc\

Simply defines a local variable with the name \var\.


Sat Nov 02, 2013 8:14 pm
Profile
User avatar

Joined: Sat Nov 10, 2012 3:31 pm
Posts: 114
Location: Australia
Reply with quote
Post Re: Eye lasers
It doesn't fire a single shot, it fires a steady stream as long as the button is pressed. I want to add a small space between the shots.

And thank you, I'll get to changing it to mosparticle.


Sun Nov 03, 2013 2:16 am
Profile WWW

Joined: Fri Nov 23, 2012 5:42 am
Posts: 143
Reply with quote
Post Re: Eye lasers


This code should work to add a delay to the shots, you'll just need to adjust the time to whatever you want.


Sun Nov 03, 2013 3:49 am
Profile
User avatar

Joined: Sat Nov 10, 2012 3:31 pm
Posts: 114
Location: Australia
Reply with quote
Post Re: Eye lasers
Alright, that works perfectly! Thank you.
My next question is, how would I go about having certain parts of that script active when the actor is holding a certain weapon? Set out probably like this:
Code:
   if self:GetController():IsState(Controller.WEAPON_FIRE) and self.Head:IsAttached() and (Detect specific gun?) then
            (do that specific laser firing)
      end
      if self:GetController():IsState(Controller.WEAPON_FIRE) and self.Head:IsAttached() and (Detect another specific gun?) then
            (do another specific laser firing)
      end
      if self.Head:IsAttached() and (Neither of those guns?) then
            (Drop whatever is being held)
      end
   end


Is this possible?


Sun Nov 03, 2013 2:03 pm
Profile WWW

Joined: Fri Nov 23, 2012 5:42 am
Posts: 143
Reply with quote
Post Re: Eye lasers
Yup, self.EquippedItem.PresetName("GunNameHere") is what you want to use in the if statements. For the last one you can do

Code:
if self.Head:IsAttached() and not self.EquippedItem.PresetName("GunNameHere1") and not self.EquippedItem.PresetName("GunNameHere2") then
    self:GetController():SetState(Controller.WEAPON_DROP,true)
end


Again, untested code written from memory in 3 minutes, so don't sue me if it doesn't work :P.


Sun Nov 03, 2013 3:53 pm
Profile
User avatar

Joined: Sat Nov 10, 2012 3:31 pm
Posts: 114
Location: Australia
Reply with quote
Post Re: Eye lasers
I had to remove the brackets for it to detect the guns for the different laser types like so:
Code:
if self:GetController():IsState(Controller.WEAPON_FIRE) and self.Head:IsAttached() and self.EquippedItem.PresetName == "Pulse Laser Module" then


But the dropping part didn't work. The actor can still pick up things with reckless abandon, with no errors in sight.


Mon Nov 04, 2013 6:29 am
Profile WWW

Joined: Fri Nov 23, 2012 5:42 am
Posts: 143
Reply with quote
Post Re: Eye lasers
Oops, I completely forgot about this thread, sorry about that! :oops:

Anyway, glad that you managed to correct my bad code for the equipped weapon name thingy. On the weapon drop part: You could try dropping in a print after the if statement, just to check that the code is actually getting to the weapon drop part. Also, that code, if it was working, would just tell the actor to drop what ever he's holding, it doesn't stop the actor from immediatedly picking the weapon up again, that would require a bit more code.

Let me know if you still need help, or already managed to figure it out yourself.


Tue Dec 03, 2013 2:25 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 9 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.036s | 15 Queries | GZIP : Off ]