Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Arch3r said:
Does anyone happen to know what brf file the Catapult model is hidden in?

EDIT: After a good 20 minutes of search I have found it in castle_e.brf

You do know OpenBRF has a search function right?
 
Does Warband have support for texture animation? I have an idea for a particle effect, but it would need to be animated with about 15 frames...
 
With the following code from game_start in module_scripts.py, what is going on?

Code:
      # Faction leader banners.
      (try_for_range, ":cur_faction", npc_kingdoms_begin, npc_kingdoms_end),
        (faction_get_slot, ":cur_faction_king", ":cur_faction", slot_faction_leader),
        (faction_get_slot, ":cur_faction_banner", ":cur_faction", slot_faction_banner),
        (val_sub, ":cur_faction_banner", banner_meshes_begin), # <-- This
        (val_add, ":cur_faction_banner", banner_scene_props_begin), # <-- And this
        (troop_set_slot, ":cur_faction_king", slot_troop_banner_scene_prop, ":cur_faction_banner"),
      (try_end),

What I think is going on is it's assigning the kingdom leaders their in-game banner from this section in module_scene_props.py:

Code:
  ("banner_kingdom_a", 0, "banner_kingdom_a", "0", []),
  ("banner_kingdom_b", 0, "banner_kingdom_b", "0", []),
  ("banner_kingdom_c", 0, "banner_kingdom_c", "0", []),
  ("banner_kingdom_d", 0, "banner_kingdom_d", "0", []),
  ("banner_kingdom_e", 0, "banner_kingdom_e", "0", []),
  ("banner_kingdom_f", 0, "banner_kingdom_f", "0", []),

The two indicated lines in the first code block are there because the order faction banner graphics are in doesn't match the order the factions are in where they are defined in scripts:

     
Code:
(faction_set_slot, "fac_kingdom_1", slot_faction_banner, "mesh_banner_kingdom_f"),
      (faction_set_slot, "fac_kingdom_2", slot_faction_banner, "mesh_banner_kingdom_b"),
      (faction_set_slot, "fac_kingdom_3", slot_faction_banner, "mesh_banner_kingdom_c"),
      (faction_set_slot, "fac_kingdom_4", slot_faction_banner, "mesh_banner_kingdom_a"),
      (faction_set_slot, "fac_kingdom_5", slot_faction_banner, "mesh_banner_kingdom_d"),
      (faction_set_slot, "fac_kingdom_6", slot_faction_banner, "mesh_banner_kingdom_e"),

Am I correct?
 
dunde said:
Hatonastick said:
Am I correct?

No. It's just offset adjustment for meshes and scene props.
Sorry if Im being thick, but what does the value assigned in slot_troop_banner_scene_prop actually refer to then?  Scene prop or mesh?

Never mind.
 
Somebody can help me, please?

I'm trying to put to the player inventory (in multiplayer) some items(armour, weapons) that I pass through MYSQL / send_message_to_url.

There is a problem here:

Code:
("multiplayer_set_default_item_selections_for_troop",
   [
     (store_script_param, ":troop_no", 1),
     (multiplayer_get_my_player, ":my_player_no"),
	 (player_get_slot, ":armaequipada11", ":my_player_no", slot_player_armaequipada_1),
	 (player_get_slot, ":armaequipada22", ":my_player_no", slot_player_armaequipada_2),
	 (player_get_slot, ":armaequipada33", ":my_player_no", slot_player_armaequipada_3),
	 (player_get_slot, ":armaequipada44", ":my_player_no", slot_player_armaequipada_4),
	 (player_get_slot, ":headequipado1", ":my_player_no", slot_player_headequipado),
	 (player_get_slot, ":bodyequipado1", ":my_player_no", slot_player_bodyequipado),
	 (player_get_slot, ":handequipado1", ":my_player_no", slot_player_handequipado),
	 (player_get_slot, ":footequipado1", ":my_player_no", slot_player_footequipado),
	 (player_get_slot, ":caballoequipado1", ":my_player_no", slot_player_caballoequipado),

It return 0, when it will return the correct ID.

I use the same under: ("multiplayer_buy_agent_equipment" and it works perfect... Idk what the hell is goin on, I was trying for hours without success. I success to give the player items, but I want to show his items in the inventory as well, so he can see them.

Somebody can help me, please?

And, if I use (call_script, "script_multiplayer_set_item_available_for_troop", blabla under on player joined, it doesn't work, but if I use it in before_mission_start or other place like this it works...

Some ideas? Thanks.
 
I got an annoying bug that duplicates the arm of the catapult (and it cannot be select nor appears in the scene prop list in edit mode) and it is somehow created twice by this code, I think:
Code:
   (ti_on_init_scene_prop,
    [
      (store_trigger_param_1, ":instance_no"),
      (multiplayer_is_server),
      (prop_instance_get_position, pos1, ":instance_no"),

      (position_move_z, pos1, 64),
      (set_spawn_position, pos1),
      (spawn_scene_prop, "spr_avarice_catapult_arm"),
      (scene_prop_get_num_instances, ":num_of_props", "spr_avarice_catapult_arm"),
      (val_sub, ":num_of_props", 1),
      (scene_prop_get_instance, ":arm_instance", "spr_avarice_catapult_arm", ":num_of_props"),
      (scene_prop_set_slot,":instance_no",scene_prop_attached_prop,":arm_instance"),
      
      (spawn_scene_prop, "spr_avarice_catapult_ammo"),
      (scene_prop_get_num_instances, ":num_of_props", "spr_avarice_catapult_ammo"),
      (val_sub, ":num_of_props", 1),
      (scene_prop_get_instance, ":ammo_instance", "spr_avarice_catapult_ammo", ":num_of_props"),
      (scene_prop_set_slot,":arm_instance",scene_prop_attached_prop,":ammo_instance"),
      
      (scene_prop_set_slot,":instance_no",scene_prop_state_slot,0),
    ]),
Anyone sees any problem with it, or experienced a duplication himself before?
 
CTCCoco said:
I'm trying to put to the player inventory (in multiplayer) some items(armour, weapons) that I pass through MYSQL / send_message_to_url.

It return 0, when it will return the correct ID.
You are most likely setting slots on the server and then expecting to read them on player clients: slots are not transferred that way, so you would need to send network messages to the client with that information.
Arch3r said:
I got an annoying bug that duplicates the arm of the catapult (and it cannot be select nor appears in the scene prop list in edit mode) and it is somehow created twice by this code, I think:
You need to make or use a different mission for editing scenes then set a global variable that disables or enables the spawning and check it in the init trigger, otherwise you'll load the scene, the other props will be spawned, you enter and exit edit mode, and the spawned props are saved in the scene file. Also, the spawned instance id is stored in reg0, so your trigger could look something like this:
Code:
   (ti_on_init_scene_prop,
    [
      (store_trigger_param_1, ":instance_no"),

      (multiplayer_is_server),
      (eq, "$g_mission_spawn_scene_props", 1),
      (prop_instance_get_position, pos1, ":instance_no"),

      (position_move_z, pos1, 64),
      (set_spawn_position, pos1),
      (spawn_scene_prop, "spr_avarice_catapult_arm"),
      (scene_prop_set_slot,":instance_no",scene_prop_attached_prop,reg0),
      
      (spawn_scene_prop, "spr_avarice_catapult_ammo"),
      (scene_prop_set_slot,":arm_instance",scene_prop_attached_prop,reg0),
      
      (scene_prop_set_slot,":instance_no",scene_prop_state_slot,0),
    ]),
 
Vornne said:
CTCCoco said:
I'm trying to put to the player inventory (in multiplayer) some items(armour, weapons) that I pass through MYSQL / send_message_to_url.

It return 0, when it will return the correct ID.
You are most likely setting slots on the server and then expecting to read them on player clients: slots are not transferred that way, so you would need to send network messages to the client with that information.
Arch3r said:
I got an annoying bug that duplicates the arm of the catapult (and it cannot be select nor appears in the scene prop list in edit mode) and it is somehow created twice by this code, I think:
You need to make or use a different mission for editing scenes then set a global variable that disables or enables the spawning and check it in the init trigger, otherwise you'll load the scene, the other props will be spawned, you enter and exit edit mode, and the spawned props are saved in the scene file. Also, the spawned instance id is stored in reg0, so your trigger could look something like this:
Code:
   (ti_on_init_scene_prop,
    [
      (store_trigger_param_1, ":instance_no"),

      (multiplayer_is_server),
      (eq, "$g_mission_spawn_scene_props", 1),
      (prop_instance_get_position, pos1, ":instance_no"),

      (position_move_z, pos1, 64),
      (set_spawn_position, pos1),
      (spawn_scene_prop, "spr_avarice_catapult_arm"),
      (scene_prop_set_slot,":instance_no",scene_prop_attached_prop,reg0),
      
      (spawn_scene_prop, "spr_avarice_catapult_ammo"),
      (scene_prop_set_slot,":arm_instance",scene_prop_attached_prop,reg0),
      
      (scene_prop_set_slot,":instance_no",scene_prop_state_slot,0),
    ]),
No, I tried that reg0 thing because it said in the comment: stores instance id in reg0 - not yet. So I thought maybe they added that but did not removed the 'not yet'. Appeared that they didn't, because I got a invalid instance ID -1.

Also a funny video of what happens when you get the wrong instance: http://www.xfire.com/video/51d93d/

Anyways, thanks for the help, I will add the global variable and just delete the arm after it ran the init code when close Edit mode, that should suffice right?
 
If you use the catapult from Age of Machinery, I'm making a WSE based code that requires nothing but spawn_missile and an animation movement of the arm. :wink:
 
Arch3r said:
No, I tried that reg0 thing because it said in the comment: stores instance id in reg0 - not yet. So I thought maybe they added that but did not removed the 'not yet'. Appeared that they didn't, because I got a invalid instance ID -1.
It most certainly works, and has for a long time - otherwise many major features of PW 4 would totally fail.

The error is most likely caused by my quick editing of your code - reg0 needs to be saved in ":arm_instance" after the first spawn.
Arch3r said:
I will add the global variable and just delete the arm after it ran the init code when close Edit mode, that should suffice right?
The global variable is supposed to disable spawning the extra props unless you are in the correct mission to play it; just add (assign, "$g_mission_spawn_scene_props", 1), to the ti_before_mission_start trigger of the mission templates used to play the mod, and then edit scenes with another native mission or make a new one. You could delete spawned props, but you and anyone else would have to remember to do it every time a scene is loaded, which would probably get tiresome.
 
well guys I got a problem on scene prop triggers, I'm using the following code:
Code:
		(ti_on_scene_prop_hit,[
			(store_trigger_param_1, ":instance_no"),
			(store_trigger_param_2, ":damage"),
			(position_get_x,":agent",pos2),
			(agent_get_wielded_item,":weapon",":agent",0),
			(agent_get_wielded_item,":shield",":agent",1),
			(try_begin),
				(gt,":shield",0),
				(item_get_type,":type",":shield"),
				(try_begin),
					(eq,":type",itp_type_shield),
					(val_mul,":damage",90),
					(val_div,":damage",100),
				(else_try),
					(assign,":damage",0),
				(try_end),
			(else_try),
				(item_get_type,":type",":weapon"),
				(try_begin),
					(eq,":weapon",0),
					(val_mul,":damage",105),
					(val_div,":damage",100),
				(else_try),
					(eq,":type",itp_type_one_handed_wpn),
					(val_mul,":damage",80),
					(val_div,":damage",300),
				(else_try),
					(eq,":type",itp_type_two_handed_wpn),
					(val_mul,":damage",110),
					(val_div,":damage",300),
				(else_try),
					(eq,":type",itp_type_polearm),
					(val_mul,":damage",115),
					(val_div,":damage",300),
				(else_try),
					(assign,":damage",0),
				(try_end),
			(try_end),
			(try_begin),
				(scene_prop_get_hit_points, ":hit_points", ":instance_no"),
				(val_sub, ":hit_points", ":damage"),
				(scene_prop_get_slot,":x",":instance_no",scene_prop_dropped_times),
				(store_sub,":min_damage",20,":x"),
				(val_mul,":min_damage",50),
				(gt, ":hit_points", ":min_damage"),
				(val_add,":x",1),
				(scene_prop_set_slot,":instance_no",scene_prop_dropped_times,":x"),
				(play_sound, "snd_dummy_hit"),
				(store_add,":end","itm_thin_wood_branch",1),
				(store_random_in_range,":item","itm_wooden_sticks",":end"),
				(set_fixed_point_multiplier, 100),
				(prop_instance_get_position, pos1, ":instance_no"),
				(store_random_in_range,":x",-200,201),
				(store_random_in_range,":y",-200,201),
				(position_move_y,pos1,":y"),
				(position_move_x,pos1,":x"),
				(set_spawn_position,pos1),
				(spawn_item,":item",0),
			(try_end),
			]),
but when I hit it, It says there is no agent 1500. is it bugged or what?
 
Ikaguia said:
Code:
			(position_get_x,":agent",pos2),
Wrong, because the default fixed point multiplier of 100 will convert agent id 15 to 1500; use this:
Code:
(set_fixed_point_multiplier, 1),
(position_get_x, ":agent", pos2),
(set_fixed_point_multiplier, 100),
 
Status
Not open for further replies.
Back
Top Bottom