Issues with using floor_move by value in an if statement

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Zombiedraken
Posts: 13
Joined: Thu May 31, 2018 7:21 pm

Issues with using floor_move by value in an if statement

Post by Zombiedraken »

Hi everyone, I am new to the forum and a huge fan of the game.

I'm currently working on a mod project for doom 2 using UDMF maps via geometry builder bug fix 64 bit. I am currently using version R3027.

Okay I figured out my scripting problem. I had the height for the raise function set to one. My thinking was the platform would continue moving until it got to the floor height of 120, I figured what height meant was that the platfom floor would move up 1 map unit at a time at a speed of 10 and not how many map units the floor was actually going to move. In the end I discovered that when using < and > on the height check, the switch would only move the platform one unit at a time as long as it was the only function running. If I used == on the height check it would only move 1 unit and since its no longer equal to -8 or 120 the code would do nothing.

Here is what I have now and it seems to work really well.

Code: Select all

SCRIPT 4 (void)
//Nukage Vat Access (Yellow Key) Raise
{

	if (GetSectorFloorZ(171, 0, 0)<104.0)
	{
		ChangeFloor (134, "dnsw06of");
		FloorandCeiling_RaiseByValue(171, 2, 112);
		Floor_RaiseByValue (170, 2, 112);
		tagwait (171);
	}

	else
	{
		ACS_Execute(5, 0, 0, 0, 0);
	}
}


script 5 (void)
//Nukage Vat Access (Yellow Key) Lower
{
	if (GetSectorFloorZ(171, 0, 0)>-8.0)
	{
		ChangeFloor(134, "dnsw06on");
		FloorandCeiling_LowerByValue(171, 2, 112);
		Floor_LowerByValue(170, 2, 112);
		tagwait(171);
	}

	else
	{
		ACS_Execute(4, 0, 0, 0, 0);
	}

}
Sorry for the spamming, this was unintentional. I'm working from my laptop now. My ipad wouldn't let me edit posts on here for some reason, the buttons in the upper right hand corner of each thread weren't appearing and couldn't be clicked.
Last edited by Zombiedraken on Sat Jun 02, 2018 3:35 pm, edited 3 times in total.
User avatar
gwHero
Posts: 360
Joined: Mon May 08, 2017 3:23 am
Graphics Processor: Intel with Vulkan/Metal Support
Location: The Netherlands

Re: Issues with using floor_move by value in an if statement

Post by gwHero »

Without being able to check your map itself, I think it's probably because of a common mistake: if you want to raise a 3d floor, you will have to raise the control sector of the 3d floor. So you will have to give the control sector an extra tag itself, and refer to that tag.

btw. there is also FloorAndCeiling_RaiseByValue to raise floor and ceiling simultaneously. Also there is https://zdoom.org/wiki/Sector_SetLink, which sometimes can become very useful to raise or lower connected sectors all at once. Don't know quite sure if you could this here, but just in case :)
Zombiedraken
Posts: 13
Joined: Thu May 31, 2018 7:21 pm

Re: Issues with using floor_move by value in an if statement

Post by Zombiedraken »

The sector tag 171 is a reference to the control sector for the 3D floor. I noticed that when I remove the portion that controls the 3D floor the floors with tag 170 (the regular sectors) also don't raise. I will try floor and ceiling raise and I will look into sector set link and see what happens.
Zombiedraken
Posts: 13
Joined: Thu May 31, 2018 7:21 pm

Re: Issues with using floor_move by value in an if statement

Post by Zombiedraken »

I will include a copy of my map once I get my hot spot data back which should be tomorrow. Check out my project thread for updates.
Zombiedraken
Posts: 13
Joined: Thu May 31, 2018 7:21 pm

Re: Issues with using floor_move by value in an if statement

Post by Zombiedraken »

I just noticed that GZDoom builder has an error that doesn't appear in game:

Mscorlib: collection was modified; enumeration operation may not execute.

No idea how to fix this or if this is even the problem but everything else I have tried isn't working.
Zombiedraken
Posts: 13
Joined: Thu May 31, 2018 7:21 pm

Re: Issues with using floor_move by value in an if statement

Post by Zombiedraken »

Okay I don't think that error has anything to do with it. I cleared it and it hasn't come back yet.

I did create a test map with which I could test my code.

I noticed that when I test the if statement, checking for floor height and raising the control sector, that it moves up a tiny bit and then stops, about 8 map units.
Zombiedraken
Posts: 13
Joined: Thu May 31, 2018 7:21 pm

Re: Issues with using floor_move by value in an if statement

Post by Zombiedraken »

Okay I figured it out. I had the height for the raise function set to one. My thinking was the platform would continue moving until it got to the floor height of 120, I figured what height meant was that the platfom floor would move up 1 map unit at a time at a speed of 10 and not how many map units the floor was actually going to move. In the end I discovered that when using < and > on the height check, the switch would only move the platform one unit at a time as long as it was the only function running. If I used == on the height check it would only move 1 unit and since its no longer equal to -8 or 120 the code would do nothing.
User avatar
ramon.dexter
Posts: 1562
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Issues with using floor_move by value in an if statement

Post by ramon.dexter »

Can you edit your posts, when you have more to say? You're literally spamming this thread.

Return to “Scripting”