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

Problem with ACS Script

Recommended Posts

Hello guys, I made some very simple code that I made works perfectly in a part of the map. But when copying and modifying it to apply in other parts of the map it doesn't work.

 

1544359933_Semttulo.png.d2ffd56b17d44f0aee6e3bd0220ae4c2.png

 

 

 Also correctly assigned things to get the code to run.

Capturar2.PNG.1d345079cff92cc6c3ed67c3df0b399f.PNG

 


Tried two variations of the same code but the same error persists.

 

Capturar.PNG.57c89765ed2b1d9a50f458ab9f182ac8.PNG

 

 


I plan to learn more about ACS Script after I finish my first map (this one) so I can solve these simple things and more with greater ease. Where is the error?

 

Share this post


Link to post

Well the obvious thing that sticks out is you didn't compile your script file, because if you tried that an error would be produced. That error specifically is you are missing an opening bracket { at the start of script 3.

Share this post


Link to post
18 minutes ago, Edward850 said:

Well the obvious thing that sticks out is you didn't compile your script file, because if you tried that an error would be produced. That error specifically is you are missing an opening bracket { at the start of script 3.

Sorry, but I just don't understand why it doesn't want to compile. Since script 3 is practically identical to 2, and the latter works perfectly. 

note: I had forgotten that it is possible to write these scripts in UDB and I did it directly in SLADE3 haha

Share this post


Link to post
2 minutes ago, Rifleman said:

Notice the yellow circles - you're missing a bracket in one of them.

image.png.6f22cb75b5fe8ffba0d8ae895e0074f7.png

The square bracket is there but has been hidden by the red band.

Share this post


Link to post

Could it be the formatting then? I can't try myself now, but what if you fix it, so it looks like script 2?

Share this post


Link to post
1 hour ago, Rifleman said:

Could it be the formatting then? I can't try myself now, but what if you fix it, so it looks like script 2?

Yes, it is the same as script 2. I tried another way using a counter, as it didn't work I went back with the old script that is identical to 2. By @Edward850 tip I remembered to compile in UBD, and then it worked. But it's not compiling on final version (pk3). 

That is, now script 3 compiles, but only inside the UDB.

note: it works only after being compiled once.

Edited by K_Doom : edit

Share this post


Link to post
19 hours ago, Edward850 said:

Well the obvious thing that sticks out is you didn't compile your script file, because if you tried that an error would be produced. That error specifically is you are missing an opening bracket { at the start of script 3.

It compiles perfectly, but doesn't work at play time.

Share this post


Link to post

A couple of things:

  • Using Action 80 Script Execute will not run a script that is already running. So if you kill multiple enemies at once, they won't all add to the killcount. This can be fixed by using Action 226 Script Execute Always instead.
  • Your script checks whether the killcount is exactly 33, which means that if multiple enemies die at the same time, it will pass that mark without executing. The simplest way to get around this is to change the operator to greater or equal than (≥, or >=). However, this will make the floor lowering part run multiple times, for any monster that dies. There's a few ways around this, but my suggestion is have a separate script that checks the killcount while the other only adds to it. Something like this:
int killCount = 0;

script 3 (void)
{
	killCount++;
}

script 4 ENTER
{
	while(TRUE)
	{
		if(killcount >= 33)
		{
			Floor_LowerToLowest(178,32);
			Terminate;
		}
		Delay(5);
	}
}

If you don't want script 4 to be running from the start of the map (because it doesn't really have to be), you can make it execute somewhere before the intended encounter.

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
×