Jump to content

Help with custom spawnpoints


FatherSarge

Recommended Posts

Hello!

 

My mod MoreLZs needs a little bit of help. Essentially it adds a bunch of spawnpoints all over the map. About 50-75% of them work. Unfortunately a huge number of them toss you errors(warnings, but more on that later) like this:

 

WARN : General     , 1683072241087> SpawnPoints.initSpawnBuildings> initSpawnBuildings: no room or building at 6741,12327,0

 

This is 1 of probably 2-3 dozen points. All with the same error. These are points where players cannot be spawned and therefore are removed from the spawnpoint pool. How do I fix this and add these points back in? What's wrong here? Is there some rule about spawnpoints I'm missing?

 

Some notes on my in-game, handpicked spawnpoints:
-All z=0 points are large, open areas with no trees or other objects in the way

-Any z=1+ points are large, prominent roofs away from ledges and objects with stairs or doors to the ground or to inside buildings

-There is seemingly no pattern to these errors

-All spawnpoints on (rooftop) or near the 2 big malls on the vanilla map seem to be particularly broken and nonfunctional

Edited by FatherSarge
Link to comment
Share on other sites

I don't think that message is an error, just a warning that you might have used an exterior location by mistake.

 

From looking at the code I don't see why this would cause a problem, and I know lots of mods spawn players outside.

 

It looks like the game records which buildings are spawn buildings, I vaguely recall that is a factor re whether a building can be a safe house (as you probably don't want new players spawning inside someone else's safe house).

Link to comment
Share on other sites

I mean it's absolutely an error, an issue, a mistake that these points can't be used as spawnpoints, that's not debatable. I've got spawnpoints ranging from open fields, to narrow clearings, to rooftops of varying levels(up to and including 6), to helipads working just fine.

 

Yet a select bunch just don't work, there's nothing fundamentally different about any of them.

 

Though I suppose I've discovered maybe 1 pattern, it would seem the accessible rooftop area of the grand ohio mall cannot serve as a spawn location.

 

I suppose what I'm trying to get at here is that it doesn't make any sense that any of these areas cannot serve as a spawn location. Is there some issue I'm missing here with spawn locations that certain areas need to be "allowed" to serve as spawn locations? Idk... seems to me from the warning message that for some reason the map hasn't loaded yet and therefore cannot place a player there (if you force spawn a player in this location it will crash your game).

Link to comment
Share on other sites

I've just tried spawning at the location mentioned in the 1st post - it worked as normal, no errors.

 

image.thumb.png.31292a976591fadbf9b64b37932eae1e.png

 

{worldX = 22, worldY = 41, posX = 141, posY = 27}

 

If you post some more locations I can try those and see if I can replicate the problem.

 

Link to comment
Share on other sites

Here is the full printout of the spawnpoints that don't seem to work when used in the mod.

 

My testing on randomly selected points has shown the same results as you (they work when on their own), it just doesn't want to work when in the bunch :? it's just odd

A few of them (with z level 6) I've solved (was just me fat fingering the worldY) but all the z0 are still a complete mystery as to why they don't want to work when in the bunch :-(

I wouldn't spend much time on it, I'm of the opinion we have no power to fix it.

Errors.txt

Link to comment
Share on other sites

    private void initSpawnBuildings() {
        for (int i = 0; i < this.SpawnPoints.size(); ++i) {
            IsoGameCharacter.Location location = this.SpawnPoints.get(i);
            RoomDef roomDef = IsoWorld.instance.MetaGrid.getRoomAt(location.x, location.y, location.z);
            if (roomDef == null || roomDef.getBuilding() == null) {
                DebugLog.General.warn("initSpawnBuildings: no room or building at %d,%d,%d", new Object[]{location.x, location.y, location.z});
                continue;
            }
            this.SpawnBuildings.add(roomDef.getBuilding());
        }
    }

    public boolean isSpawnBuilding(BuildingDef buildingDef) {
        return this.SpawnBuildings.contains((Object)buildingDef);
    }

 

(decompiled by http://www.javadecompilers.com)
This is the code that is causing that message to be displayed.  All it appears to be doing is storing every spawn building in a list, so it can be checked later (via isSpawnBuilding) and if the spawn point isn't in a building it prints that message.

 

There is no error being thrown, no code fails to execute (apart from not adding the building to a list, which is fine because there is no building).

 

If some of the locations aren't working it is unrelated to that message.

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...