View unanswered posts | View active topics It is currently Mon Jun 17, 2024 7:17 pm



Reply to topic  [ 5 posts ] 
 Error: Attempt to index field 'parentgun' <Mystery Solved> 
Author Message
User avatar

Joined: Tue Apr 01, 2008 4:49 pm
Posts: 1972
Location: The Netherlands
Reply with quote
Post Error: Attempt to index field 'parentgun' <Mystery Solved>
Helloes,

A question,
I've used CaveCricket's awesome dual weapon mode templates to have my FN F2000 switch between normal bullets and grenades. It works like a charm, except...
The console prints an error over and over again that goes like this:
Attachment:
ScreenDump003.jpg

ERROR: UniTec.rte/Scripts/SwitcherMain.lua:65: attempt to index field 'parentgun' (a nil value)

I've stared at the SwitcherMain.lua file for hours and my eyes have turned into something mushy and leaked out of my sockets.
Does anyone know what is happening here?

The file:
Attachment:
SwitcherMain.txt


Any assistance would be greatly appreciated. :)


Last edited by Gotcha! on Sun Mar 07, 2010 8:53 pm, edited 1 time in total.



Sun Mar 07, 2010 8:05 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13143
Location: Here
Reply with quote
Post Re: Error: Attempt to index field 'parentgun' *head explodes*
Try replacing all "self.parentgun.PresetName" with "self.mainweaponname".


Sun Mar 07, 2010 8:08 pm
Profile
User avatar

Joined: Tue Apr 01, 2008 4:49 pm
Posts: 1972
Location: The Netherlands
Reply with quote
Post Re: Error: Attempt to index field 'parentgun' *head explodes*
Done, for the SwitcherAlt.lua file as well. The error is now:
ERROR: UniTec.rte/Scripts/SwitcherMain.lua:77: attempt to index field 'parentgun' (a nil value)
(77 instead of 65 :-? )


Sun Mar 07, 2010 8:16 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13143
Location: Here
Reply with quote
Post Re: Error: Attempt to index field 'parentgun' *head explodes*
Change that line to
Code:
   if MovableMan:IsActor(self.parentactor) and self.parentgun ~= nil and self.parentgun.ID ~= 255 and UInputMan:KeyPressed(26) and self.canswitch == true then


Sun Mar 07, 2010 8:21 pm
Profile
User avatar

Joined: Tue Apr 01, 2008 4:49 pm
Posts: 1972
Location: The Netherlands
Reply with quote
Post Re: Error: Attempt to index field 'parentgun' <Mystery Solved>
That did the trick! I owe you one. Or two. Thanks! :grin:


Sun Mar 07, 2010 8:52 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 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.051s | 15 Queries | GZIP : Off ]