View unanswered posts | View active topics It is currently Sat Dec 15, 2018 5:32 pm



Reply to topic  [ 7 posts ] 
 Lua being applied to all guns? 
Author Message

Joined: Tue May 06, 2014 9:11 pm
Posts: 16
Reply with quote
Post 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.


Sun Mar 18, 2018 8:35 pm
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 657
Location: Halifax, Canada
Reply with quote
Post 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.


Sun Mar 18, 2018 8:59 pm
Profile

Joined: Tue May 06, 2014 9:11 pm
Posts: 16
Reply with quote
Post 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!


Sun Mar 18, 2018 9:23 pm
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 657
Location: Halifax, Canada
Reply with quote
Post 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.


Sun Mar 18, 2018 11:24 pm
Profile

Joined: Tue May 06, 2014 9:11 pm
Posts: 16
Reply with quote
Post 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


Mon Mar 19, 2018 8:16 pm
Profile

Joined: Tue May 06, 2014 9:11 pm
Posts: 16
Reply with quote
Post 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


Mon Mar 19, 2018 8:42 pm
Profile

Joined: Tue May 06, 2014 9:11 pm
Posts: 16
Reply with quote
Post Re: Lua being applied to all guns?
It seems to happen most when a soldier is ordered with a lightsaber bearer.


Mon Mar 19, 2018 10:59 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.058s | 17 Queries | GZIP : Off ]