Nightcrawler552 Posted November 28, 2023 (edited) In gzdoom builder Is there anyway to have monsters spawn once a bosses health say reaches 50% for example. Is there a script or something? 0 Share this post Link to post
2 Kan3 Posted November 28, 2023 11 hours ago, shroomzy5000 said: Im kinda new to mapping myself but im pretty sure ive seen this before using CheckActorProperty paired with APROP_Health CheckActorProperty - ZDoom Wiki So you can set up a bool variable to always be checking the boss health with Then run a while loop that says while boss health > 50 - delay and have it spawn the rest of the enemies when < 50 Someone smarter and more experienced might have a better way though. I was able to compile this real quick. #include "zcommon.acs" bool Bosshealth = 4000; script 1 (void) { while(CheckActorProperty(0, APROP_Health,Bosshealth) > 2000) { delay(3); } Thing_SpawnFacing(0,0,0,0); } the logic might be flawed and i didnt test it in a map but this is i think at least a step in the right direction. The way I understand it, the bool bosshealth = cyberdemon hit points when script runs, it checks the actor property, tag cyberdemon and put where i put a 0. APROP HEALTH will return the health number to be compared against the 4000. if this number is greater than 2000 (%50 cyberdemon health) delay 3 tics when it becomes less than 2000, script moves on and spawns various demons of your choosing lol Hopefully helpful, but i think i possibly set up the boolian varbile wrong... let me know if it works, ill test it tomorrow but i bet this is doable Booleans cannot store values other than 0 or 1, you want a integer variable to store the cyberdemon health, but you don't even need that, you can use GetActorProperty and you're done. So, something like this: script "CheckBossHealth" (int tid) { //You can use 'ENTER' scripts if you don't want to 'manually' trigger with lines or something else while(GetActorProperty(tid, APROP_Health) > GetActorProperty(tid, APROP_SpawnHealth) / 2) { //Variable 'tid' for the actual tid you need to give to the actor you want this script to do stuff. Since You have that in the script arguments, you can (and have to) set any tid you want on the script trigger, this way you can choose whatever actor you want, do it multiple times with different triggers and just have this one script. Delay(7); } do { delay(1); int x = GetActorX(tid) + 64.0; //Will spawn the monster that you want 64 units in front of the boss. int y = GetActorY(tid); int z = GetActorZ(tid); int angle = GetActorAngle(0) >> 8; } until (Spawn("MonsterToSpawn", x, y, z, 0, angle)); //Necessary loop to avoid to spawn the monster inside walls of failing the spawn. } It should work fine But, if you have a custom boss monster, than you should definitely do the thing in ZSCRIPT/DECORATE 1 Share this post Link to post
0 shroomzy5000 Posted November 28, 2023 (edited) Im kinda new to mapping myself but im pretty sure ive seen this before using CheckActorProperty paired with APROP_Health CheckActorProperty - ZDoom Wiki So you can set up a bool variable to always be checking the boss health with Then run a while loop that says while boss health > 50 - delay and have it spawn the rest of the enemies when < 50 Someone smarter and more experienced might have a better way though. I was able to compile this real quick. #include "zcommon.acs" bool Bosshealth = 4000; script 1 (void) { while(CheckActorProperty(0, APROP_Health,Bosshealth) > 2000) { delay(3); } Thing_SpawnFacing(0,0,0,0); } the logic might be flawed and i didnt test it in a map but this is i think at least a step in the right direction. The way I understand it, the bool bosshealth = cyberdemon hit points when script runs, it checks the actor property, tag cyberdemon and put where i put a 0. APROP HEALTH will return the health number to be compared against the 4000. if this number is greater than 2000 (%50 cyberdemon health) delay 3 tics when it becomes less than 2000, script moves on and spawns various demons of your choosing lol Hopefully helpful, but i think i possibly set up the boolian varbile wrong... let me know if it works, ill test it tomorrow but i bet this is doable Edited November 28, 2023 by shroomzy5000 : continuation of thought 0 Share this post Link to post
0 Nightcrawler552 Posted November 29, 2023 @Kan3 this may be obvious, sorry im still new to this scripting stuff but what am i doing wrong? 0 Share this post Link to post
0 Rifleman Posted November 29, 2023 (edited) First, why is the tid 66666 in the beginning and later 66667? That does not match the example - it would spawn the baron in front of a different actor than the one you're checking the health of. And second, you don't show the error, but I tried it and it tells me the issue is this: script "CheckBossHealth" (int 66666) - you could use script "CheckBossHealth" (void) instead and then just manually fill the tid elsewhere as you have. Or leave it exactly as Kan3 suggested, the just assign a TID to the boss and make him call the script somehow. Edited November 29, 2023 by Rifleman 0 Share this post Link to post
0 Nightcrawler552 Posted November 29, 2023 (edited) @Rifleman honestly I didn't even know about the message I must've had it turned off or something, so what am I doing wrong now. Its probably obvious but yh Nvm I got it workin Edited November 29, 2023 by Nightcrawler552 0 Share this post Link to post
0 Kan3 Posted November 29, 2023 24 minutes ago, Nightcrawler552 said: @Rifleman honestly I didn't even know about the message I must've had it turned off or something, so what am I doing wrong now. Its probably obvious but yh You didn't have to do anything with the script I wrote there, it was already completed except for the monster class to spawn x) No need to specify the tid of the monster here, also, why a so huge number? Note that the max value a tid/tag can have is 32767 (or -32767), of course it's giving you an error. Here's how you should've set up the thing: Spoiler Spoiler And here's the script in action: Spoiler I'm replacing the imp, that's why he spawned that monster Although, the issue here was pretty basic, so my suggestion is to first get more straight forward examples of scripting on the wiki or forums, to initially have a solid ground before entering darker realms. Even if the original question might sound a pretty simple task, you have to keep in mind how far your questions are from vanilla Doom "core" and why. 0 Share this post Link to post
0 Nightcrawler552 Posted November 29, 2023 @Rifleman @Kan3is there a way to have this work with a door too, like using door_open when the boss health reaches half or whatever 0 Share this post Link to post
0 Rifleman Posted November 29, 2023 Yep, just put whatever you want to happen in that script. It could be something like this: Spoiler script "CheckBossHealth" (int tid) { while(GetActorProperty(tid, APROP_Health) > GetActorProperty(tid, APROP_SpawnHealth) / 2) { Delay(7); } Your code here } 1 Share this post Link to post
0 Nightcrawler552 Posted November 29, 2023 @Kan3Kan3it works but for some reason the door only opens when the boss is dead 0 Share this post Link to post
0 Kan3 Posted November 30, 2023 On 11/29/2023 at 10:18 PM, Nightcrawler552 said: @Kan3Kan3it works but for some reason the door only opens when the boss is dead It should work fine like Rifleman said. Show the script 0 Share this post Link to post
In gzdoom builder Is there anyway to have monsters spawn once a bosses health say reaches 50% for example. Is there a script or something?
Share this post
Link to post