Monster Death Events

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Monster Death Events

Re: Monster Death Events

by Beetow Brode » Sat Apr 21, 2018 4:21 pm

Thank you this helped very much! (:

Re: Monster Death Events

by m8f » Wed Apr 18, 2018 7:05 pm

Do you want to: 1. kill everything in the end by a script, or 2. detect that everything is killed?
If the first, then

Code: Select all

Thing_Destroy(0, 0, 0);
will kill every monster.

If the second, then

Code: Select all

script "CheckEverythingKilled" Enter
{
  int totalMonsters  = GetLevelInfo(LEVELINFO_TOTAL_MONSTERS);
  int killedMonsters = GetLevelInfo(LEVELINFO_KILLED_MONSTERS);
  bool allMonstersKilledOld = (totalMonsters == killedMonsters);

  while (true)
  {
    totalMonsters  = GetLevelInfo(LEVELINFO_TOTAL_MONSTERS);
    killedMonsters = GetLevelInfo(LEVELINFO_KILLED_MONSTERS);
    bool allMonstersKilled = (totalMonsters == killedMonsters);

    if (allMonstersKilled != allMonstersKilledOld)
    {
      // do something that you want when everything is killed
    }
    allMonstersKilledOld = allMonstersKilled;

    delay(35); // check every second.
  }
}
If you want to check not everything, but a particular type of monster, you can use ThingCountName:

Code: Select all

    if (ThingCountName("DoomImp", 0) == 0)
    {
      // do something that you want when all imps are killed
    }

Re: Monster Death Events

by Beetow Brode » Wed Apr 18, 2018 6:07 pm

Could I maybe see an example, also I had a script where this could maybe work, but it doesnt because its 2 imps and a arachnatron, so i'm thinking this could maybe work?

Code: Select all

baronsKilled++;
if(baronsKilled >= 2)

Re: Monster Death Events

by Blue Shadow » Mon Apr 16, 2018 10:57 pm

[wiki]Thing_Destroy[/wiki]. You can use it from DECORATE/ZScript and ACS.

Re: Monster Death Events

by Beetow Brode » Mon Apr 16, 2018 8:58 pm

But this includes multiple monsters
not one

Monster Death Events

by Beetow Brode » Mon Apr 16, 2018 8:57 pm

I need help with a project that includes everything dying at the end, is there anyway that I can add this to my mod
or maybe can someone put an example. Thanks :wub:

Top