Author |
Message |
adasx10
Joined: Tue Aug 21, 2007 6:50 pm Posts: 93 Location: Lithuania.
|
Need help on attachment + Lua.
Can an attachment increase "SharpLength" or change firing sound and when destroyed change back to normal, like a silencer or a scope.
|
Mon Feb 22, 2010 9:49 am |
|
|
Lizardheim
DRL Developer
Joined: Fri May 15, 2009 10:29 am Posts: 4107 Location: Russia
|
Re: Need help on attachment + Lua.
You could play a sound when the round is spawned through Lua i think.
|
Mon Feb 22, 2010 4:11 pm |
|
|
Azukki
Joined: Sat Nov 03, 2007 9:44 pm Posts: 1916 Location: Flint Hills
|
Re: Need help on attachment + Lua.
Pretty sure it'd be simplest for you to make a separate near-duplicate weapon with the alterations you want instead of messing with attachables. Tell a little more about the premise of the need of attaching suppressors or whatever?
|
Thu Feb 25, 2010 7:00 am |
|
|
adasx10
Joined: Tue Aug 21, 2007 6:50 pm Posts: 93 Location: Lithuania.
|
Re: Need help on attachment + Lua.
Azukki wrote: Pretty sure it'd be simplest for you to make a separate near-duplicate weapon with the alterations you want instead of messing with attachables. Tell a little more about the premise of the need of attaching suppressors or whatever? I need a sniper scope attachment that increase the "SharpLength" of a gun, and when destroyed change back. I really don't know how to explain it in detail.
|
Thu Feb 25, 2010 11:37 am |
|
|
Mind
Joined: Thu Mar 06, 2008 10:54 pm Posts: 1360 Location: USA
|
Re: Need help on attachment + Lua.
Cave would be good at this, but what you should do is make it so when the actor goes to like gold dig mode, it destroys gun w/o scope, and makes a copy of the current gun except with the gun and inverse when u do gold dig again.
Edit: Cuz unfortunately you can't actually change the sharplength value of a gun. D:
|
Thu Feb 25, 2010 11:29 pm |
|
|
Azukki
Joined: Sat Nov 03, 2007 9:44 pm Posts: 1916 Location: Flint Hills
|
Re: Need help on attachment + Lua.
Ohhh. You want your gun's scope to be able to break off, that's why you want an attachable. Now it seems really stupid that I didn't understand before. I thought you wanted to add the attachable during gameplay or something like that.
Anyways, you could make the scope an attachable, and then give the scope a custom break wound, and then an emission of that wound could activate a script that swaps out the gun for another version of the gun with no scope attached, and less sharp length.
Pretty sure that will work, but I'm certain it won't be easy.
You'll reload when your scope is shot off, unfortunately.
I can do the .ini for you but I can't do the Lua to replace the gun when it's in an actor's inventory.
If you don't mind if the scope can be shot off by shooting anywhere on the weapon, and the actor dropping the weapon when it breaks, then this can be done very easily in .ini modding.
|
Fri Feb 26, 2010 6:55 am |
|
|
411570N3
Joined: Wed Jan 07, 2009 10:26 am Posts: 4074 Location: That quaint little British colony down south
|
Re: Need help on attachment + Lua.
Could you make a script that checks if the correct object has gibbed nearby recently and automatically reload based on that? Since you only need it to automatically reload when freshly gibbed and on the ground, you could run the script directly on the gun.
|
Fri Feb 26, 2010 7:10 am |
|
|
Azukki
Joined: Sat Nov 03, 2007 9:44 pm Posts: 1916 Location: Flint Hills
|
Re: Need help on attachment + Lua.
Uhhh, that would be kind of complex, dunno how you would go about that exactly. Might be possible.
I know that if you did the Lua route I mentioned (which would likely be easier than the Lua you just suggested) of switching weapons in an actor's inventory, you could force him to reload afterward easily enough, and/or drop the weapon, if you want to do that. With that dual mode template out there, swapping an actor's weapons would mostly just be a case of applying that script from a third party object. (the emission particle with the script, as I said)
I might be able to do it but I might not bother trying.
|
Sat Feb 27, 2010 7:15 am |
|
|
|