Different monster spawn each map

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: Different monster spawn each map

Re: Different monster spawn each map

by Pandut » Wed Jun 13, 2018 2:49 pm

Yep! It works now, thank you so much!

Re: Different monster spawn each map

by Matt » Wed Jun 13, 2018 1:57 pm

Sorry, I never remember to add the version number to the start of the ZScript file:

Code: Select all

version "3.4"

Re: Different monster spawn each map

by Pandut » Wed Jun 13, 2018 12:29 pm

I've barely if not 0 experience with Zscript, tried to implement it but ended up with these errors;

Code: Select all

1Pan-ZRift.pk3:zscriptu/impspawn.zsc, line 1: Parent class EventHandler of ImpRambler not accessible to ZScript version 2.3.0
1Pan-ZRift.pk3:zscriptu/impspawn.zsc, line 3: Type WorldEvent not accessible to ZScript version 2.3.0
1Pan-ZRift.pk3:zscriptu/impspawn.zsc, line 3: Invalid type Type for function parameter
1Pan-ZRift.pk3:zscriptu/impspawn.zsc, line 3: Attempt to override non-existent virtual function WorldLoaded
It's likely I did something wrong, haha.

Re: Different monster spawn each map

by Matt » Wed Jun 13, 2018 12:05 am

Might something like this work?

MAPINFO

Code: Select all

gameinfo{
    addeventhandlers="ImpRambler"
}
ZScript

Code: Select all

version "3.4" //added after OP reported the error below

class ImpRambler:EventHandler{
    override void WorldLoaded(WorldEvent e){
        int which=random(0,2);
        thinkeriterator impreplacer=thinkeriterator.create("doomimp");
        actor imppp=null;
        array<actor>impppdelend;
        while(imppp=actor(impreplacer.next())){
            class<actor> notimp="chaingunguy";
            if(which==1) notimp="lostsoul";
            else if(which==2) notimp="explosivebarrel";
            imppp.spawn(notimp,imppp.pos);
            impppdelend.push(imppp);
        }
        while(impppdelend.size()>0){
            impppdelend[0].destroy();
            impppdelend.delete(0);
        }
    }
}

Different monster spawn each map

by Pandut » Tue Jun 12, 2018 4:07 pm

Issue is simple; I have 3 enemies that take the role of the standard DoomImp. I do not want to use a RandomSpawner because each monster has a different aesthetic and wouldn't mesh super well. My question is; how do I go about creating a system where each map it randomly chooses 1 of 3 of these monsters to replace the DoomImp per map? Can I do this in Decorate or would it require ZScript/ACS?

I've looked around but can't seem to find anything relation, nor any examples I could reference. Any help would be appreciateddd.

Top