Page 1 of 1

[ACS] Bit of an issue with spawning things

Posted: Sat Apr 08, 2017 12:34 am
by FranckyFox2468
Hey so i decided to try to make a code that if certain monstes have been killed prior to this script being activate, the very same monsters are respawned at the spot, but when the script is called after the monsters being dead it doesn't do jack shit. Here's the script:
Script 4 (void)
{
Line_SetBlocking (14, 0, BLOCKF_EVERYTHING);
Floor_LowerToNearest (25, 32);
SpawnSpot ("lostsoul", 28);
SpawnSpot ("lostsoul", 29);
SpawnSpot ("lostsoul", 30, 0, 90);
SpawnSpot ("lostsoul", 31, 0, 270);
Delay(1);
if(thingcountname("revenant",34) > 0)
{
SpawnSpot ("revenant", 32);
}
Delay(1);
if(thingcountname("revenant",35) > 0)
{
SpawnSpot ("revenant", 33);
}
}
Before you ask the lost souls does indeed spawn, the problem is the revenants not spawning at all. Been trying to do a script where if one gets killed it automatically spawns another but i got a runaway script error so i gave upn on this idea :sad:

[ACS] Re: Bit of an issue with spawning things

Posted: Sat Apr 08, 2017 1:12 am
by Catastrophe
A few things could be happening here. Either you have revenants spawned but they don't have the tid's 34 and 35 or you don't have spawnspots with the tid's of 32 and 33. My suggestion is to add a print inside the if statements to see if that part is even being ran. If it does print then it means you are lacking spawnspots with the appropriate TID's.

[ACS] Re: Bit of an issue with spawning things

Posted: Sat Apr 08, 2017 2:08 am
by FranckyFox2468
Catastrophe wrote:A few things could be happening here. Either you have revenants spawned but they don't have the tid's 34 and 35 or you don't have spawnspots with the tid's of 32 and 33. My suggestion is to add a print inside the if statements to see if that part is even being ran. If it does print then it means you are lacking spawnspots with the appropriate TID's.
Well i just found a weird thing, it does the opposite of what its supposed to do. It spawns extra revenants if they are alive and not if they are dead... I'm not sure how to fix this.

[ACS] Re: Bit of an issue with spawning things

Posted: Sat Apr 08, 2017 7:13 am
by Catastrophe
FranckyFox2468 wrote:
Catastrophe wrote:A few things could be happening here. Either you have revenants spawned but they don't have the tid's 34 and 35 or you don't have spawnspots with the tid's of 32 and 33. My suggestion is to add a print inside the if statements to see if that part is even being ran. If it does print then it means you are lacking spawnspots with the appropriate TID's.
Well i just found a weird thing, it does the opposite of what its supposed to do. It spawns extra revenants if they are alive and not if they are dead... I'm not sure how to fix this.
Sounds like script 4 is being triggered elsewhere.

[ACS] Re: Bit of an issue with spawning things

Posted: Sat Apr 08, 2017 2:31 pm
by FranckyFox2468
Catastrophe wrote:
FranckyFox2468 wrote:
Catastrophe wrote:A few things could be happening here. Either you have revenants spawned but they don't have the tid's 34 and 35 or you don't have spawnspots with the tid's of 32 and 33. My suggestion is to add a print inside the if statements to see if that part is even being ran. If it does print then it means you are lacking spawnspots with the appropriate TID's.
Well i just found a weird thing, it does the opposite of what its supposed to do. It spawns extra revenants if they are alive and not if they are dead... I'm not sure how to fix this.
Sounds like script 4 is being triggered elsewhere.
No the script does trigger but it does the opposite of what its supposed to do. The intention of this script is to make revenants spawn IF the one assigned are dead. Otherwise it does nothing.

What the script currently does is that it spawns the replacement revenants only if the current revenants are already alive and not when they are dead.

[ACS] Re: Bit of an issue with spawning things

Posted: Sat Apr 08, 2017 3:45 pm
by Empyre
I think I see your logic error. Try replacing this:
if(thingcountname("revenant",34) > 0)

with this:
if(thingcountname("revenant",34) = 0)

and do the same for the other one.
It is doing what you are telling it to do, spawn a revenant if there are more than zero of them, when you want it to spawn one if there are exactly zero of them.

[ACS] Re: Bit of an issue with spawning things

Posted: Sat Apr 08, 2017 3:47 pm
by FranckyFox2468
Empyre wrote:I think I see your logic error. Try replacing this:
if(thingcountname("revenant",34) > 0)

with this:
if(thingcountname("revenant",34) = 0)

and do the same for the other one.
It is doing what you are telling it to do, spawn a revenant if there are more than zero of them, when you want it to spawn one if there are exactly zero of them.
Gzdoom builder refuses to compile the script with =. Good thinking but it sadly doesn't work :sad:

[ACS] Re: Bit of an issue with spawning things

Posted: Sat Apr 08, 2017 11:57 pm
by FranckyFox2468
Been trying to ask some help around Zdoom.org, matters only got progressively worse at every attempts. I have no fucking clue why something this simple can't work correctly.

[ACS] Re: Bit of an issue with spawning things

Posted: Sun Apr 09, 2017 12:14 am
by jdagenet
You're supposed to use double '=' signs when comparing like this. That's why the script isn't compiling.

[ACS] Re: Bit of an issue with spawning things

Posted: Sun Apr 09, 2017 12:42 am
by Empyre
Oh yeah: = is assigning a value, and == is comparing 2 values. My C-style coding is sooo rusty.