[ACS] Bit of an issue with spawning things

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

[ACS] Bit of an issue with spawning things

#1

Post by FranckyFox2468 » Sat Apr 08, 2017 12:34 am

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:

Catastrophe
Retired Staff / Community Team Member
Posts: 2558
Joined: Sat Jun 02, 2012 2:44 am

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

#2

Post by Catastrophe » Sat Apr 08, 2017 1:12 am

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.

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

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

#3

Post by FranckyFox2468 » Sat Apr 08, 2017 2:08 am

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.

Catastrophe
Retired Staff / Community Team Member
Posts: 2558
Joined: Sat Jun 02, 2012 2:44 am

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

#4

Post by Catastrophe » Sat Apr 08, 2017 7:13 am

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.

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

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

#5

Post by FranckyFox2468 » Sat Apr 08, 2017 2:31 pm

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.

User avatar
Empyre
Zandrone
Posts: 1316
Joined: Sun Jul 08, 2012 6:41 am
Location: Garland, TX, USA

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

#6

Post by Empyre » Sat Apr 08, 2017 3:45 pm

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.
"For the world is hollow, and I have touched the sky."

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

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

#7

Post by FranckyFox2468 » Sat Apr 08, 2017 3:47 pm

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:

User avatar
FranckyFox2468
Forum Regular
Posts: 180
Joined: Sat May 07, 2016 8:30 pm

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

#8

Post by FranckyFox2468 » Sat Apr 08, 2017 11:57 pm

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.

User avatar
jdagenet
Forum Regular
Posts: 191
Joined: Tue Jun 05, 2012 8:08 am
Clan: Cube
Clan Tag: A3
Contact:

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

#9

Post by jdagenet » Sun Apr 09, 2017 12:14 am

You're supposed to use double '=' signs when comparing like this. That's why the script isn't compiling.
<Dynamo_>uh
<Dynamo_>did you just take the thread away
<FusedQyou>Dunno
<FusedQyou>ask the thread

User avatar
Empyre
Zandrone
Posts: 1316
Joined: Sun Jul 08, 2012 6:41 am
Location: Garland, TX, USA

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

#10

Post by Empyre » Sun Apr 09, 2017 12:42 am

Oh yeah: = is assigning a value, and == is comparing 2 values. My C-style coding is sooo rusty.
"For the world is hollow, and I have touched the sky."

Post Reply