Spawn Runes Issue

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
blckfire
Apprentice Poster
Posts: 54
Joined: Thu Feb 26, 2015 10:28 am

Spawn Runes Issue

Post by blckfire »

The problem is as follows:

Instead of having Guards all over the place and being spawn 1 by 1 I decide to create an Item that controls guard's.

For this I create a Guard Spawn Rune.

The problem is, that now, I'm trying to make it possible for this runes to go inactive and active. When I set the runes Inactive the Guards get killed and that event is added to a deadnpcarray, which contains all the info necessary to spawn the guard in the exact same place every time.

This brought me a new problem, which is that if I do the cycle, inactive/active, one time it only spawns one guard. The second time I do this it spawn all the guards as it should.

I tried now to set some loops to make sure the guards are all spawned but this brought me to a place where I get a runaway script.

In this process I read and write the rune's variables while I have a control script that also reads and writes to this same variables. To activate and deactivate runes I'm not sending events to the control script. Would doing this through events solve the problem??
bodom
Former Developer
Posts: 140
Joined: Sat Feb 21, 2015 7:52 pm

Re: Spawn Runes Issue

Post by bodom »

I think it's impossible to give you an accurate answer without seeing the source.

Anyway, if you have two scripts read/writing the same CProps, you must use locking to avoid unexpected behaviour. Most rudimentary form of locking is "set_critical()".

Also, having one single script handling the props and signalling to it with events will avoid this problem.

I can't really tell if this will solve your single-spawn problem, since it could be anywhere else.
blckfire
Apprentice Poster
Posts: 54
Joined: Thu Feb 26, 2015 10:28 am

Re: Spawn Runes Issue

Post by blckfire »

Going to try and use events on this one.
Post Reply