Data Realms Fan Forums
http://868000.nnhp.asia/

Lua being applied to all guns?
http://868000.nnhp.asia/viewtopic.php?f=73&t=46256
Page 1 of 1

Author:  polartechie [ Sun Mar 18, 2018 8:35 pm ]
Post subject:  Lua being applied to all guns?

Hi there, I'm tryna fix the star wars mod, currently this script, "ReflectSaber.lua" is being loaded by all guns from a variety of actors, instead of only being loaded by the HDfirearm it is a ScriptFile for.

Help me Data Realms Kinobis, you're my only hope. I'm currently digging through tutorials hoping to piece together the right "IF lightsaber then do this script, otherwise just don't." T_T



If it helps, this is the lightsaber's device.ini:


Any assistance is greatly appreciated! I'm thoroughly vexxed.

Author:  Bad Boy [ Sun Mar 18, 2018 8:59 pm ]
Post subject:  Re: Lua being applied to all guns?

I'm not sure what the issue is exactly - a brief look doesn't suggest this script acts on every weapon with its code. The script should only act on the weapon you've attached it to with ini.
In terms of checking if this do that, you can just do something like - if device.PresetName:find("Lightsaber") then {do stuff here} end.

Author:  polartechie [ Sun Mar 18, 2018 9:23 pm ]
Post subject:  Re: Lua being applied to all guns?

Bad Boy wrote:
I'm not sure what the issue is exactly - a brief look doesn't suggest this script acts on every weapon with its code. The script should only act on the weapon you've attached it to with ini.
In terms of checking if this do that, you can just do something like - if device.PresetName:find("Lightsaber") then {do stuff here} end.



Thank you. I did "disable" the lua with an if statement (I tried --if actor:HasObject("Lightsaber") and that did disable the bug for all other guns, so it is the culprit, but why it's being applied everywhere is still a mystery.

I'll give that a try, thank you!

Author:  Bad Boy [ Sun Mar 18, 2018 11:24 pm ]
Post subject:  Re: Lua being applied to all guns?

Are you maybe running it as a global script or something? I don't think you can do that without some specific work though, so I'd guess no.

If you want to upload your rte I'm sure me or someone else can look through it and try to see what's wrong.

Author:  polartechie [ Mon Mar 19, 2018 8:16 pm ]
Post subject:  Re: Lua being applied to all guns?

Bad Boy wrote:
Are you maybe running it as a global script or something? I don't think you can do that without some specific work though, so I'd guess no.

If you want to upload your rte I'm sure me or someone else can look through it and try to see what's wrong.


Hi, this is the current state of the RTE, where ReflectSaber.lua is applied to all actors and guns on the galactic empire team in campaign mode.

Any help is greatly appreciated!

https://drive.google.com/open?id=1Dr5bf ... KlFcbd9Kuo

Author:  polartechie [ Mon Mar 19, 2018 8:42 pm ]
Post subject:  Re: Lua being applied to all guns?

Could it be this logic at the beginning?
function Create(self)

local actor = MovableMan:GetMOFromID(self.RootID);
if MovableMan:IsActor(actor) then
self.parent = ToActor(actor);
end

Author:  polartechie [ Mon Mar 19, 2018 10:59 pm ]
Post subject:  Re: Lua being applied to all guns?

It seems to happen most when a soldier is ordered with a lightsaber bearer.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/