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

Need some script help

Recommended Posts

How would I make script that will constantly check and see if the acs_execute action was executed on a linedef? I made a while script but it executes the scripts without any actor actually executing it, here my script, if this is the right way, could someone tell me what I did wrong?

script 8 enter

{
while (true)
{
if (acs_execute (9, 0, 0, 0, 0))
{
setlinespecial (29, 0, 0, 0, 0, 0, 0);\\no action
}
else
{
setlinespecial (29, acs_execute (9, 0, 0, 0, 0));
}
delay (1);
}
}
I'm not even sure if this is the right way to do this.

Share this post


Link to post

Augh, formating. It's unreadable when everything is flushed to the left.

script 8 enter

{
	while (true)
	{
		if (acs_execute (9, 0, 0, 0, 0))
		{
			setlinespecial (29, 0, 0, 0, 0, 0, 0);\\no action
		}
		else
		{
			setlinespecial (29, acs_execute (9, 0, 0, 0, 0));
		}
		delay (1);
	}
}
There, better.

Okay, so this script looks absurd. What are you trying to do?

jdagenet said:

How would I make script that will constantly check and see if the acs_execute action was executed on a linedef? I made a while script but it executes the scripts without any actor actually executing it, here my script, if this is the right way, could someone tell me what I did wrong?

I'm not even sure if this is the right way to do this.

No, it's definitely not the right way. What your script is doing is running acs_execute every tic while (true). It doesn't need any actor to do that, since the script does it. Then it removes the line special from the line.

If I understand you, what you want to do is a script that removes the line special from the line once it has executed script 9? Right?

Then why don't you do this:

script 9 (void)
{
	SetLineSpecial (29, 0, 0, 0, 0, 0, 0);
	<insert rest of script 9 here>
}
Then get rid of script 8 entirely. Keep line tagged 29 to perform action 80 (ACS_Execute) so that it runs script 9. If the player activates the line, script 9 will be run. If you want to know if the line was activated so that you can do something special about it, do it in the script that is activated!

Okay so in Hexen format you will not be able to give your line the tag 29 directly so you'll need to use action 121:Line_SetIdentification on it, with 29 as the first argument. Then your line won't run a script. In that map format, you will need your script 8, but modified in this way:
script 8 enter

{
	SetLineSpecial (29, acs_execute, 9);
}
No need to loop, this needs only be done once.

Share this post


Link to post

Why remove the script execute special when the script is executed? Why not flag the linedef as a non-repeatable action?

Share this post


Link to post
Zom-B said:

Why remove the script execute special when the script is executed? Why not flag the linedef as a non-repeatable action?

I don't quite understand you but the reason is because I have to hallways, when the player runs down any hallway it will execute a script that will block off the path, this also applies for the other hall so that means if the were to execute the script again the map would be bugged and I needed to remove the acs_execute action on the linedef that the player did not cross, it's kinda hard to explain.

Share this post


Link to post

If it executes the same script just make a boolean variable like....

bool script11executed = false;

then just put in

script 11
{
if (script11executed == true) Terminate;
script11executed = true;
// Script actions from here down
}

Share this post


Link to post
Pottus said:

If it executes the same script just make a boolean variable like....

bool script11executed = false;

then just put in

script 11
{
if (script11executed == true) Terminate;
script11executed = true;
// Script actions from here down
}

Thanks I might use this also.

Share this post


Link to post
Pottus said:

No problem, I hope the idea helps you out.

It will I will probably do this more than once so I will use it :)

Share this post


Link to post
Pottus said:

If it executes the same script just make a boolean variable like....

bool script11executed = false;

then just put in

script 11
{
if (script11executed == true) Terminate;
script11executed = true;
// Script actions from here down
}

That applies even if the two hallways execute different scripts. Just make both scripts start with this code. You can make an arbitrary amount of hallways this way without adding repetitive code.

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
×