ACS help

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Kinsie
Posts: 7402
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33
Contact:

ACS help

Post by Kinsie »

For some reason, this script doesn't seem to be properly taking effect.

Code: Select all

	if(Score[1] == 2000) {
		Teleport_NewMap (99, 0, 0); }
	Exit_Normal(0);
I want it to warp to a new map once the score reaches a certain amount (the == is just a placeholder), but it always goes to the Exit_Normal. Where'd I mess up?
User avatar
Isle
Posts: 687
Joined: Fri Nov 21, 2003 1:30 am
Location: Arizona, USA

Re: ACS help

Post by Isle »

well it looks ok but...
a) is there a map99? if there isn't teleport_newmap fails and the script hits exit_normal.
b) is the score hitting exactly 2000? if you want it 2000 and above use >=
c) are you checking the right array element? acs ones are 0 based.
User avatar
Kinsie
Posts: 7402
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33
Contact:

Re: ACS help

Post by Kinsie »

Isle wrote:well it looks ok but...
a) is there a map99? if there isn't teleport_newmap fails and the script hits exit_normal.
b) is the score hitting exactly 2000? if you want it 2000 and above use >=
c) are you checking the right array element? acs ones are 0 based.
a) I have a level with a levelnum in MAPINFO of 99.
b.) I know, I was just using that for testing.
c.) Fixed.
User avatar
Kinsie
Posts: 7402
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33
Contact:

Re: ACS help

Post by Kinsie »

Any more ideas? I'm still having trouble getting this working. :(
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: ACS help

Post by Matt »

Have you tried adding terminate; right after the teleport_newmap? The script might actually be running completely and moving on before you've exited the level..
User avatar
Nash
 
 
Posts: 17501
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: ACS help

Post by Nash »

Would adding an else before Exit_Normal() help?
User avatar
Risen
Posts: 5263
Joined: Thu Jan 08, 2004 1:02 pm
Location: N44°30' W073°05'

Re: ACS help

Post by Risen »

Swap your teleport and exit functions with prints, so you can see if it's your logic or something else that's failing.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: ACS help

Post by HotWax »

Let's try a different tack...

Code: Select all

	if(Score[1] == 2000) {
		Teleport_NewMap (99, 0, 0); }
	Exit_Normal(0);
I want it to warp to a new map once the score reaches a certain amount (the == is just a placeholder), but it always goes to the Exit_Normal. Where'd I mess up?
When are you calling this script? You do realize that anytime you call this, if the score is not exactly 2000, the Exit_Normal will take effect. So what triggers the script? A button press? Line crossing? Another script?

To me what your script looks like and what you describe as how it should work don't add up.

If you want the map to exit "once the score reaches a certain amount", this is the proper script:

Code: Select all

script 1 OPEN {
     if (Score[i] >= 2000) Teleport_NewMap(99, 0, 0);
     delay(35);
     restart;
}
User avatar
Kinsie
Posts: 7402
Joined: Fri Oct 22, 2004 9:22 am
Graphics Processor: nVidia with Vulkan support
Location: MAP33
Contact:

Re: ACS help

Post by Kinsie »

HotWax wrote:Let's try a different tack...
1.) The "exactly 2000" thing was temporary and has been changed!
2.) One of my scripts is a end-of-level score summary. At the end, it's supposed to check the score. If it's high enough, it goes to a SEEEKRET level. If not, it exits normally.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: ACS help

Post by HotWax »

Map please.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ACS help

Post by Graf Zahl »

... and yet again a lot of useless suggestions although the one that is correct has already been made:
Nash wrote:Would adding an else before Exit_Normal() help?

Exit triggers don't end the map! They just set an event that makes the map end itself the next tic. In this case the Exit_Normal overrides the other one because both are executed.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: ACS help

Post by HotWax »

Graf Zahl wrote:Exit triggers don't end the map! They just set an event that makes the map end itself the next tic. In this case the Exit_Normal overrides the other one because both are executed.
Hrm. That's very interesting information, and good to know for future reference.

Out of curiosity is there a benefit to doing it this way or is it just one of those things that's easier to handle this way? To me it would make more sense for the script to automatically halt itself after setting the exit flag, seeing as how ACS coders are most likely going to expect the level to exit the moment the command is encountered.

On the other hand, changing that now could break compatibility, so it's probably not wise to do it.

[edit]Added notes to [wiki]Exit_Normal[/wiki] and [wiki]Exit_Secret[/wiki]. Does this also apply to [wiki]Teleport_NewMap[/wiki] and [wiki]Teleport_EndGame[/wiki]?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: ACS help

Post by Graf Zahl »

This is necessary so that the level exit is properly synchronized. This applies to all methods that end a level, i.e. Exit_Normal, Exit_Secret, Teleport_NewMap, Teleport_EndGame and ChangeLevel.
And the EXIT_ commands are just line specials so adding different handling for them is not possible.
User avatar
Nash
 
 
Posts: 17501
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: ACS help

Post by Nash »

Graf Zahl wrote:... and yet again a lot of useless suggestions although the one that is correct has already been made
Kinsie didn't try my suggestion because I'm a nobody. ;( WAAH WAH

j/k
Locked

Return to “Editing (Archive)”