Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
fladin said:
Ikaguia said:
fladin said:
What script decide  who to be killed and who will be only knocked unconscious ?
it's hardcoded afaik, but you could always change the skill values(surgery and all that stuff) to a ridiculous number and then remove the troops you want to die, or use the agent_set_no_death_knock_down_only operation
What I want to do is to make  troops with heavy armor less "killable" ;
I already created the script that calculate total armor protection, and also the one that reduces the final damage, but they  die anyway  :mad:
also  tried agent_set_no_death_knock_down_only, it only makes them immortal  :lol:
tf_allways_fall_dead, tf_unkillable at your desired troops' definitions. It's not the thing you asked for in your second post, but it's what I thought of after the first one...

EDIT: Good God, does a tag actually contain "allways" in its name?... I lifted this directly from header_troops... Ouch.
 
mike56 said:
First and more important, I made my own map, as said before, and when testing ingame, I see a horrible great white cross on the sea...
Check your materials and map icon meshes with OpenBRF. It's probably some invalid mesh being overlaid at that position.
And second. I modified desert textures because I want tthe palms on my map not look like desert palms, but rainforest palms. Now looks like this:
Just modify the icon meshes to be more dense - rotate and combine a few groups of trees together.
fladin said:
agent_set_no_death_knock_down_only :  The agent only fall, and then he gets up = never knocked uncouscious = eternal battle

already tried and it gave an epic -infinite- battle  :lol:
You turn on
Code:
agent_set_no_death_knock_down_only
when they spawn and turn it off at some point inside ti_on_agent_knocked_down (check their hp to make sure it's not just random blunt damage/horse trample). This can be the nth time they've been knocked down, or even one hit depending on how tough/lucky you want the troop to be. You then turn off the invulnerability and kill it normally, or deliver a blunt source of damage to knock them unconscious arbitrarily.
 
Alright, so this is my first foray into crafting my own code.

I want to make healing herbs that supply a +1 to party healing and are consumed like food whenever there are wounded troops in the party. I also want them to NOT be counted as food for purposes of usual food consumption and morale bonuses. This is what I have so far:

Code:
["herbs", "Healing Herbs",[("herbs",0)], itp_type_goods|
itp_consumable, 0, 5, weight(1)|max_ammo(20),imodbits_none],

Code:
		(else_try),	
        (try_begin),	  
	  (eq, ":item_no", "itm_herbs"),	
          (eq, ":extra_text_id", 0),
          (set_result_string, "@+1 to Wound Treatment while supplies last."),
          (set_trigger_result, 0xFFEEDD),		
        (try_end),

Code:
    (else_try),
      (eq, ":skill_no", "skl_wound_treatment"),
      (call_script, "script_get_troop_item_amount", ":troop_no", "itm_herbs"),
      (gt, reg0, 0),
      (val_add, ":modifier_value", 1),	 

Now most of this works. I got the herbs in game and they give a bonus to wound treatment just like they're supposed to and the item doesn't count as food or get consumed with the rest of it, but I need a bit of help getting it to deplete based on the presence of wounded party members (faster if there are more wounded would be great, but I'm not picky.) I'm assuming it would be similar to the following in some way and making use of party_stack_get_num_wounded?

Code:
 ("consume_food",
   [(store_script_param, ":selected_food", 1),
    (troop_get_inventory_capacity, ":capacity", "trp_player"),
    (try_for_range, ":cur_slot", 0, ":capacity"),
      (troop_get_inventory_slot, ":cur_item", "trp_player", ":cur_slot"),
      (is_between, ":cur_item", food_begin, food_end),
      (troop_get_inventory_slot_modifier, ":item_modifier", "trp_player", ":cur_slot"),
      (neq, ":item_modifier", imod_rotten),
      (item_slot_eq, ":cur_item", slot_item_is_checked, 0),
      (item_set_slot, ":cur_item", slot_item_is_checked, 1),
      (val_sub, ":selected_food", 1),
      (lt, ":selected_food", 0),
      (assign, ":capacity", 0),
      (troop_inventory_slot_get_item_amount, ":cur_amount", "trp_player", ":cur_slot"),
      (val_sub, ":cur_amount", 1),
      (troop_inventory_slot_set_item_amount, "trp_player", ":cur_slot", ":cur_amount"),
    (try_end),
    ]),

Thank you kindly to anyone who can guide me down the right path.
 
The problem with script_consume_food is that it's called randomly to deplete different quantities of food, 1 tick at at time. Your code will look similar but probably ignore the slot checks. To make it easier use the same trigger that also adds up food consumption.
Code:
  # Consuming food at every 14 hours
  (14,
   [
    (eq, "$g_player_is_captive", 0),
    (party_get_num_companion_stacks, ":num_stacks","p_main_party"),
    (assign, ":num_men", 0),
    (try_for_range, ":i_stack", 0, ":num_stacks"),
      (party_stack_get_size, ":stack_size","p_main_party",":i_stack"),
      (val_add, ":num_men", ":stack_size"),
    (try_end),
    (call_script, "script_party_count_members_with_full_health", "p_main_party"), #returns number of troops at full health in reg0
    (store_sub, ":num_wounded", ":num_men", reg0), #gets actual number of wounded
    (val_max, ":num_wounded", 0), #do some scaling before this 
    (val_div, ":num_men", 3),
    (try_begin),
      (eq, ":num_men", 0),
      (val_add, ":num_men", 1),
    (try_end),
...
    (try_begin),
      (gt ":num_wounded", 0),
      (call_script, "script_consume_herbs", ":num_wounded"),
    (try_end),
Notice how the parameter is now changed to a quantity and the item checks are made simpler.
Code:
  ("consume_herbs",
   [(store_script_param, ":num_wounded", 1),
    (troop_get_inventory_capacity, ":capacity", "trp_player"),
    (try_for_range, ":cur_slot", 0, ":capacity"),
      (gt, ":num_wounded", 0),
      (troop_get_inventory_slot, ":cur_item", "trp_player", ":cur_slot"),
      (eq, ":cur_item", "itm_herbs"),
      (troop_get_inventory_slot_modifier, ":item_modifier", "trp_player", ":cur_slot"),
      (neq, ":item_modifier", imod_rotten), #you can also add different effects for different imod
      (troop_inventory_slot_get_item_amount, ":cur_amount", "trp_player", ":cur_slot"), #get cur amount of medicine on stack
      (try_begin), #last bit of herbs before script ends
        (gt, ":cur_amount", ":num_wounded"),
        (val_sub, ":cur_amount", ":num_wounded"),
        (troop_inventory_slot_set_item_amount, "trp_player", ":cur_slot", ":cur_amount"),
        (assign, ":capacity", -1),
      (else_try), #use up entire stack of herbs
        (val_sub, ":num_wounded", ":cur_amount"),
        (troop_set_inventory_slot, "trp_player", ":cur_slot", -1),
      (try_end),
    (try_end),
    ]),
 
Ikaguia said:
fladin said:
agent_set_no_death_knock_down_only :  The agent only fall, and then he gets up = never knocked uncouscious = eternal battle

already tried and it gave an epic -infinite- battle  :lol:

afaik they don't get up, it counts as if they were knocked unconcious(troops will "die" but you won't lose them in the campaign)

during fight they never knocked unconcious, they just fall then get up  and continue battle  :lol:

tf_allways_fall_dead, tf_unkillable at your desired troops' definitions. It's not the thing you asked for in your second post, but it's what I thought of after the first one...

EDIT: Good God, does a tag actually contain "allways" in its name?... I lifted this directly from header_troops... Ouch.

I guess tf_unkillable is for  troops  not for agents during a mission... no ?
 
fladin said:
tf_allways_fall_dead, tf_unkillable at your desired troops' definitions. It's not the thing you asked for in your second post, but it's what I thought of after the first one...

EDIT: Good God, does a tag actually contain "allways" in its name?... I lifted this directly from header_troops... Ouch.
I guess tf_unkillable is for  troops  not for agents during a mission... no ?
Considering it's a troop flag and the part I've bolded in my post which you quoted, I'd say that's a pretty safe bet.

EDIT: But then again, Somebody's method is what you're actually looking for.
 
Ok, let me see if I can figure out what is going on here.
Somebody said:
  # Consuming food at every 14 hours
  (14, So I can just put a number here and it means "do this every 14 hours?"
  [
    (eq, "$g_player_is_captive", 0), Player must be active; makes sense.
    (party_get_num_companion_stacks, ":num_stacks","p_main_party"), 
    (assign, ":num_men", 0),
    (try_for_range, ":i_stack", 0, ":num_stacks"),
      (party_stack_get_size, ":stack_size","p_main_party",":i_stack"),
      (val_add, ":num_men", ":stack_size"),
    (try_end),                     
So this section... adds the number of companions to the number of regular troops to get the total party size?
    (call_script, "script_party_count_members_with_full_health", "p_main_party"), #returns number of troops at full health in reg0
    (store_sub, ":num_wounded", ":num_men", reg0), #gets actual number of wounded
    (val_max, ":num_wounded", 0), #do some scaling before this If the num_wounded is higher than x it will just set it to x instead of letting the number get too big?
    (val_div, ":num_men", 3), This one can be changed if the herbs get consumed too quickly or slowly?
    (try_begin),
      (eq, ":num_men", 0),
      (val_add, ":num_men", 1), Ensuring that num_men is at least 1.
    (try_end),
...  Not sure what this is about. Am I supposed to enter something here?
    (try_begin),
      (gt ":num_wounded", 0), If there is at least one wounded, it will run the consume_herbs script
      (call_script, "script_consume_herbs", ":num_wounded"),
    (try_end),


Notice how the parameter is now changed to a quantity and the item checks are made simpler.


  ("consume_herbs",
  [(store_script_param, ":num_wounded", 1), The number determined in the previous simple_triggers_code
    (troop_get_inventory_capacity, ":capacity", "trp_player"),
    (try_for_range, ":cur_slot", 0, ":capacity"), Not fully understood
      (gt, ":num_wounded", 0),
      (troop_get_inventory_slot, ":cur_item", "trp_player", ":cur_slot"),
      (eq, ":cur_item", "itm_herbs"),
      (troop_get_inventory_slot_modifier, ":item_modifier", "trp_player", ":cur_slot"),
      (neq, ":item_modifier", imod_rotten), #you can also add different effects for different imod so this currently doesn't do anything since the herbs can't go rotten, but I could add a function that would do so after a certain number of days if I wanted to...
      (troop_inventory_slot_get_item_amount, ":cur_amount", "trp_player", ":cur_slot"), #get cur amount of medicine on stack
      (try_begin), #last bit of herbs before script ends
        (gt, ":cur_amount", ":num_wounded"),
        (val_sub, ":cur_amount", ":num_wounded"),
        (troop_inventory_slot_set_item_amount, "trp_player", ":cur_slot", ":cur_amount"),
        (assign, ":capacity", -1),
      (else_try), #use up entire stack of herbs
        (val_sub, ":num_wounded", ":cur_amount"),
        (troop_set_inventory_slot, "trp_player", ":cur_slot", -1),
      (try_end),
    (try_end),
    ]),
I'm a little hazy on the details, but I can pick out the general thread of reason. Where would I prevent a stacking effect by having more than one herb in the inventory at a time?
 
Mandible said:
I'm a little hazy on the details, but I can pick out the general thread of reason. Where would I prevent a stacking effect by having more than one herb in the inventory at a time?
There is no effect other than what you have added in script_game_get_skill_modifier_for_troop. The top part of the trigger I posted is already in the game - it's counting the consumption of food, so don't alter that interval (you can always make a separate trigger though). The ellipsis indicate original code, then a try_begin block you insert to check for medicine.
In the script itself we iterate over all the player's inventory slots.
Code:
troop_get_inventory_capacity
is something you'll see a lot of scripts dealing with inventories. A troop's items start at index 0 (technically part of the equipment) and the inventory is between indices 10 and 96.
 
mike56 said:
Hello, ma' lords!

I come here with a pair of questions for you, I hope somebody can help me.

First and more important, I made my own map, as said before, and when testing ingame, I see a horrible great white cross on the sea...

nJDFy.jpg

What's this? How to remove?



And second. I modified desert textures because I want tthe palms on my map not look like desert palms, but rainforest palms. Now looks like this:

jytbi.jpg

But now I'm trying to increase the number of palms, the amount per squared meters, if you understand me; in order to make it look like a dense rainforest.

How can I do this?

Cheers and thank you!

Something about this, please?  :oops:
 
mike56 said:
Something about this, please?  :oops:
Somebody said:
mike56 said:
First and more important, I made my own map, as said before, and when testing ingame, I see a horrible great white cross on the sea...
Check your materials and map icon meshes with OpenBRF. It's probably some invalid mesh being overlaid at that position.
And second. I modified desert textures because I want tthe palms on my map not look like desert palms, but rainforest palms. Now looks like this:
Just modify the icon meshes to be more dense - rotate and combine a few groups of trees together.
 
and about this, does anyone have an idea?

Ikaguia said:
isn't this supposed to make the agent invul?
Code:
agent_set_invulnerable_shield            = 1725  # (agent_set_invulnerable_shield, <agent_id>, <value>),
or is it SP only?
 
Somebody said:
Mandible said:
I'm a little hazy on the details, but I can pick out the general thread of reason. Where would I prevent a stacking effect by having more than one herb in the inventory at a time?
There is no effect other than what you have added in script_game_get_skill_modifier_for_troop. The top part of the trigger I posted is already in the game - it's counting the consumption of food, so don't alter that interval (you can always make a separate trigger though). The ellipsis indicate original code, then a try_begin block you insert to check for medicine.
In the script itself we iterate over all the player's inventory slots.
Code:
troop_get_inventory_capacity
is something you'll see a lot of scripts dealing with inventories. A troop's items start at index 0 (technically part of the equipment) and the inventory is between indices 10 and 96.

Ok, I'm getting closer to understanding it. So looking at the original food consumption code, you just inserted
(call_script, "script_party_count_members_with_full_health", "p_main_party"), #returns number of troops at full health in reg0
    (store_sub, ":num_wounded", ":num_men", reg0), #gets actual number of wounded
    (val_max, ":num_wounded", 0), #do some scaling before this
into the middle of it so that it would check for wounded party members while it was in the neighbourhood counting party members anyway and then added the little try block which checks to see if there are more than 0 wounded party members.

Do I just remove the ellipsis then?

I must be missing a step somewhere because I'm getting an invalid syntax error with  (gt ":num_wounded", 0),

[EDIT] For anyone who wants to replicate this, the error was that there should be a comma after the gt.
  gt, ":num_wounded", 0),
 
Hi,

I'm looking for tutoriel about creating new quest...

Does anyone can help me, I want to know if there is any tutoriel more recent than the folowing?
http://forums.taleworlds.com/index.php?topic=6575.msg96630#msg96630

(Or does this one work with M&B Warband 1158?)

Thank you.
 
it hasn't  changed too much since, it also works for newest releases

la meilleur façon d’apprendre est d'analyser et essayer de comprendre comment ça marchent avec  les quetes déjà existantes
 
fladin said:
la meilleur façon d’apprendre est d'analyser et essayer de comprendre comment ça marchent avec  les quetes déjà existantes

Oui, c'est sur, je suis entièrement d'accord avec toi... Mais, si je n'ai pas de base sur lesquelles me fixer...
Quels fichiers modifier etc...

Je vais guère avancer!
J'ai essayé avec les tutos pré-cités mais la compil est truffée d'erreur!! alors je suis pommé.

Merci quand même du conseil!
 
Hi everybody,

Was just wondering if it's possible to edit field battle scenes. You know, the ones randomly generated when you engage a party on the global map. The main thing I want to do is to make the hills/mountains in those scenes less tall because they annoy me.

Unfortunately, I have no idea what files/resources/tools are responsible for doing something like this. There are a bunch of scn_random files in my module folder but those are static, right? To generate a truly random scene, they are probably somehow combined between each other in a manner that isn't known to me.

Thanks in advance!
 
aleeque said:
Was just wondering if it's possible to edit field battle scenes. You know, the ones randomly generated when you engage a party on the global map. The main thing I want to do is to make the hills/mountains in those scenes less tall because they annoy me.
This topic has been discussed to death. :smile:

Scene randomized generation is hard-coded, and there aren't any reliable ways to affect it.

The typical solution is to scrap randomized scenes entirely, prepare a number of battle scenes for each terrain and pick random one from the set whenever needed.
 
Status
Not open for further replies.
Back
Top Bottom