ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
LUA questions

Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  22:50:06  23 July 2016
profilee-mailreply Message URLTo the Top
LoNer1
Настоящий Cталкер, Русская Версия
(Resident)

 

 
On forum: 10/23/2009
 

Message edited by:
LoNer1
07/23/2016 22:50:38
Messages: 1890
LUA questions

Hello forum.

I am trying to implement a "real bolt" mod in my compilation, but it results in the infamous "attempt to index field 'actor' (a nil)" error.


FATAL ERROR
 
[error]Expression    : fatal error
[error]Function      : CScriptEngine::lua_error
[error]File          : E:\stalker\sources\trunk\xr_3da\xrGame\script_engine.cpp
[error]Line          : 73
[error]Description   : <no expression>
[error]Arguments     : LUA error: ...dow of chernobyl\gamedata\scripts\bolt_binder.script:43: attempt to index field 'actor' (a nil value)
 
stack trace:



Using the following it crashes:


function BBolt:net_spawn(data)
	if spawn_time<time_global() 
		and self.object:position():distance_to(db.actor:position())<2.5 
			then spawn_time=time_global()+50 table.insert( bolt_mod.new_bolt_id, self.object:id() ) 
			
			else 
			
			self.object:bind_object(nil) 
		end
	return object_binder.net_spawn(self, data)
end



Here is the paste of the file: http://pastebin.com/7HLRa86T

I don't know what I did wrong.

Cheers
  23:45:28  23 July 2016
profilee-mailreply Message URLTo the Top
TKGP
Senior Resident
 

 
On forum: 01/25/2013
Messages: 454
Most likely: you hooked something in here that locked the script.
http://puu.sh/qbYwL/bf5b186eb8.png
  19:51:51  24 July 2016
profilee-mailreply Message URLTo the Top
LoNer1
Настоящий Cталкер, Русская Версия
(Resident)

 

 
On forum: 10/23/2009
 

Message edited by:
LoNer1
07/24/2016 19:52:43
Messages: 1890

---QUOTATION---
Most likely: you hooked something in here that locked the script.
http://puu.sh/qbYwL/bf5b186eb8.png
---END QUOTATION---



Yes, under both actor_binder:net_spawn as actor_binder:net_destroy I hooked the bolt_binder script to call for the following functions:


bind_stalker.script:

Under actor_binder:net_spawn:

	bolt_mod.net_spawn()

Under actor_binder:net_destroy:

	bolt_mod.net_destroy()


I am guessing the expression

     self.object:position():distance_to(db.actor:position())<2.5



In net_spawn is wrong, but I am trying to figure out what. Friend said it's the position, quoting


---QUOTATION---
If im reading this correctly then whenever something is over 2.5 units (Im assuming meters) from the actor, then it tries to do the second part of the expression (the else statement), which means nil is trying to get bound to something
Which isnt possible
---END QUOTATION---



But trying it with advice:

try editing self.object:position:distance_to(db.actor:position())>0.0
that should make only the fallback expression happen whenever the spawned bolt is in the negative distances (which isnt possible)



Results in the same ctd.
  20:35:19  24 July 2016
profilee-mailreply Message URLTo the Top
TKGP
Senior Resident
 

 
On forum: 01/25/2013
Messages: 454
There is nothing wrong with that line. At the risk of being rude, your friend doesn't appear to have actually read the error log.

A. That code is running before the actor is registered or after it's unregistered. This is very unlikely.
B. The actor isn't being registered because bind_stalker or something it calls out to is doing something silly that locks it up or stack traces out before it gets to db.add_actor. This is very likely.

Now is the time to read through anything you've added before that point to find where it's failing and/or cram a bunch of logs in to narrow it down first.
  03:09:07  25 July 2016
profilee-mailreply Message URLTo the Top
Alundaio
Sad Clown
(Resident)

 

 
On forum: 04/05/2010
 

Message edited by:
Alundaio
07/25/2016 3:10:41
Messages: 2230
I'm a bit confused. Your crash references bolt_binder.script and in your actor binder you are referencing bolt_mod.script. But in your comment you say "I hooked the bolt_binder script" in actor binder.

pastebin bolt_mod.script, too
  20:27:53  26 July 2016
profilee-mailreply Message URLTo the Top
LoNer1
Настоящий Cталкер, Русская Версия
(Resident)

 

 
On forum: 10/23/2009
Messages: 1890
http://pastebin.com/qXc1cLxs

Trying to adapt it for 1.0006 since it's originally written for 1.0004 if that makes any difference at all.
 
Each word should be at least 3 characters long.
Search:    
Search conditions:    - spaces as AND    - spaces as OR   
 
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
 

All short dates are in Month-Day-Year format.


 

Copyright © 1995-2019 GSC Game World. All rights reserved.
This site is best viewed in Internet Explorer 4.xx and up and Javascript enabled. Webmaster.
Opera Software products are not supported.
If any problem concerning the site functioning under Opera Software appears apply
to Opera Software technical support service.