Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Russell_P

Reusing Scripts

Recommended Posts

A ZDoom level I'm currently designing has a number of adjoining sectors, each of which undergoes a series of height changes when the player enters each respective sector. These height changes are made via scripting activated by a 'Sector Action' thing (Actor Enters Sector).

Initially I set up a single 'generic' script and used the 'Sector Action' thing to pass that script values (tag, movement speed, etc). My problem occurs when the player enters a sector (and thus starts the script) and then leaves that sector and enters a second script activating sector. Because the script is still being executed on the first sector, it fails to have any effect on the second or sebsequent sectors until the script has finished running on the first.

So my question is, ....is there anyway to activate mulitiple instances of a script so that each sector can use the same script immediately, reguardless of how many other sectors are using the same script?

At the moment the only way I can achieve the effect I want is to have a SEPERATE script for each sector. This is both long winded, inefficient and messy.

Any suggestions? :)

Share this post


Link to post

You could have it increment/reset a variable which directs it to cycle through three different scripts, that way by the time it gets back around to using the first, it might be available again.

Share this post


Link to post

Use ACS_ExecuteAlways instead of ACS_Execute to run the script. This will allow multiple instances of the same script to be run - the solution to your problem.

Share this post


Link to post
Ultraviolet said:

You could have it increment/reset a variable which directs it to cycle through three different scripts, that way by the time it gets back around to using the first, it might be available again.


Yeah I thought about doing something like that but it'd still be a bit messy.

Csabo said:

Use ACS_ExecuteAlways instead of ACS_Execute to run the script. This will allow multiple instances of the same script to be run - the solution to your problem.


Perfect! Thanks. I should probably know about ACS_ExecuteAlways, but I'm a bit of a newbie to ZDoom scripting. I'll go try it now :)

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×