Author |
Message |
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Need to figure out specific part of script
Ok, I need help finding the part in the Red Detonater Lua script where it says you press fire to gib the Red C-4. Here's the script: Code: function Create(self) print("Red C-4 detonated!"); --Make sure the red C-4 list exists. if c4ListA ~= nil then --Go through the list of red C-4. for i=1,#c4ListA do --Make sure the C-4 still exists, it may have been destroyed. if MovableMan:IsParticle(c4ListA[i]) then --Detonate the C-4! c4ListA[i]:GibThis(); end end end --Empty/create the red C-4 list. c4ListA = { }; end Thanks in advance.
|
Sat May 16, 2009 12:37 am |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Need to figure out specific part of script
What's happening is that a weapon is firing. The "detonator" creates a particle with an attached script. That script, posted above, is run on the "create" event--when the particle is created. Thus, by firing the detonator, you create the particle, which runs the script, which detonates the C4. An actor specific alternative to this is the following: Code: if self:GetController():IsState(Controller.WEAPON_FIRE) then Again, that's actor specific; only works for one actor with a specific script attached.
|
Sat May 16, 2009 12:45 am |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Need to figure out specific part of script
Thanks, that would work. Would Sharp Aim be "WEAPON_SHARP" or "WEAPON_SHARP_AIM"?
|
Sat May 16, 2009 12:51 am |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Need to figure out specific part of script
|
Sat May 16, 2009 12:52 am |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Need to figure out specific part of script
Well, I just found out Lua is difficult to learn by just messing around... Anyways, if I was to implement your code into the red detonater script so it would replace the need for a particle, and detonate the C-4 with a push of the sharp aim button, what would that look like? This reminds me when I had trouble with simple ini modding as a noob. Now it's with Lua...
|
Sat May 16, 2009 1:17 am |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Need to figure out specific part of script
|
Sat May 16, 2009 1:41 am |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Need to figure out specific part of script
Can I attach the script to a Gun? Maybe that's what I'm doing wrong. Here's what I have:
Attachments:
RA-GL.zip [6.33 KiB]
Downloaded 239 times
|
Sat May 16, 2009 1:54 am |
|
|
Mind
Joined: Thu Mar 06, 2008 10:54 pm Posts: 1360 Location: USA
|
Re: Need to figure out specific part of script
You need to put this in the round code i think...: Code: ScriptPath = BlahBlah.rte/BlahBlah.lua
|
Sat May 16, 2009 1:57 am |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Need to figure out specific part of script
I have that. And it isn't commented out either.
|
Sat May 16, 2009 1:57 am |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Need to figure out specific part of script
CaveCricket48 wrote: Can I attach the script to a Gun? Maybe that's what I'm doing wrong. Here's what I have: That's the problem; for the code I posted it has to be attached to an actor. For a gun, you'd have to have it fire a unique particle and basically duplicate the detonators.
|
Sat May 16, 2009 2:00 am |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Need to figure out specific part of script
Drats. I can see that this is going to get really complicated. Is there a way to replace the sharp aim feature for a specific weapon to have an alt fire that creates the said particle?
|
Sat May 16, 2009 2:03 am |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Need to figure out specific part of script
I...don't think so.
I'm really not all that good with lua, but to my knowledge that's not possible.
|
Sat May 16, 2009 2:04 am |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Need to figure out specific part of script
I'll just make a special actor then. It suprises me that with all the hype about Lua being the magic scripting language that can do it all, it can't replace the sharp aim for a firing mode. Thanks for the help Grif. I can still have the gun design I want, but with only one actor. That's a pretty nice deal. Sort of.
|
Sat May 16, 2009 2:13 am |
|
|
|