Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Khamukkamu said:
I can put any item mod on any item, right? It's not restricted by item type?

Like I can put "rotten" on an armour, or a "lame" on a sword? :smile:

If I can, will the effects of 'lame' occur on the sword? (i am assuming not, but you never know!)
of course


Create an item name it "rotten Armor"
and here are two triggers you can use to make your custom behavior
Code:
ti_on_init_item                                   = -50.0
# trigger param 1: agent id
# trigger param 2: troop id


ti_on_weapon_attack                               = -51.0
# trigger param 1: attacker agent id
# pos1: weapon item position
 
Khamukkamu said:
If I can, will the effects of 'lame' occur on the sword? (i am assuming not, but you never know!)

never tried for the recover effect. As this is handled inside the engine for lame horses on your inventory, you will need to try it yourself

why would you have a lamer/rotten sword is another story...  :lol: (jk, you could use the imod with a different name, even if its weird hehe)
 
Arthur_Pendragon said:
Its not native its a completely rewritten module system.
There is no troop selection instead the bot is Spawned in
Code:
def itm_bot_roman_spawn():
  return (ti_on_missile_hit, 
   [(multiplayer_is_server),
    (store_trigger_param_1, ":shooter_agent"),
    (agent_get_player_id, ":player_id", ":shooter_agent"),
    (assign, ":min", 500),
    (player_get_gold, ":gold_amount", ":player_id"),
    (try_begin),
        (gt, ":gold_amount", ":min"),
        (player_is_admin, ":player_id"),
        (set_spawn_position, pos1),
        (spawn_agent, "trp_roman_bot"),
        (agent_set_group, reg0, ":player_id"),
        #(try_for_agents, ":bot_agents"),
         #   (agent_is_non_player, ":bot_agents"),
          #  (agent_get_troop_id, ":troop_id", ":bot_agents"),
           # (eq, ":troop_id", "trp_roman_bot"),
        (agent_set_team, reg0, team_bot_roman),
        (agent_set_wielded_item, reg0, -1),
        (val_sub, ":gold_amount", ":min"),
        (player_set_gold, ":player_id",":gold_amount"),
Check if the specific agents still have the correct group id before giving orders... add debug messages to track it.

troycall said:
If I would like this to work in multiplayer, do I only have to switch the get_player_agent_no operation to agent_get_player_id operation?
also, does agent_get_team work in multiplayer?
No.
You would need to write a server event to do so.
Your trigger is client side ofc, but you have to call the server to execute the animation, otherwise it wont synce to other clients.

agent_get_team works on multiplayer aswell.

 
_Sebastian_ said:
Arthur_Pendragon said:
Its not native its a completely rewritten module system.
There is no troop selection instead the bot is Spawned in
Code:
def itm_bot_roman_spawn():
  return (ti_on_missile_hit, 
   [(multiplayer_is_server),
    (store_trigger_param_1, ":shooter_agent"),
    (agent_get_player_id, ":player_id", ":shooter_agent"),
    (assign, ":min", 500),
    (player_get_gold, ":gold_amount", ":player_id"),
    (try_begin),
        (gt, ":gold_amount", ":min"),
        (player_is_admin, ":player_id"),
        (set_spawn_position, pos1),
        (spawn_agent, "trp_roman_bot"),
        (agent_set_group, reg0, ":player_id"),
        #(try_for_agents, ":bot_agents"),
         #   (agent_is_non_player, ":bot_agents"),
          #  (agent_get_troop_id, ":troop_id", ":bot_agents"),
           # (eq, ":troop_id", "trp_roman_bot"),
        (agent_set_team, reg0, team_bot_roman),
        (agent_set_wielded_item, reg0, -1),
        (val_sub, ":gold_amount", ":min"),
        (player_set_gold, ":player_id",":gold_amount"),
Check if the specific agents still have the correct group id before giving orders... add debug messages to track it.

troycall said:
If I would like this to work in multiplayer, do I only have to switch the get_player_agent_no operation to agent_get_player_id operation?
also, does agent_get_team work in multiplayer?
No.
You would need to write a server event to do so.
Your trigger is client side ofc, but you have to call the server to execute the animation, otherwise it wont synce to other clients.

agent_get_team works on multiplayer aswell.


Code:
 Roman agent ID 13 = 13, Roman group id = 2, Controllayer player id = 2
 Roman agent ID 15 = 15, Roman group id = 2, Controllayer player id = 2
 Roman agent ID 12 = 12, Roman group id = 2, Controllayer player id = 2
 
Bit of a noob question, but wanted to make sure.

module_parties.py defines the faction of towns.

When a town/castle changes hands, I assume that it will no longer be what is defined in module_parties?

For example, town_a is defined as fac_a. It gets conquered by fac_b. So if I visit it and check (eq, "$g_encountered_party, fac_b), it should return True?
 
Khamukkamu said:
So if I visit it and check (eq, "$g_encountered_party, fac_b), it should return True?

operation is about the current value, so you are correct.

You do have a slot that stores the original faction as well (used on intrigues for casus bellis)
 
how do you give a polearm item its length dpending on the brf.
for instance..i do not know what value of weapon length to put on module_items...because i do not know the actual length of it ingame
 
Does anyone have any idea why in the world no agent is being added to the scene????
at this point im ready to jump out my window.
Code:
def itm_bot_roman_spawn():
  return (ti_on_missile_hit, 
   [(multiplayer_is_server),
    (store_trigger_param_1, ":shooter_agent"),
    (agent_get_player_id, ":player_id", ":shooter_agent"),
    (store_current_scene, ":cur_scene"),
    (modify_visitors_at_site, ":cur_scene"),
    (assign, ":entry_point", 1),
    (add_visitors_to_current_scene, ":entry_point", "trp_roman_bot", 1, team_bot_roman, ":player_id"),
    (assign, ":min", 500),
    (player_get_gold, ":gold_amount", ":player_id"),
    (try_begin),
        (gt, ":gold_amount", ":min"),
        (player_is_admin, ":player_id"),
        (add_visitors_to_current_scene, ":entry_point", "trp_roman_bot", 1, team_bot_roman, ":player_id"),
        (val_sub, ":gold_amount", ":min"),
        (player_set_gold, ":player_id",":gold_amount"),
    (else_try),
        (multiplayer_send_string_to_player, ":player_id", server_event_local_chat, "@You Cant afford those troops!"),
    (try_end),
    ])
[edit] i know i have add visitors twice i was just playing around where to put see if it made a difference.
 
meminimina said:
how do you give a polearm item its length dpending on the brf.
for instance..i do not know what value of weapon length to put on module_items...because i do not know the actual length of it ingame

BRF has a rule for measures



Arthur_Pendragon said:
Does anyone have any idea why in the world no agent is being added to the scene????
at this point im ready to jump out my window.
I don't mod MP, so won't comment on that. However, you could add debug messages (display_message) to see what is working, and what is not. Don't hope for the best, test it
 
Hello!

This problem has persisted for a while now, and I still haven't found a fix.

I've implemented the ability to customize regular troops, but once I reload my save they revert back to their original inventory, losing all of their new equipment. The method to which I am using is through dialogue, I've copied and pasted the companion inventory swap dialogue, and made it work with regular troops. Does anyone know what the problem is?
 
Hello everyone,

I am working at a new mod for my enjoyment and maybe for a release aswell.

I encountered a very strange bug ,and couldn't find any fix on the internet so far, or at least root cause.

Enemy lords won't attack me or run from me. Bandits have a normal behaviour ( run or attack) but enemy lords or kings just mind their own business without attacking me even if they outnumber me greatly.

I m thinking this might be caused by some Ai initiative or anything.
Can someone please help me with this??


I am using Native module compilation as base
 
Got another question, is it possible to change the agent's position (of the player) where it ends up when mounting a horse?

In my case I would like to make the 'mount-position' of the player higher for using a Elephant.
 
kalarhan said:
meminimina said:
how do you give a polearm item its length dpending on the brf.
for instance..i do not know what value of weapon length to put on module_items...because i do not know the actual length of it ingame

BRF has a rule for measures


Arthur_Pendragon said:
Does anyone have any idea why in the world no agent is being added to the scene????at this point im ready to jump out my window.
I don't mod MP, so won't comment on that. However, you could add debug messages (display_message) to see what is working, and what is not. Don't hope for the best, test it

You dont think i've been testing?
The reason there is not debug message is because
Code:
        (val_sub, ":gold_amount", ":min"),
        (player_set_gold, ":player_id",":gold_amount"),

That piece of code runs and thats in the same try block after the add visitors
 
Arthur_Pendragon said:
You dont think i've been testing?
The reason there is not debug message is because
[/size][/font]
Code:
        (val_sub, ":gold_amount", ":min"),
        (player_set_gold, ":player_id",":gold_amount"),

That piece of code runs and thats in the same try block after the add visitors

I don't have a crystal ball and I can't read minds. So I don't know what you did or didn't do, just what you told us, which was very little  :razz:. It was a suggestion, you should detail all that you know, including your testing results, so other people may help you figure out the next step. For example, why didn't you mention that above earlier? Its all in the details.
 
kalarhan said:
Arthur_Pendragon said:
You dont think i've been testing?
The reason there is not debug message is because
Code:
        (val_sub, ":gold_amount", ":min"),
        (player_set_gold, ":player_id",":gold_amount"),

That piece of code runs and thats in the same try block after the add visitors

I don't have a crystal ball and I can't read minds. So I don't know what you did or didn't do, just what you told us, which was very little  :razz: . It was a suggestion, you should detail all that you know, including your testing results, so other people may help you figure out the next step. For example, why didn't you mention that above earlier? Its all in the details.
Yes i suppose, i apologize Kalarhan i've just been up 24 hours trying to figure it out my head inst in the right place. Im gonna take a small break and come back to it.
Thank you for trying to help  :smile:
 
Right so I've made this code, and I would like to know how to make it dynamic *So that I can change the Z axis value or that the trigger won't fire is agent with the shield is on a horse*, as right now it only looks right if the agent is not on a horse.

There are two way to remedy this issue, two possible solutions are:
A. prevent the effect from playing if agent is on a horse,
B. or move the Z axis if agent is on a horse.

Note that, I know agent_get_scale could work perfectly as a solution, however it gives me item slot no errors, thus I can't use it, I do not know why its causing that error.
Code:
		[(ti_on_shield_hit,
		[
		(store_trigger_param_1, ":trigger_param_1"),
		#(agent_get_scale, pos1, ":trigger_param_1", 13),
        (agent_get_position, pos1, ":trigger_param_1"), #Get Agent Position
		#Not needed
	        #(position_transform_position_to_parent, pos3, pos2, pos1),
       (position_move_z, pos1, 90),
       (position_move_x, 3, 10),
       (position_move_y, pos1, 100), #10 def
		#(store_random_in_range, ":psys_to_use", "psys_lanse", "psys_lanse_blood"), #We use this instead if we want dummy_straw_big to have a chance.
		#Not needed
		(store_random_in_range, ":random_effect_in_range", 1, 500), #Randomize smoke size between  3 to 6, for props this is set to 3.
		(store_random_in_range, ":psys_to_use", "psys_lanse", "psys_dummy_straw_big"), #We probably don't want to include dummy_straw_big, so we ignore it in this one
		
		(particle_system_burst, "psys_dummy_smoke", pos1, ":random_effect_in_range"), #We want smoke randomized sizes.
		(particle_system_burst, ":psys_to_use", pos1, 2), #We want particle effects randomized for the actual shield.
		###Other options###
		#(particle_system_burst, "psys_dummy_straw", pos1, ":random_effect_in_range"), #We want particle effects randomized for the actual shield.
		#(particle_system_burst, "psys_lanse", pos1, 10),
                #(particle_system_burst, "psys_lanse_straw", pos1, 30)
		###Other Options###
		])]
		
		],

What would be a good way to achieve this with minimal performance impact?
Would agent_get_rider work in here without much of a performance impact? considering that the trigger fires every time a shield is hit, if we use agent_get_rider wouldn't that loop through all the agents, every time someone-s shield gets hit?
 
Is it possible  that the mod's options would influence the actual game settings?

For example ingame is set on normal, but the mod is made on easy.

Enemy lords don't attack me , only bandits, and I remember the guy who made the mod ( native module compilation) saying he was playing on easy.

Also the battle size was around 300 ,even tho i have it set on 150.

Is it possible that a mod could interfere with ur options?
Or do you know by any chance why an enemy lord would ignore me?
 
Marius Aetius said:
Is it possible that a mod could interfere with ur options?
Or do you know by any chance why an enemy lord would ignore me?

hey @Marius.

First thing: you should not post around the forum like crazy. You have 5 posts (4 threads) already, on the same subject. That is against forum rules. Moreover, you shouldn't bump you own question here (Q&A thread) after a few hours, unless you want to be ignored. Be patient young padawan  :smile:

Easy/normal/hard has gameplay effects. Your mod can also do custom effects based on the player choice. So yes, that has influence. How much and where? You need to check your mod, as each one is different.

Lords not attacking? Check the mutual relation (faction) between them and yours.

Also you need to include details. Say you are modding something, and stuff doesn't work, that doesn't give us much to work with. What did you change. How. Where is your code. Which game are you working on. Which version. And so on. Modding is done bit by bit. Are you working on .txt files, or .py files?

To check relations:
Code:
store_relation                  = 2190  # (store_relation, <destination>, <faction_id_1>, <faction_id_2>),
                                        # Retrieves relation between two factions. Relation is in -100..100 range.
--> download Lav's module for better documentation. Links and all that on the sticky threads you should read here in the Forge.
 
Status
Not open for further replies.
Back
Top Bottom