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.
Different monster spawn each map
Moderator: GZDoom Developers
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!)
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!)
-
- Posts: 231
- Joined: Tue Mar 23, 2010 4:47 pm
- Preferred Pronouns: No Preference
- Graphics Processor: nVidia with Vulkan support
- Location: existential dread
-
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Re: Different monster spawn each map
Might something like this work?
MAPINFO
ZScript
MAPINFO
Code: Select all
gameinfo{
addeventhandlers="ImpRambler"
}
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);
}
}
}
Last edited by Matt on Wed Jun 13, 2018 2:10 pm, edited 1 time in total.
-
- Posts: 231
- Joined: Tue Mar 23, 2010 4:47 pm
- Preferred Pronouns: No Preference
- Graphics Processor: nVidia with Vulkan support
- Location: existential dread
Re: Different monster spawn each map
I've barely if not 0 experience with Zscript, tried to implement it but ended up with these errors;
It's likely I did something wrong, haha.
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
-
- Posts: 9696
- Joined: Sun Jan 04, 2004 5:37 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Debian Bullseye
- Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Re: Different monster spawn each map
Sorry, I never remember to add the version number to the start of the ZScript file:
Code: Select all
version "3.4"
-
- Posts: 231
- Joined: Tue Mar 23, 2010 4:47 pm
- Preferred Pronouns: No Preference
- Graphics Processor: nVidia with Vulkan support
- Location: existential dread
Re: Different monster spawn each map
Yep! It works now, thank you so much!