Data Realms Fan Forums http://45.55.195.193/ |
|
Gib weapon after firing http://45.55.195.193/viewtopic.php?f=73&t=22709 |
Page 1 of 1 |
Author: | Thendash [ Sat Apr 16, 2011 7:23 am ] |
Post subject: | Gib weapon after firing |
I want to make a one-shot weapon that gibs itself after you fire it. After doing some searching and reading on lua scripting I've found that you can't attach lua scripts to weapons(while they're being held by an actor at least) so the workaround seems to be to make an emitter that emits invisible particles that have the script attached to them instead. So this is what I have so far: The gibself script: Code: function Update(self) self:GibThis(); end The emitter: Code: AddEffect = AEmitter PresetName = GibEmitter Mass = 0.001 PinStrength = 99999 LifeTime = 100 HitsMOs = 0 GetsHitByMOs = 0 RestThreshold = -500 OrientToVel = 1 SpriteFile = ContentFile FilePath = myMod.rte/Devices/Weapons/Sprites/Flashes/Null.bmp ScriptPath = myMod.rte/Scripts/GibSelf.lua FrameCount = 1 SpriteOffset = Vector X = 0 Y = 0 AngularVel = 0 AtomGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Air Resolution = 2 Depth = 0 DeepGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Air Resolution = 4 Depth = 10 DeepCheck = 0 I've attached that emitter to the weapon like so: Code: AddEmitter = AEmitter CopyOf = GibEmitter ParentOffset = Vector X = 0 Y = 0 But it doesn't work, the weapon doesn't gib at all let alone after use. I have a feeling it's because the lua script is just gibing the invisible particles instead. So how can I have the script gib the MO that its emitter is attached to? Thanks. |
Author: | TheLastBanana [ Sat Apr 16, 2011 8:39 am ] |
Post subject: | Re: Gib weapon after firing |
You're right - the invisible particles are gibbing themselves. Unfortunately, getting things like this to work is a little awkward at the moment. There's a script in Ronin.rte/Devices/Tools called "IgnoreParent" which has some code you can use. The script is attached to particles that exit the Ronin shovel, and they basically find the nearest actor holding a shovel and ignore it. You can use that same piece of code, but instead of ignoring the actor, just call shovel:GibThis(). It's kind of a sketchy way of doing it, but currently, it's the best we can do (at least that I can think of, feel free to correct me). |
Author: | Thendash [ Sun Apr 17, 2011 2:34 am ] |
Post subject: | Re: Gib weapon after firing |
After some experimenting, GibThis() doesn't seem to work at all. I tried making my own copy of the shovel script for my weapon and it didn't work so I changed the Ronin shovel script itself and it didn't gib the shovel. Is there a limit of some sort on what I can gib and when? |
Author: | TheLastBanana [ Sun Apr 17, 2011 3:59 am ] |
Post subject: | Re: Gib weapon after firing |
Post up your code - no offence, but it's possible that you did something wrong. Also, make sure to check the in-game console for errors. |
Author: | Thendash [ Sun Apr 17, 2011 4:51 am ] |
Post subject: | Re: Gib weapon after firing |
I fixed it, you're right I did something wrong but I figured that anyways. I put weapon.GibThis(); instead of weapon:GibThis(); I'm to used to java syntax it seems. ![]() Thank you for your help! |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |