Loop Linedef Effect?
Loop Linedef Effect?
Hey all,
I was wondering if there is a way to make the effect of a line loop, rather than happen only once.
For example, let's say I have a line that triggers a spawn at a mapspot. This happens once, then it can't happen again.
I'd like to make it so that within a given time, the line can be reactivated, or say, "re-triggered." How does one go about doing this?
			
									
									
						I was wondering if there is a way to make the effect of a line loop, rather than happen only once.
For example, let's say I have a line that triggers a spawn at a mapspot. This happens once, then it can't happen again.
I'd like to make it so that within a given time, the line can be reactivated, or say, "re-triggered." How does one go about doing this?
- mr fiat
 - Frequent Poster Miles card holder
 - Posts: 858
 - Joined: Tue Jun 05, 2012 3:28 pm
 - Location: netherlands
 
RE: Loop Linedef Effect?
there should a "repeatable" flag if you map in zdoom(doom in hexen format) or zdoom(doom in doom format) otherwise if you are vanilla mapping you should use a effect that has either SR WR DR or GR prefix.
unless im missing something here.
			
									
									
						unless im missing something here.
- ZZYZX
 - Posts a lot
 - Posts: 742
 - Joined: Thu Jun 07, 2012 5:56 pm
 - Location: Ukraine
 - Clan: A3
 - Clan Tag: [A3]
 
RE: Loop Linedef Effect?
I think what he wants to do is AUTOMATICALLY repeat some effect on line.
OP: http://zdoom.org/wiki/ACS
			
									
									OP: http://zdoom.org/wiki/ACS
quality DoomExplorer hackeringFilystyn wrote:Do you know what windows.h is? It's D, DWORD.
overcomplicated ZDoom grenade
random Doom things
GZDoomBuilder-Bugfix
RE: Loop Linedef Effect?
Okay so I did some reading on ACS, I had never used it before, sorry for being an ACS noob.
My script is:
[spoiler]#include "zcommon.acs"
script 1 (void)
{
while (ThingCountName("DoomImp", 1) < 5)
{
SpawnSpot ("DoomImp",1);
Delay (50);
}
}[/spoiler]
This is what I could do from what I read, I'm sorry if it's way off from what I'm trying to do.
Basically my room is a square. A line cuts through the center. This line executes the script when the player walks through it, so the map spot begins to spawn imps, with that short delay.
The problem is that it spawns infinitely, I'm trying to have a limit of 5 imps at a time.
I would greatly appreciate any help, and I've certainly been looking through the ACS pages trying to learn it, and maybe my mistake is obvious and I just don't see it.
			
									
									
						My script is:
[spoiler]#include "zcommon.acs"
script 1 (void)
{
while (ThingCountName("DoomImp", 1) < 5)
{
SpawnSpot ("DoomImp",1);
Delay (50);
}
}[/spoiler]
This is what I could do from what I read, I'm sorry if it's way off from what I'm trying to do.
Basically my room is a square. A line cuts through the center. This line executes the script when the player walks through it, so the map spot begins to spawn imps, with that short delay.
The problem is that it spawns infinitely, I'm trying to have a limit of 5 imps at a time.
I would greatly appreciate any help, and I've certainly been looking through the ACS pages trying to learn it, and maybe my mistake is obvious and I just don't see it.
RE: Loop Linedef Effect?
the acs you gave doesnt go on for infinite (if it were it would have something like restart; in there), however it can be executed almost an infinite amount of times if the linedef action is repeatable. if you want to spawn only five imps per execution, your code should be like this:
#include "zcommon.acs"
 
script 1 (void)
{
while (ThingCountName("DoomImp", 1) < 5)
{
SpawnSpot ("DoomImp",1);
Delay (50);
SpawnSpot ("DoomImp",1);
Delay (50);
SpawnSpot ("DoomImp",1);
Delay (50);
SpawnSpot ("DoomImp",1);
Delay (50);
SpawnSpot ("DoomImp",1);
Delay (50);
}
}
It's longer but it should work.
			
									
									#include "zcommon.acs"
script 1 (void)
{
while (ThingCountName("DoomImp", 1) < 5)
{
SpawnSpot ("DoomImp",1);
Delay (50);
SpawnSpot ("DoomImp",1);
Delay (50);
SpawnSpot ("DoomImp",1);
Delay (50);
SpawnSpot ("DoomImp",1);
Delay (50);
SpawnSpot ("DoomImp",1);
Delay (50);
}
}
It's longer but it should work.
Watermelon wrote: Stall is notorious for his D.
For the best song you'll ever hear, click this linkLollipop wrote: What does ETA mean? I'm sorry, but I don't get too much around on the internet.
I DARE YOU
RE: Loop Linedef Effect?
I have that code in now, but the Imps keep getting spawned, they don't stop at 5. Before I know it, there are too many for me to walk around  
 
The line that runs the script is using Action 80 "Script Execute," with Script Number being 1 and the other fields kept at 0.
The trigger is "Player Walks Over."
Here is my map, if it helps:
Test Wad
I'm sure I messed up something obvious that I'm just not seeing
 
Edit: The map is in Zandronum's Doom in Hexen format.
			
													The line that runs the script is using Action 80 "Script Execute," with Script Number being 1 and the other fields kept at 0.
The trigger is "Player Walks Over."
Here is my map, if it helps:
Test Wad
I'm sure I messed up something obvious that I'm just not seeing
Edit: The map is in Zandronum's Doom in Hexen format.
					Last edited by BJ Vynz on Wed Mar 06, 2013 3:32 am, edited 1 time in total.
									
			
									
						RE: Loop Linedef Effect?
Your original script was fine, you don't need all those extra "DoomImp" lines in there... that does the opposite of what you want.
You just had ThingCountName("DoomImp", 1) instead of ThingCountName("DoomImp", 0) because the Imps are spawned with no TID, and if you put 0 it counts all DoomImps on the map.
So
Is fine.
			
													You just had ThingCountName("DoomImp", 1) instead of ThingCountName("DoomImp", 0) because the Imps are spawned with no TID, and if you put 0 it counts all DoomImps on the map.
So
Code: Select all
#include "zcommon.acs"
script 1 (void)
{
	while (ThingCountName("DoomImp", 0) < 5)
	{
	SpawnSpot ("DoomImp",1);
	Delay (50);
	}
}This is completely wrong and you have no idea what you are talking about. I suggest you go read some more about how loops work. A "While(Condition)" loop will continue forever as long as "Condition" returns true.W1D3A55 wrote: the acs you gave doesnt go on for infinite (if it were it would have something like restart; in there)
					Last edited by Llewellyn on Wed Mar 06, 2013 4:23 am, edited 1 time in total.
									
			
									
						RE: Loop Linedef Effect?
Ah yes, very much thanks Llewellyn, works kinda, now  
 
Still doesn't allow for the effect to keep happening though.
Edit:
I fixed it, with a "glitch!" lol
This is my code:
It is the same code, except it also adds the infinite loop. The infinite loop runs the actual needed code infinitely, which does exactly:
-Spawn until 5 imps are present
-Always repeat the above
I know it's not the proper way to do it, but at the moment I don't know any other way.
			
													Still doesn't allow for the effect to keep happening though.
Edit:
I fixed it, with a "glitch!" lol
This is my code:
Code: Select all
#include "zcommon.acs"
script 1 (void)
{
    while (ThingCountName("DoomImp", 1) < 5)
    {
    while (ThingCountName("DoomImp", 0) < 5)
    {
    SpawnSpot ("DoomImp",1);
    Delay (20);
    }
    Delay (20);
    }
}
-Spawn until 5 imps are present
-Always repeat the above
I know it's not the proper way to do it, but at the moment I don't know any other way.
					Last edited by BJ Vynz on Wed Mar 06, 2013 5:35 am, edited 1 time in total.
									
			
									
						RE: Loop Linedef Effect?
Oh you wanted it to keep going forever? Something like this then:BJ Vynz wrote: Ah yes, very much thanks Llewellyn, works kinda, now![]()
Still doesn't allow for the effect to keep happening though.
Code: Select all
#include "zcommon.acs"
script 1 (void)
{
    if (ThingCountName("DoomImp", 0) < 5)
        SpawnSpot ("DoomImp",1);
    Delay (20);
    restart;
}
Code: Select all
script 1 (void)
{
    while (true)
    {
    if (ThingCountName("DoomImp", 0) < 5)
        SpawnSpot ("DoomImp",1);
    Delay (20);
    }
}
					Last edited by Llewellyn on Wed Mar 06, 2013 8:12 pm, edited 1 time in total.
									
			
									
						RE: Loop Linedef Effect?
Thank you, works perfectly. That concludes this question :)
			
									
									
						