Being a king

Users who are viewing this thread

Hello everyone!

I need a big help, and I would be very happy if someone could give me a good answer to this question.
I am making a new mod with one of my friends and we want to add a new function. The essence of it is that if you can make a 99 relation with every Lord in a faction (without the king) you can go to the actual marshall of that faction and ask him to make you the king of that faction. The problem is, that we don't know how to do this. If somebody would be so kind that he/she could tell us how to do this, we would be very grateful.

Thanks in advance!

Greetings,
MickeyMouse14
 
I think there was a mod which made you stay as a marshal forever. Try lookin' & askin' around.
 
I searched a lot and I found nothing that could help  :sad: And we actually want to make the player a king, not marshal forever. But I don't give up, I remember something about a mod where you can be a king, and i am searching for it, but no luck yet.  :sad:
 
I searched nearly the whole Internet for something, you are my last hope. And I don't want to edit the files without knowing what I am doing. Maybe if I crash the whole thing? It is 5 days' work!
 
But not a NEW own kingdom, an already EXISTING faction's king. And I don't noticed anything that could help me with this, because I think this is a totally new function we want to add to our mod. And I don't know so much things about programming that I could add some "new" to the game files.
 
Looking at making a king in a new faction should be the same as making someone a king of an existing faction.  What part are you having trouble with?  The marshal dialog?  Changing which troop is the faction leader?  How to check when talking to the marshal?

 
I actually don't know where to start. I don't have much experience in programming, and I made things that were easy to edit (troops, factions etc. because the example is there, I just had to make it like that), but this is a completely new thing in the game, and I don't know how to make it. Is it difficult?
 
Everything is difficult until you know how. :wink:

You got the first part down.  What causes the change.  In this case, you must have releations with all lords of a faction greater than or equal to 99.  I say this often.  header_operations.py is your friend.  If there is a tool to use, it's there.  It's somewhat in order.  This one wasn't easy to find but it wasn't too hard.  First I searched for relation.  I got a few hits, but playing the game, I'm sure you were looking for something close to this:
talk_info_set_relation_bar

This shows your relation to the person you are talking to.  From there I looked for where a value was checked with this operation:
  #script_setup_talk_info
  # INPUT: $g_talk_troop, $g_talk_troop_relation
  ("setup_talk_info",
    [
      (talk_info_set_relation_bar, "$g_talk_troop_relation"),
      (str_store_troop_name, s61, "$g_talk_troop"),
      (str_store_string, s61, "@ {s61}"),
      (assign, reg1, "$g_talk_troop_relation"),
      (str_store_string, s62, "str_relation_reg1"),
      (talk_info_set_line, 0, s61),
      (talk_info_set_line, 1, s62),
      (call_script, "script_describe_relation_to_s63", "$g_talk_troop_relation"),
      (talk_info_set_line, 3, s63),
  ]),

The I searched for where "$g_talk_troop_relation" was set and I found this:
(troop_get_slot, "$g_talk_troop_relation", "$g_talk_troop", slot_troop_player_relation),

In the end, we find that (and if you knew this already, it's still important to see this process) there are troop and party slots for relations to the player.
What you will need to do is, when talking to the marshal, check this troop slot for all troops (lords) that have the same faction as the marshal.  Have a flag variable that is set to 1.  When looping through the lords, if one of them has a relation less than the mark, set the flag variable to 0.  After the loop, have a condition for one of the dialogs that checks this flag (which could be a new troop slot for the player, or a global variable) variable.  If it's a 1, then you give the dialog to grant the player the kingdom.  If it's 0, then do offer the dialog.

BTW: that search took me about 2 minutes, using notepad ++ and the search files function.
 
I came up with an idea.

Highlander is a very nice guy, and he has released the scource for his mod. Remember that the py files are included in his mod, and are not separate.
It includes kingdom management. Here is a link: Age Of Machinery

Also the SoD team has released a scource for their mod. Version 4.
They are more strict with what you can do and what you can't. But It's worth a shot.
Here is a link: SOURCE for V4

Remember that these men have put their heart and soul into these mods. And remember to ask first!
If you use any of it. CREDIT them.

I wish you the best of luck with your mod.

Nagl
 
Jik, I know that you are very busy, and you have better things to do than answering noobies questions, but can you please write down what should we write into the python files? Something is clear to us now, but not everything, and we aren't professional programmers. You would make us very happy. Please!
 
You'll have to find where the dialog happens with the marshal.  If you are unclear on that, the best way is to play the game, talk with a marshal and search for that dialog.

this is rough work here, so it's more for the idea of the flow of code, I will not commit my name to this working... :wink:

the condition for the dialog to grant you the kingdom should be before any other marshal dialog.  What is being said is up to you.  This is just the basics for the conditions:
[(store_troop_faction,":p_fac","trp_player"),
(store_troop_faction,":this_fac","$g_talk_troop"),
(eq,":p_fac",":this_fac"),                                                                    ##You must be of the same faction
(assign,":pass",1),                                                                              ##if this stays as 1 you can be king
(assign,":last",kingdom_ladies_begin),                                                  ##This allows to end the loop early
(try_for_range,":lords",kingdom_heroes_begin,":last"),
    (store_troop_faction,":test_fac",":lords"),
    (eq,":test_fac",":p_fac"),                                                                ##Only check the lords with the same faction
    (troop_get_slot, ":test_relation", "":lords"", slot_troop_player_relation),
    (try_begin),
        (lt,":rest_relation",95),                                                              ##or whatever value the player needs
        (assign,":pass",0),                                                                    ##If it's not high enough, then fail out
        (assign,":last",kingdom_heroes_begin),                                      ##setting the end point of the loop to the start ends the loop
    (try_end),
    (eq,":pass,1),                                                                                ##if still 1, then you have the right amount of following/relations
]
With this condition for the dialog, if the player has better than 95 relations with all the lords in the faction, then the dialog will be shown.  Now if you have perma death, you will also have to check if the lord is active/alive.  Also, you may have to check if the pretenders are included in the faction count.  I'm not sure about that.
 
You can set what troop is the faction leader like this:

Code:
(faction_set_slot, "fac_kingdom_1",  slot_faction_leader, "trp_kingdom_1_lord"),

However, you'd have to script your own dialog for the player to actually do something useful and interesting once he is king.
 
Thanks for the help jik, but where should we paste this? I know you mentioned header_operations.py earlier but we didn't find anything like what you have wrote down. However we find some things like this in module_scripts.py. Or should we put this in module_dialogs.py? You know we aren't professional programmers and we don't have experience in giving some new to the game without any things that are a guide to us (mentioned yesterday 9:25 p.m.)

Thanks for the help!
 
MickeyMouse14 said:
Thanks for the help jik, but where should we paste this? I know you mentioned header_operations.py earlier but we didn't find anything like what you have wrote down. However we find some things like this in module_scripts.py. Or should we put this in module_dialogs.py? You know we aren't professional programmers and we don't have experience in giving some new to the game without any things that are a guide to us (mentioned yesterday 9:25 p.m.)

Thanks for the help!

Have you gone through my tutorial update yet?  I would start there.  The stuff you are looking to do is not beginner's work.  You should have a bit of understanding of the way the Module System works.  I have a section on dialogs, which would be beneficial to what you want to do.
 
Back
Top Bottom