Page 1 of 1

Issues with using floor_move by value in an if statement

Posted: Thu May 31, 2018 7:48 pm
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.

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

Posted: Fri Jun 01, 2018 2:41 am
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 :)

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

Posted: Fri Jun 01, 2018 4:22 am
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.

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

Posted: Fri Jun 01, 2018 4:25 am
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.

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

Posted: Fri Jun 01, 2018 5:25 am
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.

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

Posted: Fri Jun 01, 2018 6:14 am
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.

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

Posted: Fri Jun 01, 2018 6:26 am
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.

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

Posted: Sat Jun 02, 2018 12:47 am
by ramon.dexter
Can you edit your posts, when you have more to say? You're literally spamming this thread.