HidDest addon issue, multiple things not working

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!)
Post Reply
User avatar
Silentdarkness12
Posts: 1555
Joined: Thu Aug 15, 2013 5:34 pm
Location: Plains of Pride

HidDest addon issue, multiple things not working

Post by Silentdarkness12 »

I've been continuing to work away at an addon for Hideous Destructor adding in the Unmaker, and I finally got it to the testing phase, but it absolutely doesn't work at all, and I can't figure out why. I understand the basic reason why, but not exactly why and how to fix it. File included in mediafire link.

The problems are this:

An enum with weaponstatus is used to determine the weapon's ammo, ENUMS_UMKR_LIQUIDFRAG and ENUMS_UMKR_CRYSTALFRAG. However, it seems to be failing to work properly. The ammo bar for liquidfrag renders, but any firing function seems to not work.

There is supposed to be a function that causes liquid frag to solidify into a solid crystal. That function does not seem to work at all.

The weapon sprite does not set properly when raised or lowered. I have reason to believe it's because of the enums not setting up properly somehow.

The game spits up a VM abort when I try to unload the unmaker.





https://www.mediafire.com/file/hmpnw291 ... r.pk3/file
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: HidDest addon issue, multiple things not working

Post by Matt »

I think this might've been resolved on the Discord, but as some general pointers:

The flags are not set up right. XXXF_XXXX are bitflags and must therefore be powers of 2, and generally they are all stored in weaponstatus[0] not in separate slots. I think PB or Tartl or someone else explained the bitflag thing already, and for reference again here's my little "cheat sheet" that I still have to refer to sometimes:

Code: Select all

FLAGS
|=  set
&=~  unset
^=  toggle
&=~(1|2)  unset 1 and 2
|=(1|2)  set 1 and 2
The way you've got it set up now, ENUMF_MODE_UNMAKER status is stored in the same slot as ENUMS_UMKR_CRYSTALFRAG, which means that each time UnmakerModeToggle() is called your crystal frag storage is set to 1 or 0.

I have no idea how that VM error happens.

You might want to go through your stuff to keep your tabs consistent. It would make the logical progression of the code a lot easier to debug just by looking at it.
User avatar
Silentdarkness12
Posts: 1555
Joined: Thu Aug 15, 2013 5:34 pm
Location: Plains of Pride

Re: HidDest addon issue, multiple things not working

Post by Silentdarkness12 »

Thanks, Matt. That improved a few things. Getting closer to making it function.

I've noticed that all of the sounds for the Unmaker are consistently playing at random speeds, next. I don't understand why that is.
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: HidDest addon issue, multiple things not working

Post by Matt »

Double-check the parameters in A_PlaySound versus your own code, you might be specifying speed when you wanted to specify something else.
User avatar
Silentdarkness12
Posts: 1555
Joined: Thu Aug 15, 2013 5:34 pm
Location: Plains of Pride

Re: HidDest addon issue, multiple things not working

Post by Silentdarkness12 »

Yeah alright, somehow I got really fantastically stupid and put an frandom on the pitch.

The next problem i'm running into is that unloading and reloading the Unmaker's chamber is causing a Very Fatal Error, and I can't quite work out why this is happening.

Code: Select all

	unload:
			"####" A 1 {
				if(!invoker.weaponstatus[ENUMS_UMKR_CHAMBERLOADED])
					{
					SetWeaponState("nope");
					}
			}
			"####" AAAA 4 Offset(0,-10);
			"####" A 0 A_PlaySound("Weapons/Unmaker/Squish",CHAN_WEAPON,1.0);
			"####" A 1 offset(0,-33);
			"####" A 1 offset(0,-34);
			"####" A 1 offset(0,-37);
			"####" A 2 offset(0,-39);
			"####" A 0 A_PlaySound("Weapons/Unmaker/Squish",CHAN_WEAPON,1.0);
			"####" A 4;
			"####" A 0 A_PlaySound("Weapons/Boltfwd",CHAN_WEAPON,1.0);
			"####" A 2;
			"####" A 0 A_PlaySound("Weapons/libchamber2a",CHAN_WEAPON,1.0);
	unloadmag:
			"####" A 10{
				if(invoker.weaponstatus[ENUMS_UMKR_CHAMBERLOADED]==0)
				{
				SetWeaponState("nope");
				}
			}
			"####" A 0 A_Log("DumpLiquidFragTime");
			"####" A 0 DumpLiquidFrag();
			"####" A 8;
			"####" A 0 {
			if(invoker.weaponstatus[ENUMS_UMKR_CHAMBERLOADED]==0)
				{
				SetWeaponState("nope");
				}
				int inmag = invoker.weaponstatus[ENUMS_UMKR_CRYSTALFRAG]/200;
				invoker.weaponstatus[ENUMS_UMKR_CHAMBERLOADED] = 0;
				if(
				!PressingUnload()&&!PressingReload()
			){
			A_Log("UnloadCheck2");
				A_JumpIfInventory("HDFragChamber",0,"null");
				HDMagAmmo.SpawnMag(self,"HDFragChamber",inmag);
				A_SetTics(1);
				A_Log("UnloadCheck3");
			}else{
				HDMagAmmo.GiveMag(self,"HDFragChamber",inmag);
				A_PlaySound("weapons/pocket",CHAN_WEAPON);
			}
		}
	magout:
		"####" A 0{
		A_Log("Magout");
			if(
				!countinv("HDFragChamber")
			)setweaponstate("reloadend");
		} //fallthrough to loadmag
	loadmag:
		"####" A 12{
		A_Log("Loadmag");
			let zmag=HDFragChamber(findinventory("HDFragChamber"));
			if(!zmag){setweaponstate("reloadend");return;}
			A_PlaySound("weapons/pocket",CHAN_WEAPON);
				A_SetTics(10);
			}
		"####" A 8 A_Playsound("Weapons/libchamber2a",CHAN_WEAPON,1.0);
		"####" A 2;
		"####" A 0 A_PlaySound("Weapons/boltfwd",CHAN_WEAPON,1.0);
		"####" A 4;
		"####" A 0 A_PlaySound("Weapons/Unmaker/Squish",CHAN_WEAPON,1.0);
		"####" A 2 offset(0,39);
		"####" A 1 offset(0,37);
		"####" A 1 offset(0,34);
		"####" A 1 offset(0,33);
		"####" A 0 A_PlaySound("Weapons/Unmaker/Squish",CHAN_WEAPON,1.0);
		"####" A 0 {
				let zmag=HDFragChamber(findinventory("HDFragChamber"));
				if(!zmag){setweaponstate("reloadend");return;}
				invoker.weaponstatus[ENUMS_UMKR_CRYSTALFRAG]=zmag.TakeMag(true) * 200;
		}
		"####" AAAA 4 Offset(0,10);
		"####" A 0 A_Log("TimeToReloadend");
		"####" A 4 A_WeaponBusy();
		"####" A 0 SetWeaponState("reloadend");
		reloadend:
		"####" A 0 SetWeaponState("nope");
Post Reply

Return to “Scripting”