Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
If i add new troops to Warband Singeleplayer and want them to appear in the taverns along the normal mercenaries, what do i have to do? I suspect that there is a script called whenever you entered a tavern, placing the troops. So i have to lokk into the Scripts file or what?
 
MadocComadrin said:
Is there any way to get all of the items an agent has currently equipped? (I need to tell if an agent/player (multiplayer) has more of one type of item and if they have a weapon space free)

Module System 1.134 is out...with something that should be of help to you:
(agent_get_item_slot, <destination>, <agent_id>, <value>), value between 0-7, order is weapon1, weapon2, weapon3, weapon4, head_armor, body_armor, leg_armor, hand_armor            (the appropriate ek_slots)

Possibly also useful for this:
ti_on_item_picked_up
ti_on_item_dropped
ti_on_item_wielded
ti_on_item_unwielded
 
Caba`drin said:
MadocComadrin said:
Is there any way to get all of the items an agent has currently equipped? (I need to tell if an agent/player (multiplayer) has more of one type of item and if they have a weapon space free)

Module System 1.134 is out...with something that should be of help to you:
(agent_get_item_slot, <destination>, <agent_id>, <value>), value between 0-7, order is weapon1, weapon2, weapon3, weapon4, head_armor, body_armor, leg_armor, hand_armor            (the appropriate ek_slots)

Possibly also useful for this:
ti_on_item_picked_up
ti_on_item_dropped
ti_on_item_wielded
ti_on_item_unwielded
Excellent! You have helped me get one step closer to world domination. When I'm done with my conquest, you will receive a charming fruit basket and a gift card to Olive Garden.
 
Excellent! You have helped me get one step closer to world domination. When I'm done with my conquest, you will receive a charming fruit basket and a gift card to Olive Garden.
You will never accomplish it. As I type this my men a closing in on your position.

Anyways, I am getting some weird problems with a simple loop that I have and all that I can figure out is that prop_instances are not numbered right.

Code:
(scene_prop_get_num_instances, ":max_bullets", "spr_bullet_a"),
         (try_for_range, ":cur_bullet", 0, ":max_bullets"),
            (prop_instance_get_position, pos3, ":cur_bullet"),
            (position_get_distance_to_ground_level, ":ground_distance", pos3),
            (le, ":ground_distance", 0),
            (prop_instance_stop_animating, ":cur_bullet"),
            (scene_prop_set_visibility, ":cur_bullet", 0),
         (try_end),
During gameplay I get invalid prop id values of 3 and up even though that many bullets have been created. Are scene_props not numbered in increments of one starting at zero?
 
You haven't actually gotten the instance IDs, only the instance indexes. You need to add this in your loop. make this the first line inside your loop.

Code:
(scene_prop_get_instance, ":bullet_id", "spr_bullet_a", ":cur_bullet"),
and replace the other uses of ":cur_bullet" with ":bullet_id"
 
I'm having problems with custom "use" strings. I'm trying to make it so that the use string changes depending on what item you're wielding and the state of one of the scene prop's slots. The part that confuses me is that the code works on a local server, but not a dedicated. Is there something I'm missing? Here's the code that I've added to script_game_get_use_string:

Code:
	 (multiplayer_get_my_player, ":my_player"),
	 (player_get_agent_id, ":player_agent", ":my_player"),
	 (agent_get_wielded_item, ":wielded_item", ":player_agent", 0),
	 (try_begin),
	   (this_or_next|eq, ":scene_prop_id", "spr_mp_cannon_3lb"),
	   (this_or_next|eq, ":scene_prop_id", "spr_mp_cannon_6lb"),
	   (eq, ":scene_prop_id", "spr_mp_cannon_12lb"),
	   (scene_prop_get_slot, ":reloaded", ":instance_id", mp_cannon_reload),
	   (try_begin),
	     (eq, ":reloaded", 0),
		 (this_or_next|eq, ":wielded_item", "itm_cannonball_3lb"),
		 (this_or_next|eq, ":wielded_item", "itm_cannonball_6lb"),
		 (eq, ":wielded_item", "itm_cannonball_12lb"),
	     (str_store_string, s0, "str_cannon_reload_0_cannonball"),
	   (else_try),
	     (eq, ":reloaded", 0),
		 (this_or_next|neq, ":wielded_item", "itm_cannonball_3lb"),
		 (this_or_next|neq, ":wielded_item", "itm_cannonball_6lb"),
		 (neq, ":wielded_item", "itm_cannonball_12lb"),
	     (str_store_string, s0, "str_cannon_reload_0_no_cannonball"),
	   (else_try),
	     (eq, ":reloaded", 1),
		 (eq, ":wielded_item", "itm_ramrod"),
	     (str_store_string, s0, "str_cannon_reload_1_ramrod"),
	   (else_try),
	     (eq, ":reloaded", 1),
		 (neq, ":wielded_item", "itm_ramrod"),
	     (str_store_string, s0, "str_cannon_reload_1_no_ramrod"),
	   (else_try),
	     (eq, ":reloaded", 2),
		 (eq, ":wielded_item", "itm_linstock"),
	     (str_store_string, s0, "str_cannon_reload_2_linstock"),
	   (else_try),
	     (eq, ":reloaded", 2),
		 (neq, ":wielded_item", "itm_linstock"),
	     (str_store_string, s0, "str_cannon_reload_2_no_linstock"),
	   (try_end),
	 (try_end),

The problem that happens on the dedicated server is that it only seems to cycle through the first two possibilities.
 
It looks like you can load any size cannonball into any size cannon with your code. Also, you can output or store literal strings using @. (str_store_string, s0, "@Cannon is loaded"),

Try this or if the items are in a row you could shorten it with a try for range.

Code:
    (multiplayer_get_my_player, ":my_player"),
    (player_get_agent_id, ":player_agent", ":my_player"),
    (agent_get_wielded_item, ":wielded_item", ":player_agent", 0),
    (scene_prop_get_slot, ":reloaded", ":instance_id", mp_cannon_reload),
    (try_begin),
       (eq, ":scene_prop_id", "spr_mp_cannon_3lb"),
       (try_begin),
          (eq, ":reloaded", 0),
          (eq, ":wielded_item", "itm_cannonball_3lb"),
          (str_store_string, s0, "str_cannon_reload_0_cannonball"),
       (else_try),
          (eq, ":reloaded", 0),
          (neq, ":wielded_item", "itm_cannonball_3lb"),
          (str_store_string, s0, "str_cannon_reload_0_no_cannonball"),
       (try_end),
    (else_try),
       (eq, ":scene_prop_id", "spr_mp_cannon_6lb"),
       (try_begin),
          (eq, ":reloaded", 0),
          (eq, ":wielded_item", "itm_cannonball_6lb"),
          (str_store_string, s0, "str_cannon_reload_0_cannonball"),
       (else_try),
          (eq, ":reloaded", 0),
          (neq, ":wielded_item", "itm_cannonball_6lb"),
          (str_store_string, s0, "str_cannon_reload_0_no_cannonball"),
       (try_end),
    (else_try),
       (eq, ":scene_prop_id", "spr_mp_cannon_12lb"),
       (try_begin),
          (eq, ":reloaded", 0),
          (eq, ":wielded_item", "itm_cannonball_12lb"),
          (str_store_string, s0, "str_cannon_reload_0_cannonball"),
       (else_try),
          (eq, ":reloaded", 0),
          (neq, ":wielded_item", "itm_cannonball_12lb"),
          (str_store_string, s0, "str_cannon_reload_0_no_cannonball"),
       (try_end),
    (try_end),
    (try_begin),
        (eq, ":reloaded", 1),
       (eq, ":wielded_item", "itm_ramrod"),
        (str_store_string, s0, "str_cannon_reload_1_ramrod"),
      (else_try),
        (eq, ":reloaded", 1),
       (neq, ":wielded_item", "itm_ramrod"),
        (str_store_string, s0, "str_cannon_reload_1_no_ramrod"),
      (else_try),
        (eq, ":reloaded", 2),
       (eq, ":wielded_item", "itm_linstock"),
        (str_store_string, s0, "str_cannon_reload_2_linstock"),
      (else_try),
        (eq, ":reloaded", 2),
       (neq, ":wielded_item", "itm_linstock"),
        (str_store_string, s0, "str_cannon_reload_2_no_linstock"),
      (try_end),
 
ithilienranger said:
It looks like you can load any size cannonball into any size cannon with your code. Also, you can output or store literal strings using @. (str_store_string, s0, "@Cannon is loaded"),

Try this or if the items are in a row you could shorten it with a try for range.

Code:
    (multiplayer_get_my_player, ":my_player"),
    (player_get_agent_id, ":player_agent", ":my_player"),
    (agent_get_wielded_item, ":wielded_item", ":player_agent", 0),
    (scene_prop_get_slot, ":reloaded", ":instance_id", mp_cannon_reload),
    (try_begin),
       (eq, ":scene_prop_id", "spr_mp_cannon_3lb"),
       (try_begin),
          (eq, ":reloaded", 0),
          (eq, ":wielded_item", "itm_cannonball_3lb"),
          (str_store_string, s0, "str_cannon_reload_0_cannonball"),
       (else_try),
          (eq, ":reloaded", 0),
          (neq, ":wielded_item", "itm_cannonball_3lb"),
          (str_store_string, s0, "str_cannon_reload_0_no_cannonball"),
       (try_end),
    (else_try),
       (eq, ":scene_prop_id", "spr_mp_cannon_6lb"),
       (try_begin),
          (eq, ":reloaded", 0),
          (eq, ":wielded_item", "itm_cannonball_6lb"),
          (str_store_string, s0, "str_cannon_reload_0_cannonball"),
       (else_try),
          (eq, ":reloaded", 0),
          (neq, ":wielded_item", "itm_cannonball_6lb"),
          (str_store_string, s0, "str_cannon_reload_0_no_cannonball"),
       (try_end),
    (else_try),
       (eq, ":scene_prop_id", "spr_mp_cannon_12lb"),
       (try_begin),
          (eq, ":reloaded", 0),
          (eq, ":wielded_item", "itm_cannonball_12lb"),
          (str_store_string, s0, "str_cannon_reload_0_cannonball"),
       (else_try),
          (eq, ":reloaded", 0),
          (neq, ":wielded_item", "itm_cannonball_12lb"),
          (str_store_string, s0, "str_cannon_reload_0_no_cannonball"),
       (try_end),
    (try_end),
    (try_begin),
        (eq, ":reloaded", 1),
       (eq, ":wielded_item", "itm_ramrod"),
        (str_store_string, s0, "str_cannon_reload_1_ramrod"),
      (else_try),
        (eq, ":reloaded", 1),
       (neq, ":wielded_item", "itm_ramrod"),
        (str_store_string, s0, "str_cannon_reload_1_no_ramrod"),
      (else_try),
        (eq, ":reloaded", 2),
       (eq, ":wielded_item", "itm_linstock"),
        (str_store_string, s0, "str_cannon_reload_2_linstock"),
      (else_try),
        (eq, ":reloaded", 2),
       (neq, ":wielded_item", "itm_linstock"),
        (str_store_string, s0, "str_cannon_reload_2_no_linstock"),
      (try_end),
Yeah, that takes care of the cannonballs, but the problem with the dedicated server still remains.
 
OK, my first problem with the tavern is solved. But i hav one other question: is there a possibility to add new bodies? There are existing one body for men, one for women, and one for Undead. Can i add more in some way? And is it possible to give multiplayer troops this body then? i dont mean the bots, i mean the troops the player can play. Or do i have to add these bodies just as armor, like it is in Fantasy-PW for example?
 
I thought today that I could try to code a mine. Could you guys guide me on this a bit? I mean on what constants to use etc. Ill try to do the coding myself then. And would you say it's hard?
 
Like a land mine? The approach I'd take is to make an item and a scene prop. After throwing/placing the mine item, spawn a scene-prop mine at the placement position. Then have a trigger in mission templates to check every frame (ie, 0 in the time spot) if an enemy agent (or anybody, if you want friendly-fire mines) is within a certain radius of any mines. If there is an enemy close enough to a mine, move that specific mine prop below the ground (you also may want to script a disabling variable too, just in case), deal damage to the agents in the blast radius, make a nice explosion using particles, and voila, you've got yourself a working mine!

 
I have a little question, I want to add new scene_objekts.I have collisions, have meshs, have textures. I change the scene_props folder via MS. The problems is that i can go through walls. I´m confused. :???: Can anyone help me?
 
My module_scene_props entry is this:

("HK_Wall" ,0,"HK2.3" ,"bo_HK2.3" , []),

ID,0,mesh, collision

I use the same moddel for mesh and collison. Is that a problem?

The ai_limiter flag don´t say me anything.
 
Status
Not open for further replies.
Back
Top Bottom