Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
TheCaitularity said:
Is there a way I can assign a specific title for each faction to each lord in the game?

For example, Lord Haringoth joins the Nords and becomes Hersir Haringoth, Count Klargus joins Nords and becomes Jarl Klargus, etc.

sure. You have a operation to change NPCs names, so if you use the plural entry for the actual name (like "John"), you can then use the singular entry for the full name ("Baron John"), and update it as you go.

you should find a OSP for this if you look in the OSP section. VC also has this system working, if you want to look at the VC code.

Remember to:
1) define the basic rule for the titles (by culture, by faction, etc)
2) define ranks (king, lower ranks). A example: VC has king, noble with land, noble without land (no castle/town), or in other words, 3 ranks
3) update the titles when a lord changes factions, when it gains land, etc. A simple trigger can do that, or you can call the script on the appropriate events
4) keep in mind it may become hard to find lords on your Notes. It would be a good idea to filter it by faction.

VC script is "script_troop_set_title_according_to_faction"



asierus said:
faction gets destroyed
this is a Native rule defined on the modsys. As it is not hardcoded, all you need to do is capture the event (locate the trigger/script) and add a exception (new rule) to your invading faction.
 
Kortlcha said:
Hi,
I added new models to game. I'm getting 90-120 fps normallu at 150vs150 battle. But when I ook to soldiers with new models, getting 8-15 fps. How can  solve this problem?

It could be any number of things. The most obvious is to generate lods for them if they don't already have them (right click on it in OpenBRF and select "Compute LODs").
 
Cozur said:
Anyone know why the above should sometimes cause infinite reinforcements? (I haven't been able to replicate that particular bug myself).

Code:
(try_begin),
        (lt, ":total_enemy_reinforcements", 15),
        (ge, "$defender_reinforcement_stage", 2),
        (eq, "$defender_reinforcement_limit_increased", 0),
        (val_add, "$g_defender_reinforcement_limit", 1),                    
        (assign, "$defender_reinforcement_limit_increased", 1),
      (try_end),    
      #new (25.11.09) ends
      
      (lt,"$defender_reinforcement_stage","$g_defender_reinforcement_limit"),
                 (store_mission_timer_a,":mission_time"),
                 (ge,":mission_time",10),
                 (store_normalized_team_count,":num_defenders", 0),
                 (lt,":num_defenders",6)],
           [(add_reinforcements_to_entry,0,7),(assign, "$defender_reinforcement_limit_increased", 0),(val_add,"$defender_reinforcement_stage",1)]),
this part is doing a infinite loop, it will only stop if the end battle trigger fires first

Code:
   (1, 0, 5, [(lt,"$attacker_reinforcement_stage", "$g_reinforcement_stage"), ## CC
                 (store_mission_timer_a,":mission_time"),
                 (ge,":mission_time",10),
                 (store_normalized_team_count,":num_attackers", 1),
                 (lt,":num_attackers",6)],
           [(add_reinforcements_to_entry,3,7),(val_add,"$attacker_reinforcement_stage",1)]),
missing the definition for $g_reinforcement_stage
 
Hi,
When I add this codes;
(
"project_garrison_to_town",
[
  (store_script_param, ":town", 1),
  (store_faction_of_party, ":faction",":town"),
  (party_get_slot, ":time", ":town", slot_barrack_infantry_recruit_time),
  (faction_get_slot, ":zero_grade", ":faction", slot_faction_kingdom_infantry_0),
  (faction_get_slot, ":eek:ne_grade", ":faction", slot_faction_kingdom_infantry_1),
  (faction_get_slot, ":two_grade", ":faction", slot_faction_kingdom_infantry_2),
  (faction_get_slot, ":three_grade", ":faction", slot_faction_kingdom_infantry_3),
  (party_get_slot, ":level", ":town", slot_infantry_barrack_level),
  (store_current_hours, ":hours"),
  (try_begin),
  (eq, ":level", 0),
  (assign, ":recruit", ":zero_grade"),
  (assign, ":time_to_recruit", 120),
  (else_try),
  (eq, ":level", 1),
  (assign, ":recruit", ":eek:ne_grade"),
(assign, ":time_to_recruit", 1200),
  (else_try),
  (eq, ":level", 2),
(assign, ":recruit", ":two_grade"),
(assign, ":time_to_recruit", 3600),
(else_try),
(eq, ":level", 3),
(assign, ":recruit", ":three_grade"),
(assign, ":time_to_recruit", 7200),
(try_end),
  (try_begin),
  (eq, ":time", 0),
  (val_add, ":hours", ":time_to_recruit"),
(party_set_slot, ":town", slot_barrack_infantry_recruit_time, ":hours"),
(party_set_slot, ":town", slot_town_infantry_recruit_unit, ":recruit"),
  (display_message, "@Units selected by towns."),
  (else_try),
  (gt, ":time", 0),
  (party_get_slot, "recruit_of_unit", ":town", slot_town_infantry_recruit_unit),
  (store_current_hours, ":hur"),
  (party_get_slot, ":selected_time", ":town", slot_barrack_infantry_recruit_time),
  (gt, ":hur", ":seleceted_time"),
  (party_set_slot, ":town", slot_barrack_infantry_recruit_time, 0),
  (party_force_add_members, ":town", ":recruit_of_unit", 100),
  (display_message, "@Units added to town"),
  (try_end),
]),
Game giving that error:
https://i.hizliresim.com/ByXW6j.jpg
Hoe can I fix it?
 
Kortlcha said:
Hoe can I fix it?

start by understanding the error message:

SCRIPT ERROR ON OPCODE -> a operation (header_operations.py) was trying to do something, but it got invalid parameters and it failed
OPCODE 1613 -> open header_operations.py and find this code, that will give you the operation. Read the documentation and check if you made any mistakes with it
INVALID TROOP ID = -1  -> that is your invalid parameter. Troops (as you can see on ID_troops.py) go from 0, 1, 2, ... so a -1 doesn't exist
LINE NO 39 -> 40th line of code. Count from line 0 (0, 1, 2, ...) and find that line. It should match the operation above (1613).

ps.: fix your indentation as that helps to read and understand code
 
Kortlcha said:
Hi,
When I add this codes;
(
"project_garrison_to_town",
[
  (store_script_param, ":town", 1),
  (store_faction_of_party, ":faction",":town"),
  (party_get_slot, ":time", ":town", slot_barrack_infantry_recruit_time),
  (faction_get_slot, ":zero_grade", ":faction", slot_faction_kingdom_infantry_0),
  (faction_get_slot, ":eek:ne_grade", ":faction", slot_faction_kingdom_infantry_1),
  (faction_get_slot, ":two_grade", ":faction", slot_faction_kingdom_infantry_2),
  (faction_get_slot, ":three_grade", ":faction", slot_faction_kingdom_infantry_3),
  (party_get_slot, ":level", ":town", slot_infantry_barrack_level),
  (store_current_hours, ":hours"),
  (try_begin),
  (eq, ":level", 0),
  (assign, ":recruit", ":zero_grade"),
  (assign, ":time_to_recruit", 120),
  (else_try),
  (eq, ":level", 1),
  (assign, ":recruit", ":eek:ne_grade"),
(assign, ":time_to_recruit", 1200),
  (else_try),
  (eq, ":level", 2),
(assign, ":recruit", ":two_grade"),
(assign, ":time_to_recruit", 3600),
(else_try),
(eq, ":level", 3),
(assign, ":recruit", ":three_grade"),
(assign, ":time_to_recruit", 7200),
(try_end),
  (try_begin),
  (eq, ":time", 0),
  (val_add, ":hours", ":time_to_recruit"),
(party_set_slot, ":town", slot_barrack_infantry_recruit_time, ":hours"),
(party_set_slot, ":town", slot_town_infantry_recruit_unit, ":recruit"),
  (display_message, "@Units selected by towns."),
  (else_try),
  (gt, ":time", 0),
  (party_get_slot, "recruit_of_unit", ":town", slot_town_infantry_recruit_unit),
  (store_current_hours, ":hur"),
  (party_get_slot, ":selected_time", ":town", slot_barrack_infantry_recruit_time),
  (gt, ":hur", ":seleceted_time"),
  (party_set_slot, ":town", slot_barrack_infantry_recruit_time, 0),
  (party_force_add_members, ":town", ":recruit_of_unit", 100),
  (display_message, "@Units added to town"),
  (try_end),
]),
Game giving that error:
https://i.hizliresim.com/ByXW6j.jpg
Hoe can I fix it?

You are trying to get a slot that contains nothing.

Code:
(party_get_slot, "recruit_of_unit", ":town", slot_town_infantry_recruit_unit),
and
Code:
(party_force_add_members, ":town", ":recruit_of_unit", 100),

Btw It seems you missed this local variable prefix:

(party_get_slot, ":recruit_of_unit", ":town", slot_town_infantry_recruit_unit),
 
anyone knows how to (if possible) disable specific lords/king armies using a timed trigger? i know you can disable villages/castles/towns with for example this:

  (24, 0, ti_once, [], [(party_set_flags, "p_village_115", pf_disabled, 1)]),

but its there a  way to do it with king/lods armies to then enable them again when specific hours has passed??.

thanks in advance.
 
asierus said:
anyone knows how to (if possible) disable specific lords/king armies using a timed trigger? i know you can disable villages/castles/towns with for example this:

  (24, 0, ti_once, [], [(party_set_flags, "p_village_115", pf_disabled, 1)]),

but its there a  way to do it with king/lods armies to then enable them again when specific hours has passed??.

are you talking about the re-spawn process? When a lord gets defeated/start of a new campaign and it starts from home? Or are you talking about something else?

In any way what you need to do is add a exception rule to whatever process (like a trigger) you want to control. And a troop slot (for the lord/leader) to use as a flag (ON/OFF).
 
kalarhan said:
asierus said:
anyone knows how to (if possible) disable specific lords/king armies using a timed trigger? i know you can disable villages/castles/towns with for example this:

  (24, 0, ti_once, [], [(party_set_flags, "p_village_115", pf_disabled, 1)]),

but its there a  way to do it with king/lods armies to then enable them again when specific hours has passed??.

are you talking about the re-spawn process? When a lord gets defeated/start of a new campaign and it starts from home? Or are you talking about something else?

In any way what you need to do is add a exception rule to whatever process (like a trigger) you want to control. And a troop slot (for the lord/leader) to use as a flag (ON/OFF).

i have a new faction that is an invader faction and i want to disable their lords and king at start of game, and then after a time enable them to simulate the invasion.
 
asierus said:
i have a new faction that is an invader faction and i want to disable their lords and king at start of game, and then after a time enable them to simulate the invasion.

you can do this in a few different ways, see what is easier (in case you can't find a OSP for invasion code).

a example is to disable your faction and add a rule to stop lords from defecting it. Then at some point you can start the invasion event, enable the faction, spawn the lords and all that.

keep in mind you shouldn't do this

(24*500,0,0, [],[])
as your event trigger (wait 500 days). You should instead use the operation to check current date, and use it as the condition (for a dynamic process), or use the re-arm timer (if static)
 
kalarhan said:
sure. You have a operation to change NPCs names, so if you use the plural entry for the actual name (like "John"), you can then use the singular entry for the full name ("Baron John"), and update it as you go.

you should find a OSP for this if you look in the OSP section. VC also has this system working, if you want to look at the VC code.

Remember to:
1) define the basic rule for the titles (by culture, by faction, etc)
2) define ranks (king, lower ranks). A example: VC has king, noble with land, noble without land (no castle/town), or in other words, 3 ranks
3) update the titles when a lord changes factions, when it gains land, etc. A simple trigger can do that, or you can call the script on the appropriate events
4) keep in mind it may become hard to find lords on your Notes. It would be a good idea to filter it by faction.

Aha, thanks karlarhan! Found the OSP code kit you were referring to, hopefullyu compatible with Diplomacy although I'm sure I'll figure it out.
 
I'm working on moving a few agents in siege. I made a new trigger that I then added - it is called every 20 second.

It gets the position I set the agents to move to.

However, it seems they refuse to move to the position. They just walk to their default siege positions. The trigger is added and is running. The prop gives the correct positional values for where it is, all defender agent numbers are correct, and so on.

The script itself seems to work flawlessly (all data is correct) - displayed all values a lot of times. However, nothing happens when I run it. Any ideas to why?


Edit: Seems that the triggers that used team_give_order and team_set_order_position stands above any agent_set_scripted_destination.
 
I have created a branch in the dialogue for the armour merchant in towns to access a new inventory using

Code:
(change_screen_trade, "trp_kingdom_1_merchant"),


But he still accesses his own inventory as if just using

Code:
(change_screen_trade),


Any suggestions or I am I just using this function wrong?


I have created a trigger and script to first clear the trp_kingdom_1_merchant's inventory and add new items.
 
Status
Not open for further replies.
Back
Top Bottom