Please help with this script -1 reply

Please wait...

Guest

I didn't make it!

0 XP

 
#1 10 years ago

I've been yanking my hair out for the better part of 2 weeks trying to figure this script out. I have had some excellent help from atrocious, but I still can't resolve the spawn issue. IE the script just keeps spawning and wont stop despite the fact that spawn_active = false. I am trying to spawn 9 military guys at the garage by modding the bind_stalker script as Atrocious has indicated this is the best way to do it. I've uninstalled/re-installed my game, updated to 1.0005 and OL2.2 and combed through hours of posts to no avail. Atrocious says it makes no sense that they should keep spawning. Can anyone out there figure this out. Here is my bind stalker script. The script is for the garage, so if anyone tests it, just overwrite the original file( back it up first) and load a save from the garage. The military guys will appear on a flat area close to where you first meet Serily. Also note that this is for OL2.2 I think i have pulled out all the hair from my head and i now look like the Mr.clean guy. Its tragic.




NatVac

of the ZRP

50 XP

10th August 2008

0 Uploads

124 Posts

0 Threads

#2 10 years ago

local spawn_active = true

This is inside the update function. The variable is always recreated (per the local qualifier, which limits the variable's scope* to the function) and initialized to true each time the update function is invoked. So the test is meaningless, and setting it to false does nothing, because the function then ends and the variable "goes out of scope".

Move the line above the function actor_binder:update(delta) line and try again. This gives it file scope so that it won't change while the update() function is not executing.

You will likely need to tweak it so that it is set to true when you want it to be true, otherwise it will only be true on level changes and reloads of previous saves, as the script file is reloaded each time.

_________ *This means that only the function itself can know about the variable. The variable is not accessible when the function is not executing. It is local to the function.




Guest

I didn't make it!

0 XP

 
#3 10 years ago

Hey, thanks for your help. It all seemed to make perfect sense, after I read your post 5 times(noob). So, full of hope I moved only "local_spawn active = true" above the function actor_binder:update(delta) line and aaah they kept spawning. So, i thought, what the hell, and moved the whole script above "actor_binder:update(delta)". And yes, they still kept spawning. Hmmm. I've attached my bind stalker script with the last mod mentioned....if it helps. Any suggestions? Thanks.




NatVac

of the ZRP

50 XP

10th August 2008

0 Uploads

124 Posts

0 Threads

#4 10 years ago

You did not move the line above the function actor_binder:update(delta) line (which is at line 263 in both files). You only moved it above the line:

if xrs_ai then xrs_ai.actor_update(delta) end

That was at line 419 in the original file. They are not the same thing.

Move* just the line I mentioned (in either version of the file; it won't make that much of a difference although I recommend using the original form) to the place I mentioned. When you are done, lines 263 and 264 in bind_stalker.script will look like this:

local spawn_active = true function actor_binder:update(delta) *There should be no local spawn_active = true assignment within the function when you are done. (The function starts with the keyword function and goes to the last end statement, the one that is flush with the left margin.)




Guest

I didn't make it!

0 XP

 
#5 10 years ago

OMG, i'm a blazing idiot. I finally got around to testing that yesterday. Yeehah, it works like a frickin charm. I got massive amounts of meat on most maps. It's a thing of beauty. Thanks a ton.