Assigning faction in character creation menus?

Users who are viewing this thread

Never mind.  I got it to compile.  :lol:  I'll just have to test it out in game when I get a chance.
Lord Leoric of Wercheg said:
Arch3r said:
I pasted this at some of the background choices in the character creation menu.

        (call_script, "script_player_join_faction", "fac_kingdom_1"),
    (assign, "$player_has_homage" ,1),
    (assign, "$g_player_banner_granted", 1),
    (assign, "$g_invite_faction", 0),
    (assign, "$g_invite_faction_lord", 0),
    (assign, "$g_invite_offered_center", 0),
?

fac_kingdom_1 is the name of the.... Vaegirs?  Swadians?  I think Swadians. 
 
Double post but:

Arch3r, your code there gave me like 8 castles and cities at the start of the game so,

("revenge",[],"Join the Eastern Roman Empire",[
                (call_script, "script_player_join_faction", "fac_romans"),
                (town_set_faction, "town_12", "trp_player"),

I'll test it out later and see if it works.

Or of course, I could just get rid of this, right?

(assign, "$g_invite_offered_center", 0),

But then they wouldn't get anything?  I'll test these out. 



 
COGlory said:
Double post but:

Arch3r, your code there gave me like 8 castles and cities at the start of the game so,

("revenge",[],"Join the Eastern Roman Empire",[
                (call_script, "script_player_join_faction", "fac_romans"),
                (town_set_faction, "town_12", "trp_player"),

I'll test it out later and see if it works.

Or of course, I could just get rid of this, right?

(assign, "$g_invite_offered_center", 0),

But then they wouldn't get anything?  I'll test these out.

Ah wait, I had some script for giving a village somewhere too, which would solve it.

EDIT: Here it is, the relocate sets your spawn point, you could leave that out.
The line under that gives a village, you could make a new script for a random village as well.
The last line is needed to make it all work correct.
Code:
           (party_relocate_near_party, "p_main_party", "p_town_31", 0.5),
      (call_script, "script_give_center_to_lord", "p_village_1", "trp_player", 0),
      (call_script, "script_add_log_entry", logent_fief_granted_village, "trp_player",  "p_village_1", "trp_kingdom_6_lord", "fac_kingdom_6"),
 
Arch3r said:
Oh, I dont think town_set_faction excists, it should be party_set_faction I believe.

Then the 2nd operand must be a faction ID, not troop ID. I think "trp_player" is a constant pointing to player's ID and it's value is 0.

I'm sorry for out of topic, but I want to ask. Arc3r, do you know how to remove an agent from a running mission template?
Can 'agent_clear_scripted_mode' be used for it?
 
dunde said:
Arch3r said:
Oh, I dont think town_set_faction excists, it should be party_set_faction I believe.

Then the 2nd operand must be a faction ID, not troop ID. I think "trp_player" is a constant pointing to player's ID and it's value is 0.

I'm sorry for out of topic, but I want to ask. Arc3r, do you know how to remove an agent from a running mission template?
Can 'agent_clear_scripted_mode' be used for it?
agent_clear_scripted_mode is to cancel a scripted destination, so nope.

I don't think it is possible to make agents disappear from a scene.
 
dunde said:
COGlory said:
      (town_set_faction, "town_12", "trp_player"),

I can't find town_set_faction in header_operations.py. What version of module system do you use?

Yeah, I wasn't sure if it existed or not either, that's why I checked, and it didn't work.  :razz:

Thanks for the relocation script, Arch3r, as that will be handy as well.  :smile: 

Must....improve....scripting skills....over.....vacation!

Thanks guys! 
 
For the "Guide of Useful Scripts" thread:


("join_faction_1",[],"Join Faction 1",[
      (call_script, "script_give_center_to_lord", "p_village_1", "trp_player", 0),
      (call_script, "script_add_log_entry", logent_fief_granted_village, "trp_player",  "p_village_1", "trp_kingdom_6_lord", "fac_kingdom_6"),


And a party re-location script:


(party_relocate_near_party, "p_main_party", "p_town_31", 0.5),
 
I am trying to do somethig kinda like COGlory, and I have already done the main coding, but I am trying to make it so that you can go to a select few of the villages relative to the faction. For example I want the player to only spawn near a village in the snow if s/he chooses the go to the veigers, and this is all good, but the only problem is that the villages in the snow are all spread out in the parties list. I was wondering if there is such a script as "store_random_in_list" and then i can list the villages I want to chosen at random from, or if there is a way I can accomplish something similar?
 
Write a script that check the distance of the villages form certain towns (capital of factions) and make the lists.
So if player choose Swadian, then s/he must choose form list of village near the capital of Swadian  faction.
 
The easiest way to do this would be to take a training field, find out which one it is.  (This can be done by taking training_field_1 or whatever it's called, and moving it to the coordinates of Reyvadin, or something, and then seeing which one moved.) Then create a new menu, and make an option "Choose Vaegirs" or the like.  Then add (call_script, "script_player_join_faction", "fac_kingdom_2"), (or whatever Vaegirs is) underneath.  Then under that code add (party_relocate_near_party, "p_main_party", "p_training_field_1", 0.5), or whatever training field you moved.  Then just move the training field to the desire position. 

("join_faction_1",[],"Join Vaegirs",[
      (call_script, "script_player_join_faction", "fac_kingdom_2")
      (party_relocate_near_party, "p_main_party", "p_training_field_1", 0.5)


 
Yea, I thought of doing that, but after this was one of my first module enhancements, and I got basically the code u used below by setting the faction instead of moving them, but that's not the point. By this point in creation I have also tried to incorporate the training into villages and thus i got rid of the training grounds as there was no longer any need for em. But from the fact that no one has answered my question directly, would that mean that everyone is secretly telling me that there is no way that you can make a list?
 
eagles_rule_der said:
Yea, I thought of doing that, but after this was one of my first module enhancements, and I got basically the code u used below by setting the faction instead of moving them, but that's not the point. By this point in creation I have also tried to incorporate the training into villages and thus i got rid of the training grounds as there was no longer any need for em. But from the fact that no one has answered my question directly, would that mean that everyone is secretly telling me that there is no way that you can make a list?
Think positive, my friend.. When members of the forum don't give the direct answers, just clues then may be they encourage you to find the way by yourself. You did it with the training in village before, remember..
Ok, what list do you want now? Villages with certain trrrain type, or belonged to factions? I'm studying about arrays now, so may be it can be implemeted here.
Here is my example to make a list of village that on the snow.

Just make a dummy troop on module_troops.py :
Code:
  ["village_list","Village List on Snow","Village List on Snow",tf_hero,no_scene,reserved,fac_commoners,[],def_attrib,0,knows_common|knows_inventory_management_10,0],

Ok, here we make the list :
Code:
   (troop_set_slot, "trp_village_list", 0, 0),           # Empty List
   (assign, ":list_no", 0),
   (try_for_range, ":village_no", villages_begin, villages_end),
      (party_get_current_terrain, ":terrain_type", ":village_no"),
      (eq, ":terrain_type",rt_snow),          # if the terrain is snow, then put it on the list   
      (val_add, ":list_no", 1),
      (troop_set_slot, "trp_village_list", ":list_no", ":village_no"),   
   (try_end),
   (troop_set_slot, "trp_village_list", 0,":list_no"),    #slot 0 is the length of list


How to access? To get the list nomber list_no :
Code:
    (troop_get_slot, ":length", "trp_village_list", 0),
    (try_begin),
       (gt, ":list_no, 0),
       (ge, ":length", ":list_no"),   
       (troop_get_slot, ":village", "trp_village_list", ":list_no"),
    (else_try),
       (assign, ":village", -1),   
    (try_end),

I'm sure you can do the rest (making the menu for player to choose from that list).
 
dunde said:
Think positive, my friend.. When members of the forum don't give the direct answers, just clues then may be they encourage you to find the way by yourself.
This. It is the essence of modding. Unless you can do this, you're in for a hard time. If you can however, you'll find tons of helpful hints and tidbits everywhere.




Not to interrupt your fine explanations, dunde.  :wink:
 
Thanks alot peoples, but it's not quite what I was going at.
What I am trying to use is the "relocate_near_party" code, but I have made it so that players party relocates near "$starting_town".

What I want to do is make it so that, if you choose faction X, that it will set "$starting_town" to either "p_village_x", "p_village_y" or "p_village_z", while in the parties list there maybe "p_village_m" inbetween "p_village_y" and "p_village_z" (therefore canceling the ability for a range code), where they all have noting in common really, but are just the towns I want you to spawn around.

Eg, the nords. I want you to spawn west of the river, thus the only thing that they have in common is that they are less than a certain value of the x co-ordiante (or y depending), but that is not what I want, maybe i want it so that you can go to any west of the river except 2.

All i want is to know if there is a way that I can make a list of my own without any actual "prerequisites" (aka in the nordic faction, east of sargoth, on snowy terrain, ect.) I just want to make a list.
 
If you want different classification to determine which village included to your criteria, you can change this part :
      (party_get_current_terrain, ":terrain_type", ":village_no"),
      (eq, ":terrain_type",rt_snow),          # if the terrain is snow, then put it on the list 

Just get the faction of the village, check if the same with the faction the player choose, and enter the village to the list.

You then can select from the list by random :
  (troop_get_slot, ":upperlimit", ":village_list", 0),
  (val_add, ":upperlimit", 1),
  (store_random_in_range, ":rand", 1, ":upperlimit"),
  (troop_get_slot, ":village", ":village_list", ":rand"),
  (party_relocate_near_party,"p_main_party",":village",3),


BTW,  If you want you can rearrange the parties on the module_parties.py as long as you put the towns_begin , towns_end, etc to the right place. (Warning : No Save Compatible)
 
Back
Top Bottom