Fade in Teleport

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
XIX IX VII XIII I
Posts: 41
Joined: Sat Nov 20, 2004 4:10 pm
Location: America

Fade in Teleport

Post by XIX IX VII XIII I »

Is it possible to teleport a thing with a fade in? When I write "Fade in," I mean something similar to the "Crossfade" effect in ZDoom when opening a map or similar to how the demons teleport in Doom64?

I have an area where spawning enemies in with fog is too obvious and spawning them in without fog is too abrupt.
User avatar
AgentSpork
Posts: 106
Joined: Fri Aug 22, 2003 7:38 pm

Post by AgentSpork »

Here's a script I wrote (with some assistance from Kaiser) for the exact effect you're looking for:

Code: Select all

script 120 (int thingID, int thingSpawn, int newTID) //Fade thing in from nothing (or spawn a monster and then fade it in)
{
	//Spawn a monster if thingSpawn > 0 (use T_<whatever> for thingSpawn argument)
	if(thingSpawn > 0)
	{
		Thing_SpawnFacing(thingID,thingSpawn,1,thingID);
	}

	int i = 0.1;
	int j = 0;
	ThingSound(thingID,"Respawn",127);
	Thing_Activate(thingID);
	SetActorProperty(thingID,APROP_RenderStyle,STYLE_Translucen);
	for(j = 1; j < 10; j++) //Fade the monster in
	{
		SetActorProperty(thingID,APROP_Alpha, i);
		i += 0.1;
		delay(2);
	} SetActorProperty(thingID,APROP_Alpha, 1.0);

	//Change thing TID?
	if(newTID > 0)
	{
	Thing_ChangeTID(thingID,newTID);
	}
}
You can use it to fade in an alreaedy existing monster, or use it in a similar fashion to Thing_SpawnFacing and spawn a monster and then fade it in.
XIX IX VII XIII I
Posts: 41
Joined: Sat Nov 20, 2004 4:10 pm
Location: America

Post by XIX IX VII XIII I »

Thanks AgentSpork. This is most appreciated.

However, I am not sure how to use it. Suppose I want an Imp spawned at a MapSpot (Tag 1) at coordinates 0,0. What would that look like? Or am I going about this wrong?
User avatar
AgentSpork
Posts: 106
Joined: Fri Aug 22, 2003 7:38 pm

Post by AgentSpork »

It's pretty simple, really. Say you wanted to spawn/fade in an imp at a map spot tagged 1, you'd just do ACS_Execute(120,0,1,T_IMP,0);. The thindID argument is for the thing tag of the map spot, the thingSpawn argument is used for spawning a monster, a list of which you can find here, and the newTID argument gives the spawned thing a new thing ID.

If you wanted to make things even simpler, you could create a function for that script like so:

Code: Select all

Function void Thing_FadeIn (int thingID, int thingSpawn, int newTID)
{
	ACS_ExecuteAlways(120,0,thingID,thingSpawn,newTID);
}
That way, instead of having to use ACS_Execute(120,whatever) every time, you'd just have to use the Thing_FadeIn function. It makes things easier to remember.
XIX IX VII XIII I
Posts: 41
Joined: Sat Nov 20, 2004 4:10 pm
Location: America

Post by XIX IX VII XIII I »

Thanks again AgentSpork.

I must not be doing this right. It fails to compile at line 13 -- specifically, at the "APROP_" lines. A search for "APROP" in the ZDoom wiki produces nothing.

BTW, I want to mention I respect the maps you have produced. Keep up the great work.
User avatar
Bio Hazard
Posts: 4019
Joined: Fri Aug 15, 2003 8:15 pm
Location: ferret ~/C/ZDL $
Contact:

Post by Bio Hazard »

AgentSpork wrote:That way, instead of having to use ACS_Execute(120,whatever) every time, you'd just have to use the Thing_FadeIn function. It makes things easier to remember.
Or you can just put

Code: Select all

#define Thing_FadeIn 120
somewhere and use

Code: Select all

ACS_Execute(Thing_FadeIn,0,1,T_IMP,0);
User avatar
Tormentor667
Posts: 13556
Joined: Wed Jul 16, 2003 3:52 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia (Modern GZDoom)
Location: Germany
Contact:

Post by Tormentor667 »

Wow,... this is a pretty impressive and clever trick :)
Locked

Return to “Editing (Archive)”