Jump to content

Spawn things indefinitely [solved]


K_Doom

Recommended Posts

My question is exactly like the title. I want to know if it's possible, and if so, what ways to make an object (health bonus in this case) reappear infinitely at the same location on the map when first picked up. I thought of some code maybe involving "while True", but I didn't know how to develop it, or maybe make the items dragged by conveyor, so I would have a linedef that would teleport them to the location of the previous collected item, but the objects are not affected by the floor defined as conveyor.. I'm making the map in UDMF format.

Does anyone have any suggestions?

Edited by K_Doom
[solved]

Share this post


Link to post

Here is some sample ACS that will try to spawn a health bonus (and teleport fog for good measure) at a given mapspot every two seconds. If there is already a healthbonus there, it will not spawn another until it is taken. Take a look:

 

#include "zcommon.acs"

script ____ OPEN //you should name or number the script yourself
{
	while (ThingCount(T_NONE, <Perpetual Healthbonus ID>))
	{
		Delay(70);
	}
	SpawnSpotForced("TeleportFog", <Mapspot ID>, 0, 0);
	SpawnSpotForced("HealthBonus", <Mapspot ID>, <Perpetual Healthbonus ID>, 0);
	Delay(70);
	Restart;
}

 

To see this idea in action, here is a map making use of the same script for a health bonus and an armor bonus, with the armor bonus on a longer delay: scripting_example.zip

 

Hope this helps.

Share this post


Link to post
On 10/27/2022 at 6:38 AM, SMG_Man said:

Here is some sample ACS that will try to spawn a health bonus (and teleport fog for good measure) at a given mapspot every two seconds. If there is already a healthbonus there, it will not spawn another until it is taken. Take a look:

 


#include "zcommon.acs"

script ____ OPEN //you should name or number the script yourself
{
	while (ThingCount(T_NONE, <Perpetual Healthbonus ID>))
	{
		Delay(70);
	}
	SpawnSpotForced("TeleportFog", <Mapspot ID>, 0, 0);
	SpawnSpotForced("HealthBonus", <Mapspot ID>, <Perpetual Healthbonus ID>, 0);
	Delay(70);
	Restart;
}

 

To see this idea in action, here is a map making use of the same script for a health bonus and an armor bonus, with the armor bonus on a longer delay: scripting_example.zip

 

Hope this helps.

Thank you very much, it worked perfectly.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...