Loop Linedef Effect?

Discuss all aspects related to modding Zandronum here.
Post Reply
BJ Vynz
 
Posts: 29
Joined: Tue Jan 15, 2013 4:05 am

Loop Linedef Effect?

#1

Post by BJ Vynz » Tue Mar 05, 2013 6:50 am

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?

User avatar
mr fiat
Frequent Poster Miles card holder
Posts: 858
Joined: Tue Jun 05, 2012 3:28 pm
Location: netherlands

RE: Loop Linedef Effect?

#2

Post by mr fiat » Tue Mar 05, 2013 8:37 am

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.

User avatar
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?

#3

Post by ZZYZX » Tue Mar 05, 2013 8:49 am

I think what he wants to do is AUTOMATICALLY repeat some effect on line.
OP: http://zdoom.org/wiki/ACS

BJ Vynz
 
Posts: 29
Joined: Tue Jan 15, 2013 4:05 am

RE: Loop Linedef Effect?

#4

Post by BJ Vynz » Wed Mar 06, 2013 2:03 am

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.

W1D3A55
Forum Regular
Posts: 327
Joined: Sun Sep 30, 2012 12:39 am
Location: Here

RE: Loop Linedef Effect?

#5

Post by W1D3A55 » Wed Mar 06, 2013 2:20 am

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.
Watermelon wrote: Stall is notorious for his D.
Lollipop wrote: What does ETA mean? I'm sorry, but I don't get too much around on the internet.
For the best song you'll ever hear, click this link
I DARE YOU

BJ Vynz
 
Posts: 29
Joined: Tue Jan 15, 2013 4:05 am

RE: Loop Linedef Effect?

#6

Post by BJ Vynz » Wed Mar 06, 2013 3:26 am

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 :neutral:
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.

Llewellyn
Forum Regular
Posts: 578
Joined: Mon Jul 02, 2012 7:12 am

RE: Loop Linedef Effect?

#7

Post by Llewellyn » Wed Mar 06, 2013 4:20 am

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

Code: Select all

#include "zcommon.acs"
script 1 (void)
{
	while (ThingCountName("DoomImp", 0) < 5)
	{
	SpawnSpot ("DoomImp",1);
	Delay (50);
	}
}
Is fine.
W1D3A55 wrote: the acs you gave doesnt go on for infinite (if it were it would have something like restart; in there)
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.
Last edited by Llewellyn on Wed Mar 06, 2013 4:23 am, edited 1 time in total.

BJ Vynz
 
Posts: 29
Joined: Tue Jan 15, 2013 4:05 am

RE: Loop Linedef Effect?

#8

Post by BJ Vynz » Wed Mar 06, 2013 4:43 am

Ah yes, very much thanks Llewellyn, works kinda, now :smile:
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);
    }
}
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.
Last edited by BJ Vynz on Wed Mar 06, 2013 5:35 am, edited 1 time in total.

Llewellyn
Forum Regular
Posts: 578
Joined: Mon Jul 02, 2012 7:12 am

RE: Loop Linedef Effect?

#9

Post by Llewellyn » Wed Mar 06, 2013 8:11 pm

BJ Vynz wrote: Ah yes, very much thanks Llewellyn, works kinda, now :smile:
Still doesn't allow for the effect to keep happening though.
Oh you wanted it to keep going forever? Something like this then:

Code: Select all

#include "zcommon.acs"
script 1 (void)
{
    if (ThingCountName("DoomImp", 0) < 5)
        SpawnSpot ("DoomImp",1);
    Delay (20);
    restart;
}
or

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.

BJ Vynz
 
Posts: 29
Joined: Tue Jan 15, 2013 4:05 am

RE: Loop Linedef Effect?

#10

Post by BJ Vynz » Thu Mar 07, 2013 2:12 am

Thank you, works perfectly. That concludes this question :)

Post Reply