make resurrected monsters solid

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
chaingunner_hell
Posts: 17
Joined: Fri May 24, 2019 4:33 am
Graphics Processor: Intel (Modern GZDoom)
Contact:

make resurrected monsters solid

Post by chaingunner_hell »

hi, i have been making a weapon that gives the player the possibility to resurrect monsters when they are dead (just like an archvile). and i was able to get this working.
but when i change the state label of the monster to the raise label, the player can pass through the player.

Code: Select all

action void A_resurrect(){
 ThinkerIterator ti = ThinkerIterator.Create("Actor");
			Actor a;
			while ( a = Actor(ti.Next()) )
			{
			
				if ( !IsVisible(a,false)
					|| (a is 'PlayerPawn')
					|| !a.bISMONSTER || (a.health > 0)
					|| (Distance3D(a) > 150));				
					else break;
			}
			
			if(a==null)return;
			a.bFRIENDLY=1;
			a.bSHOOTABLE=1;
			a.bSOLID=1;
			a.bCANPASS=1;
			a.bCANPUSHWALLS=1;
			a.bCOUNTKILL=1;
			a.bISMONSTER=1;
			a.bACTIVATEMCROSS=1;
			a.bCANUSEWALLS=1;
			a.health=a.spawnhealth();
			if((a is "Cyberdemon") || (a is "SpiderMasterMind") || (a is "Archvile"))a.A_Remove(AAPTR_DEFAULT);
			else a.setstatelabel("Raise");
			//A_LogInt(a.radius);

			
 }
So what does the monster is able to be not solid when it dies (and still have its solid flag set)
here is my mod
Attachments
archvile.pk3
(8.75 KiB) Downloaded 21 times
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: make resurrected monsters solid

Post by Graf Zahl »

It's because your code is incomplete and flat out wrong. You are not restoring everything that's needed and setting the flags to defaults that may not be appropriate. Better use the Actor.Revive function which sets everything to what is needed.
User avatar
chaingunner_hell
Posts: 17
Joined: Fri May 24, 2019 4:33 am
Graphics Processor: Intel (Modern GZDoom)
Contact:

Re: make resurrected monsters solid

Post by chaingunner_hell »

thanks, now i got it working. there was just a tiny problem that was the the height of the resurrected actor was 1/4 of the original (and that was obviously caused by DeathHeight default property)
and so this is what works for me

Code: Select all

a.Revive(); a.bFRIENDLY=1; a.height*=4; a.setstatelabel("Raise");
Post Reply

Return to “Scripting”