Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
kalarhan said:
Native behavior is mostly hardcoded.

you can look at Formations code on VC modsys for a way to override it and implement your own custom behaviors. Other kits can be found on OSP section.

Thanx kalarhan I will look at it. I suppose it will be in mission templates
 
kalarhan said:
see header_xxx.py for the engine options

header_triggers.py
Code:
ti_on_order_issued            = -71.0 # An agent has issued a tactical order
    # trigger param 1 = order_code (see mordr_* constants in header_mission_templates.py)
    # trigger param 2 = agent_id

Thank you for the info but I don't see how to use this in my situation. I can make it check whenever an order is issued but... how do I know which order is being issued? Do I have to create a different mission template for each order? Also once I have this mission template(s) how do I use it? Where do I reference it? None of the guides I have seen or been directed to have any information on this.

Edit:
I have a mission template that should work, thank you kalarhan.
Code:
voice_commands = (
  ti_on_order_issued, 0, 1, [],
    [(get_player_agent_no, ":player"),
	(store_trigger_param_1, ":order"),
	(try_begin),
	  (eq, ":order", "mordr_charge"),
	  (agent_play_sound, ":player", "snd_order_charge"),
	(try_end),
    ],
)

However, it just doesn't. I know I'm missing something in terms of calling or referencing this so can anyone help?
 
MaHuD said:
Is it possible to do something like str_equals without using WSE?
Should the eq command work when comparing two strings?

Code:
(eq, s9, s8),
This code will compare 8 and 9, not the content of strings.
s8 and s9 (or - another example - pos8 and pos9) are just constants.
Only when you treat them as strings/positions using special operations, they work as ones.
 
Bustah said:
However, it just doesn't. I know I'm missing something

See how you used quotes on your constant for charge.

A example on how to write this trigger for better performance
Code:
 (ti_on_order_issued, 0, 0,
    [
      (store_trigger_param, ":order_no", 1),
      (assign, reg7, ":order_no"),
      (eq, ":order_no", mordr_charge),
    ],
    [
      (try_for_agents, ":agent"),
        (agent_get_troop_id, ":agent_troop", ":agent"),
        (eq, ":agent_troop", "trp_todos_cuerno"),	#hornman
        (store_random_in_range, ":rand", 0, 2),
        (eq, ":rand", 1),
        (call_script, "script_agent_perform_horn", ":agent"),
      (end_try),
  ]),

In essence note how it checks the condition first. The trigger has 2 blocks.
 
Leonion said:
MaHuD said:
Is it possible to do something like str_equals without using WSE?
Should the eq command work when comparing two strings?

Code:
(eq, s9, s8),
This code will compare 8 and 9, not the content of strings.
s8 and s9 (or - another example - pos8 and pos9) are just constants.
Only when you treat them as strings/positions using special operations, they work as ones.
Thank you Leonion!
Instead of s8 and s9 I have replaced them with actual str, but it doesn't seem to work either. What sort of special operations are you talking about? The header_operations doesn't seem to show any.
 
kalarhan said:
See how you used quotes on your constant for charge.

Thank you very much. I have actually reworked my code since that post to this

Code:
#voice commands start
#voice_commands bustah adds audio to all in game orders
voice_commands = (
  ti_on_order_issued, 0, 1, [(store_trigger_param_1, ":order"),
  (this_or_next|eq, ":order", mordr_charge,
   eq, ":order", mordr_follow)],
    [
	(store_trigger_param_1, ":order"),
    (store_trigger_param_2, ":agent"),
	(try_begin),
	  (eq, ":order", mordr_charge),
	  (assign, ":order", "snd_order_charge"),
	(else_try),
	  (eq, ":order", mordr_follow),
	  (assign, ":order", "snd_order_follow"),
	(try_end),
	(call_script, "script_play_voice_command", ":agent", ":order"),
    ],
)
#voice commands end

and the accompanying script...

Code:
	#play voice command begin
	#play_voice_command bustah script to play voice orders from mission template
	("play_voice_command",
	[
	  (store_script_param, ":player_agent", 1),
	  (store_script_param, ":command", 2),
	  (agent_play_sound, ":player_agent", ":command"),
	]),
	#play voice command end

And it works great! The delay of 1 second is also perfect because it doesn't feel gamey (by letting you spam) but also doesn't feel constricted (by having to wait some arbitrary time to yell "Charge!" again)

It's rudimentary but I'm kinda proud  :lol:.

"mordr_charge" being in quotes was my last issue, so thank you kalarhan for sparing me an aneurism trying to figure out why the hell "mordr" is not a valid tag.

If you have any more tips on making it more efficient or whatever feel free to let me know.
 
Bustah said:
voice_commands = (
  ti_on_order_issued, 0, 1, [(store_trigger_param_1, ":eek:rder"),
  (this_or_next|eq, ":eek:rder", mordr_charge,
  eq, ":eek:rder", mordr_follow)],
you are missing the closing ")" there. Each operation is a Python tuple, so it must be inside a "(  )"

Bustah said:
  (this_or_next|eq, ":eek:rder", mordr_charge),
  (eq, ":eek:rder", mordr_follow)],

check how to do proper indentation of your code, it will help make it more readable. VC modsys, as a example, has a more advanced version of process_line_correction.py, you could check that out (it will require some clean-up of your modsys to apply the automatic process, but it is worth it)

https://github.com/KalarhanWB/VC_Tweaks_Tool/blob/master/app/process_line_correction.py
https://github.com/KalarhanWB/VC_Tweaks_Tool/blob/master/app/line_correction.bat


a example of a file with proper indentation https://raw.githubusercontent.com/KalarhanWB/VC_Tweaks_Tool/master/app/module_mission_templates.py
 
Hello,
Is there an operator (or a script) to make agent re-putting his shield behind his back, executing the command "equip next shield" (mouse scroll down)?
 
kalarhan said:
Bustah said:
voice_commands = (
  ti_on_order_issued, 0, 1, [(store_trigger_param_1, ":eek:rder"),
  (this_or_next|eq, ":eek:rder", mordr_charge,
  eq, ":eek:rder", mordr_follow)],
you are missing the closing ")" there. Each operation is a Python tuple, so it must be inside a "(  )"

Bustah said:
  (this_or_next|eq, ":eek:rder", mordr_charge),
  (eq, ":eek:rder", mordr_follow)],

check how to do proper indentation of your code, it will help make it more readable. VC modsys, as a example, has a more advanced version of process_line_correction.py, you could check that out (it will require some clean-up of your modsys to apply the automatic process, but it is worth it)

https://github.com/KalarhanWB/VC_Tweaks_Tool/blob/master/app/process_line_correction.py
https://github.com/KalarhanWB/VC_Tweaks_Tool/blob/master/app/line_correction.bat


a example of a file with proper indentation https://raw.githubusercontent.com/KalarhanWB/VC_Tweaks_Tool/master/app/module_mission_templates.py

Yeah my code looks like that in Notepad++ it just copies into here weirdly. I've based all of my indentation and syntax on the rest of the code and all of my stuff is working great and looks smooth  :smile:
 
fladin said:
Hello,
Is there an operator (or a script) to make agent re-putting his shield behind his back, executing the command "equip next shield" (mouse scroll down)?
You mean when an agent has 2 shields?

Does this not work (I don't know, never tried it myself)?
Code:
agent_set_wielded_item                   = 1747  # (agent_set_wielded_item, <agent_id>, <item_id>),
                                                 # Forces the agent to wield the specified item. Agent must have that item in his equipment for this to work. Use item_id = -1 to unwield any currently wielded item.
agent_equip_item                         = 1779  # (agent_equip_item, <agent_id>, <item_id>, [weapon_slot_no]),
                                                 # Adds the specified item to agent and forces him to equip it. Optional weapon_slot_no parameter is only used with weapons and will put the newly added item to that slot (range 1..4). If it is omitted with a weapon item, then the agent must have an empty weapon slot for the operation to succeed.
 
You mean when an agent has 2 shields?

No, when an agent has 1shield and 1 spear (or any wielded weapon)...

for example, I would like him to put/return his shield on his back and use his spear as pike (like when the player uses mouse scroll down).
Currently I make him throw his shield, but I prefer that he keeps it (just in case  :meh: ?)
 
fladin said:
No, when an agent has 1shield and 1 spear (or any wielded weapon)...

a easy way is to give that agent a 2-handed version of that weapon (spear), in place of the 1-handed version. No need to mess with AI.

then if you give a new command (or some rule happens) the trigger replaces with a one-handed spear + shield again
 
give that agent a 2-handed version of that weapon (spear)
That's a good idea, first I was thinking of a  solution where I don't have to duplicate weapons (I'm too lazy  :oops:), and after I can re-use the same mechanic for any other bastard weapons (removing the shield and going berserk with two handed axe/sword ...), but your method is the easiest to make!
Thank you very much.

 
fladin said:
You mean when an agent has 2 shields?

No, when an agent has 1shield and 1 spear (or any wielded weapon)...

for example, I would like him to put/return his shield on his back and use his spear as pike (like when the player uses mouse scroll down).
Currently I make him throw his shield, but I prefer that he keeps it (just in case  :meh: ?)
In Pre-Battle Orders and Deployment kit (PBOD) there's a command the player can use to make a battle-group equip or unequip their shields:
_MJF5.jpg
You could use this as a base and add some checks for the weapon types.
 
Seek n Destroy said:
You could use this as a base and add some checks for the weapon types.

need to check if the agent will use the weapon on 2-handed mode, otherwise his requirement: "use a spear like a pike" wouldn't pass
 
kalarhan said:
Seek n Destroy said:
You could use this as a base and add some checks for the weapon types.

need to check if the agent will use the weapon on 2-handed mode, otherwise his requirement: "use a spear like a pike" wouldn't pass
If I recall correctly, when you unequip your shield when wielding a spear it defaults to a two-handed stance and animations using the spear "as a pike" or he can make a "new" spear type with the proper attacks by creating the correct item capabilities (itc) set in header_items. Or am I misunderstanding the whole point?
 
Seek n Destroy said:
Or am I misunderstanding the whole point?

nope, that is the point. To remember to check how the AI will use the weapon once it stop using the shield. A 2-handed copy may be better as you can replace the 1-handed weapon with a version that has different animations (and in some cases even a different type). Or it requires a review of the spears (or whatever 1-h / 2-h weapons he has) and all capabilities.

Some mods, as a example, have pikes using the 2-handed sword skill (and appropriate animations), and 2-handed spears as polearms.

Cheers
 
Hello, I'm trying to mod the damage system such that the chance of death decreases significantly if the final blow to take out the agent was of a very low damage (so a guy with a great helmet on doesn't die from being clocked in the head with a sword... kinda defeats the purpose :razz:) and increases significantly if it was a very high damage (so your swadian peasants aren't "knocked unconscious" by a 40lb lance going 40km/h into their head).

However I can't seem to find where the game decides whether an agent dies or is wounded from damage over its HP... I'm assuming this would happen somewhere due to the surgery skill. Does anyone have any info that could help me? Or have fiddled with the surgery thing yourself?
 
Bustah said:
However I can't seem to find where the game decides whether an agent dies or is wounded

see header_triggers.py, section on mission templates.

Code:
ti_on_agent_killed_or_wounded = -26.0 # Agent has been defeated in battle (killed or wounded)
    # trigger param 1 = defeated agent_id
    # trigger param 2 = attacker agent_id
    # trigger param 3 = wounded flag: 0 = agent is killed, 1 = agent is wounded
    # If (set_trigger_result) with non-zero parameter is used in the code, it will override the agent's fate. Use value of 1 to force kill, and 2 to force wounded.

you should spend a hour reading all header_xxx.py files to learn about game flags
 
Status
Not open for further replies.
Back
Top Bottom