-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow "place_monster" to spawn exactly one monster from a monster group #33256
Allow "place_monster" to spawn exactly one monster from a monster group #33256
Conversation
The alternative you've described looks far more appealing to me. The existed separation was rather natural: |
After thinking I agree that using "place_monster" instead of "place_monsters" seems more sensible. Something like I was also thinking that this almost makes "place_monster" and "place_monsters" same. The only extra feature in "place_monsters" is the density. Everything else is/could be identical. They could be combined to same thing or at least partially in code in some other pull request. |
This should now be practically ready (unless that branch merge about points causes issues) (which it of course does. But it was easy fix). The doc had nothing about "place_monster" so I added info for it in mapgen.md. It is formatted different from other things in there. I took the style from JSON_INFO.md which in my opinion is much more readable. I am not sure about the formatting and wording of the doc but the contents should be correct. |
Summary
SUMMARY: Infrastructure "Allow spawning exactly one monster from a monster group and set it mission target"
Purpose of change
With
"place_monster"
you can spawn exactly one monster of the type you define. You can also set the name of the monster and that it is the mission target.For example
"place_monster": [ { "monster": "mon_darkman", "x": 8, "y": 10 } ]
With
"place_monsters"
you can spawn vague number of random monsters from a monster group. The name can not be set and neither the mission target.If you want to spawn exactly one random monster from a monster group you couldn't do it.
Describe the solution
"place_monster"
can now take eithermonster
(monster ID) orgroup
(monster group ID).map::place_spawns
already hasindividual
parameter that causes exactly one monster to spawn. But it was not used ever with json. It is used here now.So you can do something like this to spawn a random mission target from a monster group.
"place_monster": [ { "monster": "GROUP_REFUGEE_BOSS_ZOMBIE", "name": "Sean McLaughlin", "x": 10, "y": 10, "target": true } ]
If multiple targets are spawned then killing any one of them is enough to complete mission.
I have also updated the first mission from the merchant in the refugee center to show the feature.
Before: Electric zombie was spawned. If this monster was blacklisted nothing was spawned and mission was broken (with mods like "mundane zombies" or "classic zombies").
New: 50/50 to spawn either electric or acidic zombie. If both are blacklisted a tough zombie is spawned instead.
Describe alternatives you've considered
Use
"place_monsters"
instead.Additional context
I very much copied things from
jmapgen_monster
tojmapgen_monster_group
to make this work. I am not 100% sure what all of the parts did but the result seems to work fine. The code should be looked closely.As far I can see "place_monster" is not documented at all. There is "place_groups" in mapgen.md which doesn't even exist. Was the name changed at some point?
The
pack_size
is ignored when usinggroup
. Excactly one monster is always placed. If you want to place multiple monsters you should still use the"place_monsters"
.When
monster
is used a high spawn density setting can cause multiple monsters to spawn. Not withgroup
.