Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Well, I should've write this at start - i don't want to make whole mod. It's just a little modification of server based on native.
You can play with original files or changed ones. I don't want to force people to download whole mod (most people won't do that anyway).
It works fine, without any problems. Only annoying thing is, I see new item on every server, and that's what I want to avoid.
 
The idea is briliant. But i'm not really sure how global variables works in this game.
If I change some global variable server sided, will it be loaded to client side after I join the server ?
Maybe server settings variables would do so, but then... where can I find the list of variables which are loaded from server to client ?
Module_variables file is empty in my module system. I see variables.txt file contains some names, but how to know which variables there are just for client side settings (maybe all are ?) and which are loaded from server ?
I guess it will be hard to find any unused variable which is send from server to client to keep them level - it would be just unwanted network traffic.
 
Very quick question!
Does ti_on_missile_hit work on a weapon? More specifically... is it possible to take a weapon, make it use standard ammo, and then do something like
Code:
 [(ti_on_weapon_attack, [(play_sound,"snd_pistol_shot")])] ], [(ti_on_missile_hit, [(play_sound,"snd_explosion"),    (this_or_next|multiplayer_is_server),(neg|game_in_multiplayer_mode),    (store_trigger_param_1,":grenadier"),        (try_for_agents,":target"),            (agent_get_position,pos2,":target"),(get_distance_between_positions,":dist",pos1,pos2),(try_begin),(lt,":dist",250),(store_agent_hit_points,":hp",":target",1),(store_random_in_range,":dmg",60,100),(val_sub,":hp",":dmg"),(agent_set_hit_points,":target",":hp",1),(agent_deliver_damage_to_agent,":grenadier",":target"),(try_end),(particle_system_burst,"psys_pistol_smoke",pos1,50),(try_end)])]]

To make a weapon play a sound when firing, and then make the missile that hits the ground explode? I just need to know if the code would work for a simple rocket launcher, which would take the normal ammunition (bullets) and make them explode.
 
Well, I'd guess the syntax is invalid. :smile:

Format your code properly with indentation and mistakes will be obvious. Or use an editor which can highlight matching brackets.
 
Well this is my reformatted code...
Code:
["explosive1", "M14 Urban Camo Sniper", [("urban_camo_sniper",0)], itp_type_musket|itp_merchandise|itp_two_handed|itp_primary, itcf_shoot_musket|itcf_carry_spear|itcf_reload_musket, 683, weight(5.2)|difficulty(0)|spd_rtng(70)|shoot_speed(300)|thrust_damage(200,pierce)|max_ammo(20)|accuracy(150), imodbits_crossbow, 
    [
 (ti_on_weapon_attack, 
    [
   (play_sound,"snd_pistol_shot")
     ]), 
    [
  (ti_on_missile_hit, 
    [
	(play_sound,"snd_explosion"),    
	(this_or_next|multiplayer_is_server),
	(neg|game_in_multiplayer_mode),    
	(store_trigger_param_1,":grenadier"),        
	(try_for_agents,":target"),            
	 (agent_get_position,pos2,":target"),
	 (get_distance_between_positions,":dist",pos1,pos2),
	 (try_begin),
	   (lt,":dist",250),
	   (store_agent_hit_points,":hp",":target",1),
	   (store_random_in_range,":dmg",60,100),
	   (val_sub,":hp",":dmg"),
	   (agent_set_hit_points,":target",":hp",1),
	   (agent_deliver_damage_to_agent,":grenadier",":target"),
	  (try_end),
	 (particle_system_burst,"psys_pistol_smoke",pos1,50),
    (try_end)
	]),
]],
For some reason it's still giving me a syntax error. Can anyone help me get this formatted correctly? :razz:
 
Specialist said:
["explosive1", "M14 Urban Camo Sniper", [("urban_camo_sniper",0)], itp_type_musket|itp_merchandise|itp_two_handed|itp_primary, itcf_shoot_musket|itcf_carry_spear|itcf_reload_musket, 683, weight(5.2)|difficulty(0)|spd_rtng(70)|shoot_speed(300)|thrust_damage(200,pierce)|max_ammo(20)|accuracy(150), imodbits_crossbow,
    [
(ti_on_weapon_attack,
    [
  (play_sound,"snd_pistol_shot")
    ]),
    [
  (ti_on_missile_hit,
    [
(play_sound,"snd_explosion"),   
(this_or_next|multiplayer_is_server),
(neg|game_in_multiplayer_mode),   
(store_trigger_param_1,":grenadier"),       
(try_for_agents,":target"),           
(agent_get_position,pos2,":target"),
(get_distance_between_positions,":dist",pos1,pos2),
(try_begin),
  (lt,":dist",250),
  (store_agent_hit_points,":hp",":target",1),
  (store_random_in_range,":dmg",60,100),
  (val_sub,":hp",":dmg"),
  (agent_set_hit_points,":target",":hp",1),
  (agent_deliver_damage_to_agent,":grenadier",":target"),
  (try_end),
(particle_system_burst,"psys_pistol_smoke",pos1,50),
    (try_end)
]),
]],
This bracket should be removed.
 
Heh, I was ninjaed. :smile:

Also, a hint. Never, never, never use both tabs and spaces for formatting. :smile:

P. S. This is my version of formatted code:

Code:
[
  "explosive1",
  "M14 Urban Camo Sniper",
  [("urban_camo_sniper",0)],
  itp_type_musket|itp_merchandise|itp_two_handed|itp_primary,
  itcf_shoot_musket|itcf_carry_spear|itcf_reload_musket,
  683,
  weight(5.2)|difficulty(0)|spd_rtng(70)|shoot_speed(300)|thrust_damage(200,pierce)|max_ammo(20)|accuracy(150),
  imodbits_crossbow,
  [
    (ti_on_weapon_attack, 
      [
        (play_sound,"snd_pistol_shot")
      ]
    ), 
  [color=red][[/color]
    (ti_on_missile_hit, 
      [
        (play_sound,"snd_explosion"),    
        (this_or_next|multiplayer_is_server),
        (neg|game_in_multiplayer_mode),    
        (store_trigger_param_1,":grenadier"),        
        (try_for_agents,":target"),            
          (agent_get_position,pos2,":target"),
          (get_distance_between_positions,":dist",pos1,pos2),
          (try_begin),
            (lt,":dist",250),
            (store_agent_hit_points,":hp",":target",1),
            (store_random_in_range,":dmg",60,100),
            (val_sub,":hp",":dmg"),
            (agent_set_hit_points,":target",":hp",1),
            (agent_deliver_damage_to_agent,":grenadier",":target"),
          (try_end),
          (particle_system_burst,"psys_pistol_smoke",pos1,50),
        (try_end)
      ]
    ),
  ]
],
 
It compiled properly.... but it won't work in-game. What could I be doing wrong? :sad:

More specifically.... the script for the "ti_on_weapon_attack" script works fine. But for the missile explosion, it won't
 
ti_on_missile_hit only works for ammunition items. Use agent_get_wielded_item to check for your item instead (the agent might switch to melee before the missile hits, so use agent_has_item_equipped for bots).
 
Right.... but you said to use "agent_has_item_equipped" or "agent_get_wielded_item". Would I use them in conjunction? :???:
 
I think he means it like this: place your script in the ammo item and checkt there what item the shooter has in his hands. If it is your weapon, let the bullet explode.
 
I have stumbled into a very weird problem: when I load a BRF with a single mesh into the game, the game will crash when I try to enter a tavern in the town menu, even though the mesh is not even used or referenced anywhere.

Can anyone help me with this? You can download the BRF from MB Repository: --removed--.

CASE SOLVED. See thread http://forums.taleworlds.com/index.php/topic,192892.msg4619672.html#msg4619672 for details.
 
I have really unnormal problem  :shock: So, build_module works good, 0 errors. Ewerything is good. But in game changes nothing! What can be wrong? Module_info is good, module.ini too.
 
I changed thrust 2h sword animation, added one new item and added two items to swadian crossbowman in multiplayer.
Edit: Wait, I had 2 MS folders, now I have one... Brb.
Now I have faction errors. So messy... I will edit post later.
Ok, so: I re-made MS "test" and MS "mod" folders, no mess now :wink: And changed one small detail:
Before:
export_dir = "C:/Program Files/Steam/SteamApps/common/mountblade warband/modules/test"
After:
export_dir = "C:/Program Files/Steam/SteamApps/common/mountblade warband/modules/test/"
Anyway, sorry for trouble and thanks for help (I started thinking about MS two folders) and it works now :smile:
 
Status
Not open for further replies.
Back
Top Bottom