Camp mod

Users who are viewing this thread

prefrontal

Recruit
Hello, sorry in advance, I am a beginnner and very dumb! I'm trying to create a mod that let's you set up camp on the map. I managed to create a camp mission that loads a terrain respective to your location on the map and then my camp prefab where I can spawn my companions and troops. All well and good, however, I cannot add behaviors (like wandering around, following me, standing guard etc) to my agents because they are not locationcharacters. Town, village, and castle missions are locations that can have locationcharacters, for which a lot of useful behaviors are already available. I am wondering if there is a way to recognize my camp as a location so I can use all these useful things to make my camp seem more alive. LocationComplexes are listed in the location_complex_templates xml and registered in the SubModule so I can add a new LocationComplex with the location camp there. But I am at a loss for how to go from there. I guess in principle I'd need to get the game to read the xml and load my location_complex_template so I can then create a new instance of the LocationComplex and then get the location to pass on to my MissionMethod?!? Has anybody maybe tried something similar and can point me in the right direction? Or won't this work at all? Sorry again if this is convoluted or a dumb question. If the answer is "wait until someone who knows what their doing creates a similar mod" that is also fine! Thanks in advance!

Edit: In case anyone is trying to do something similar, I think I found a good way to do this for now... You don't have to fiddle with the xmls. You can just create a LocationComplex and Locations in your code and set the Location's owner complex. Now, in order for your agents to have behaviors, you need the MissionAgentHandler in your MissionBehaviors. You can't add it to your MissionMethod, though, if you're loading a scene that doesn't have props yet (like an empty battlefield where I wanted to spawn my camp) because the game will crash. Maybe there is a better way to do this but it works if you open the mission without it, load the props onto the scene and then add the MissionAgentHandler to your behaviors. You have to do it after the AfterStart function is done though because it will also crash. I add it on the first mission tick and it works fine. The rest is straight forward, just add whatever characters you want to your location and spawn them as needed.
It seems to me though, the code clearly doesn't want you to do something like this, i.e., non-battle scenes outside of settlements. It's cool you can load prefabs to scenes though. That should make it possible to build your castle for example by just loading the buildings as they are constructed. They already do it with the workshops but nothing else as far as I can see.

HYLCF89.png
 
Last edited:
Back
Top Bottom