Adding extra Lords to a faction after day 1

Users who are viewing this thread

Status
Not open for further replies.

Berserker Pride

Grandmaster Knight
OK basically I want to have one faction start out equal strength to everyone else and then later get 40 more lords after day 90 or after a quest whatever.  So I created 40 more lords then added a simple trigger to create them on such and such day. The problem is the existing script that begins the game creates all the lords of a faction right at the beginning. So all 60 lords start owning the map right away.  Somewhere in here
("create_kingdom_hero_party",
    [
      (store_script_param, ":troop_no", 1),
      (store_script_param, ":center_no", 2),
   
      (store_troop_faction, ":troop_faction_no", ":troop_no"),
     
      (assign, "$pout_party", -1),
      (set_spawn_radius,0),
      (spawn_around_party,":center_no", "pt_kingdom_hero_party"),
      (assign, "$pout_party", reg0),
     
      (party_set_faction, "$pout_party", ":troop_faction_no"),
      (party_set_slot, "$pout_party", slot_party_type, spt_kingdom_hero_party),
      (call_script, "script_party_set_ai_state", "$pout_party", spai_undefined, -1),
      (troop_set_slot, ":troop_no", slot_troop_leaded_party, "$pout_party"),
      (party_add_leader, "$pout_party", ":troop_no"),
      (str_store_troop_name, s5, ":troop_no"),
      (party_set_name, "$pout_party", "str_s5_s_party"),
     
      (party_set_slot, "$pout_party", slot_party_commander_party, -1), #we need this because 0 is player's party!
I need to put a try_for_range that only adds lords 1-20 of faction 3 at the beginning of the game and then the simple trigger adds the rest later.  Any help would be awesome you guys have been great so far.  I hope I'm not posting too much. :???:
 
Iirc in game init the script "create_kingdom_hero_party" is only called to spawn the town lords, so the first thing you have to do is to make sure your additionnal lords are not town lords (if you have not randomized the town lords set in native they shouldn't be).

The other lords are spawned by the simple trigger # Respawn hero party if not prisoner. This trigger check all heroes having the troop occupation "slto_kingdom_hero" and spawn them in a friendly non besieged center.

So the best way to avoid to see heroes spawned when you don't want is to give another value to their slot_troop_occupation  (ie, -1). Note that you need to do this at the end of game init script or these lords won't recieve renown and money.

Add something like this at the end of the game init script :
(try_for_range, ":lord", kingdom_heroes_begin, kingdom_heroes_end),

(is_between, ":lord", (the lords you want to spawn later)
(troop_set_slot, ":lord", slot_troop_occupation, -1),
(try_end),

Then when you want to spawn them, include this in your trigger :
(troop_set_slot, ":lord", slot_troop_occupation, slto_kingdom_hero),

And you don't even need to touch or call the "create_kingdom_hero" script,  they will be automatically spawned in a friendly center in the 48h.
 
How about you make an invisible castle somewhere for that faction  on the edge of the map where those 40 lords stay until day x and then move them to the mainland via script?
 
No need to create the lords parties before they are used.

Just create an invisible spawn point where you want (copy a bandit spawn point party and give it a different name and position).

Then you can spawn heroes there when you want with a
(call_script, "script_create_kingdom_hero_party", "(the id of the hero troop)", "(the name of your spawn point)")

(but if you want to so so with heroes of a faction already owning centers on the map, you'll also still need to change the trigger respawning heroes or their stlo slot, like I described, to avoid to see your new heroes spawned in walled centers their faction own before)

ps : if you want an example of more elaborated invasion script look at the code of sword of damocles
 
Awesome after a little bit of fiddling around with the code it works perfectly. I ended up using your first approach Twan of setting the last lords of faction to be = -1 at the end of the game_start script.  Then in the trigger I used this
(try_for_range, ":lord", kingdom_heroes_begin, kingdom_heroes_end),

                        (is_between, ":lord", "trp_knight_3_21", "trp_knight_3_60"),
(troop_set_slot, ":lord", slot_troop_occupation, slto_kingdom_hero),
                        (try_end),
The same trigger also declares war on everyone too.  This is awesome though.  Now a faction that possibly could be losing gets a huge boost of reinforcements and starts trouncing everyone else.  Soil your idea would have also worked too. I would just need to teleport the lords back to the mainland with a simple trigger.  Thanks for all your help guys.
 
Status
Not open for further replies.
Back
Top Bottom