How to make charater spawn with vehicle on start

How do I make a scenario mod where then charater spawns in or beside a specific vehicle on world start?

one way is to spawn at a location that has a vehicle

Try using map extra.

Theres no real code support for this to specify a vehicle that spawns with th eplayer on world start.

Itd be easy to add - I did similar with starting pets.

But then you get into a situation where you cannot guarantee theres enough space to spawn it nearby, depending on what is specified., thats the tricky bit.

As others have said - You could make a mod that has a start location where its guaranteed to spawn in that map.

If you really want a vehicle at the start and want to go the easiest route, you can just debug it in after you spawn and then just not use debug again. Other people might frown on this but, is the easiest option for doing what you want.

That’s not precisely true.

Scenarios can define a map extra that gets run on scenario start.
Map extras can run update_mapgen though there aren’t any examples of that right now.
update_mapgen can spawn vehicles or NPCs.

I think the relevant JSON is something close to:

  {
    "type": "scenario",
    "ident": "got_a_car",
    "map_extra": "mx_start_cart"
  },
  {
    "id": "mx_start_car",
    "type": "map_extra",
    "generator": { "generator_method": "update_mapgen", "generator_id": "um_start_car" }
  },
  {
    "type": "mapgen",
    "update_mapgen_id": "um_start_car",
    "method": "json",
    "object": { "place_vehicles": [ { "vehicle": "car", "x": 15, "y": 15, "chance": 100, "status": 1 } ] }
  }

(I’m omitting the bits that aren’t relevant here like the scenario description, etc) but I haven’t really tested it and I don’t know if it will work.

1 Like

Is there also a way to spawn friendly npcs with this?

Sure, define the NPC as a member of the "your_followers" faction, set their first topic to "TALK_FRIEND", and set their attitude to 4. The have the update_mapgen bit use "place_npcs" instead of "place_vehicles".

1 Like

Profession: Gang Leader

1 Like