Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Somebody said:
cucas said:
Is there a way to change projectile speed throught scripting (outside the module_items.py)?

I want to make ranged weapons unable to shoot so far during bad weather conditions, like fog, rain, or snow. The only way I know to reduce range is to reduce the projectile speed...
Consider what you're trying to accomplish and whether it's feasible or not - are you able to predict the weather system? It is possible to intercept when ranged weapons are shot, and you are able to modify the shoot speed so the projectile falls straight down. While you can use add_missile to create your custom projectile, the AI won't know that unless you create duplicate versions of every item for the player and AI - these are some of the obvious ramifications with over-engineering this feature, considering there already is a penalty for crossbow types during rain hardcoded in the engine.

I'm not much of a programmer, but I already gave that a thought. I already have a weather script going on and it seems to works just fine. Assuming I can use the same weather variables and convert them into penalties it should work out fine as well I guess?

The issue here is that even though I've searched the forums, commands and so on, I couldn't find any operation to do something as "simple" (to me) as slowing projectiles or shorten range, so I thought of this as a last resort. Maybe "somebody" could know a way?  :razz:

I really wanted a simple working system and duplicating items really isn't gonna cut it out for me, I guess... Besides the duplicating of stuff, I found a lot of related operatons like speed and aim modifiers, but not what I was looking for. There should be something that could enable us to modify item properties, like speed and even flags. Closest I got was attrition (not even item related) and it still lead no where :sad:
 
jacobhinds said:
How can I make a particle effect trigger when a bullet hits the ground? thanks.

Code:
ti_on_missile_hit        = -52.0 #can only be used in module_items triggers
# Position Register 1: Missile Position
# Trigger Param 1: shooter agent id

put that trigger to ammo item (in module_items) (in your case, bullet item), and then use
Code:
(particle_system_burst,<par_sys_id>, pos1,[percentage_burst_strength]),
 
cucas said:
I'm not much of a programmer, but I already gave that a thought. I already have a weather script going on and it seems to works just fine. Assuming I can use the same weather variables and convert them into penalties it should work out fine as well I guess?

The issue here is that even though I've searched the forums, commands and so on, I couldn't find any operation to do something as "simple" (to me) as slowing projectiles or shorten range, so I thought of this as a last resort. Maybe "somebody" could know a way?  :razz:

I really wanted a simple working system and duplicating items really isn't gonna cut it out for me, I guess... Besides the duplicating of stuff, I found a lot of related operatons like speed and aim modifiers, but not what I was looking for. There should be something that could enable us to modify item properties, like speed and even flags. Closest I got was attrition (not even item related) and it still lead no where :sad:
Why don't you temporarily reduce their proficiency, but increase their accuracy to just shorten their range to make shots more weak than inaccurate?
 
The_dragon said:
jacobhinds said:
How can I make a particle effect trigger when a bullet hits the ground? thanks.

Code:
ti_on_missile_hit        = -52.0 #can only be used in module_items triggers
# Position Register 1: Missile Position
# Trigger Param 1: shooter agent id

put that trigger to ammo item (in module_items) (in your case, bullet item), and then use
Code:
(particle_system_burst,<par_sys_id>, pos1,[percentage_burst_strength]),

Thanks, works perfectly.
 
# British
["british_baker_rifle", "Rifle", [("baker_rifle",0)], itp_type_crossbow |itp_merchandise|itp_primary|itp_two_handed|itp_cant_reload_on_horseback|itp_cant_reload_while_moving|itp_next_item_as_melee ,itcf_shoot_musket|itcf_carry_crossbow_back,
683 , weight(3.0)|difficulty(0)|spd_rtng(300) | shoot_speed(250) | thrust_damage(300 ,pierce)|max_ammo(1)|accuracy(87),imodbits_none,[]],
# [(ti_on_weapon_attack, [(store_trigger_param_1,":user_agent"),(call_script, "script_server_fire_musket", ":user_agent", firearm_type_rifle)])]],
["british_baker_rifle_melee", "Rifle", [("baker_rifle",0)], itp_has_upper_stab|itp_type_polearm |itp_primary|itp_no_blur|itp_offset_musket,itc_musket_melee|itcf_carry_crossbow_back,
180 , weight(3.0)|difficulty(0)|spd_rtng(84) | weapon_length(85)|swing_damage(40 , blunt) | thrust_damage(30 ,  blunt),imodbits_none ],

Any Idea why this code isn't working ? I want to speed up the reload of the rifle and make it higher damage but when I change the code and recompile nothing changes in game ? I am also selecting the 92nd rifles on the uk team as that is the rifle I can see that they use in the troops file.

Ammo
["bullets","Cartridges", [("cartridge_box_mesh",0),("bullet_projectile",ixmesh_flying_ammo),("cartridge_a",ixmesh_inventory)], itp_type_bolts|itp_merchandise|itp_default_ammo|itp_can_penetrate_shield, 0, 64,weight(2.0)|abundance(90)|weapon_length(1)|thrust_damage(1,pierce)|max_ammo(1),imodbits_missile,
[(ti_on_missile_hit, [(copy_position,pos63,pos1),(store_trigger_param_2, ":collision_type"),(call_script, "script_mm_on_bullet_hit",":collision_type")])]],
Also I want to change the rifle so it has only one shot so I attempted to change the max ammo of the bullets to 1 however that also changed nothing in game ?
 
Did you test the changes on a server with those modifications?

I launched mount & blade warband and selected the module and launched the game. Then I went to multiplayer and set up a server to test it. I assume this is what you mean ?
 
Fraser said:
I launched mount & blade warband and selected the module and launched the game. Then I went to multiplayer and set up a server to test it. I assume this is what you mean ?

Now...are you sure that the output folder is set correctly in module_info?
 
Now...are you sure that the output folder is set correctly in module_info?
I have double checked this but have found no issues with it are you sure there is nothing wrong with the code.
 
I am trying to get the exact position at which the crosshair is looking at, I need it for a couple of scripts in my mod (as without it they are useless). I realise that the cast ray feature of WSE would do this but I would rather not use WSE.

The below code works (roughly) however (position_has_line_of_sight_to_position) does not take into account units, which I need taken into account

Code:
ray_test = (
   1, 0, 0,
   [],
   [(mission_cam_get_position, pos1),
    (copy_position,pos2,pos1), # position 1 is the initial cam position, position 2 will be moved until it is lost from line of sight
    (position_move_y,pos2,1),
    (assign, ":ray_max", 10001), # ray_max functions like total ray length (without intersecting anything) 10000 is a tad glitchy
    (try_for_range, ":ray_iteration", 0, ":ray_max"), 
       (position_has_line_of_sight_to_position,pos1,pos2), # if pos 2 is in line of sight of pos 1 
       (position_move_y, pos2, 1),
       (assign, ":ray_collision",":ray_iteration"), # assigns iteration on which ray collides to to :ray_collision
   (try_end),
   (assign, reg1,":ray_collision"),
   (display_message, "@ray collides at a distance of {reg1}"), # states distance at which ray collides

#everything below is just for debug, I use a separate script to spawn a prop at the beginning and then the following moves it to position 2 (the collision position)
  (scene_prop_get_num_instances, ":num_rays", "spr_prop_ray_tracer"),
      (try_for_range, ":ray_no", 0, ":num_rays"),
        (scene_prop_get_instance, ":ray_id", "spr_prop_ray_tracer", ":ray_no"),
        (prop_instance_set_position, ":ray_id", pos2),
        (prop_instance_animate_to_position, ":ray_id", pos2, 1),
      (try_end),
])

Does anyone know how I could edit the above (or an alternative) to take into account any units the "ray" passes through, was thinking that possibly if I were to spawn a missile it might work but im not sure. Any help would be much appreciated
 
Hello people.

I have a theoretical question.
After browsing through Native textures I found one 1024x1024 texture named "costumes_lod.dds" which contains smaller versions of textures for almost every armour model.lod2 (and higher) in game.
So my question is does this have any purpose concerning performance?
Is it better for .lod models to have one texture which loads them all, or is it the same as having mipmaps on each of the textures?
 
Silver Wolf said:
Hello people.

I have a theoretical question.
After browsing through Native textures I found one 1024x1024 texture named "costumes_lod.dds" which contains smaller versions of textures for almost every armour model.lod2 (and higher) in game.
So my question is does this have any purpose concerning performance?
Is it better for .lod models to have one texture which loads them all, or is it the same as having mipmaps on each of the textures?

.lod textures generally aren't worth the effort, or performance in most cases. if the main texture's already loaded, there's not much point in having separate .lod textures. it's just another texture for the game to load.
Sometimes the game uses .lod materials, a little bit wiser imo. they often cut out specular and bumpmaps. but even in that case it often isn't worth the effort of going into every .brf and changing it, unless you have a uniform that turns up a lot, i.e. almost every battle. .lod meshes seem to impact performance the most.
 
Code:
(try_for_range, ":faction_no", kingdoms_begin, kingdoms_end),
Doesn't effect minor factions. That is used in many scripts, simple triggers, etc., searching for just that line of code should bring up some results for you. There are many other lines like that, such as:
Code:
(is_between, ":faction_id", kingdoms_begin, kingdoms_end),
Just searching for kingdoms_end will get the most results for you, I think.

Hope this helps. :smile:
 
Status
Not open for further replies.
Back
Top Bottom