Author Topic: Have a question about Modding? Ask Here!  (Read 309603 times)

0 Members and 1 Guest are viewing this topic.

Offline habsburg

  • First Sergeant
  • *
  • Posts: 42
    • View Profile
  • Nick: kk_KR_Nr4_ViCpl_Habsburg
  • Side: Neutral
Re: Have a question about Modding? Ask Here!
« Reply #1770 on: May 23, 2019, 03:08:22 pm »
hello another question:
I'm working on some stuff for myself and I've met a problem.
My Goal:
Spoiler
[close]
How its supposed to behave ingame:
Spoiler
[close]
How its behaving:
Spoiler
[close]

So the problem here is that the gorget (the thing that protects the chin) wont attach to the breastplate. I've tried whatever, I attached the model to the spine, then ingame it was hovering infront of me. So what I did was move the helmet into the correct position with the Roto-translate-rescale option, but well, now I cant get it to attach to the cuirass and it sortof sits on the head and the gorget clips through the armor.

plox halp

Edit: Found a different way, problem solved.
« Last Edit: May 23, 2019, 05:40:50 pm by habsburg »

Offline Zebaad

  • First Lieutenant
  • *
  • Posts: 879
  • alea iacta est
    • View Profile
    • Bastion Maps
  • Nick: 47th_Cpt_Zebaad_Peritz
  • Side: Union
Re: Have a question about Modding? Ask Here!
« Reply #1771 on: May 28, 2019, 07:57:06 pm »
Hi there! I am working on a mod for a server, and a map and have been stumped by two things:

One- I would like to enable a custom button that is only usable when a player has a specific item equipped*.

Two- Similarly, I would like a custom button that returns a player to full health*.
Initial Test
This was what I created initially, but it does not seem to work correctly:
      
Code
  (try_begin),
(player_get_agent_id, ":value_agent_id", ":value"),
(agent_is_active,":value_agent_id"),
(agent_is_alive, ":value_agent_id"),
(agent_set_hit_points, ":player_id", 100, 0),
(try_end),
[close]

*The custom button part I have sorted, it's just the actual function of each part I can't seem to get to work correctly.


Offline Grozni

  • Second Lieutenant
  • *
  • Posts: 308
    • View Profile
  • Nick: RRA_10thRH_SoH_Grozni
  • Side: Neutral
Re: Have a question about Modding? Ask Here!
« Reply #1772 on: May 28, 2019, 08:04:11 pm »
Hi there! I am working on a mod for a server, and a map and have been stumped by two things:

One- I would like to enable a custom button that is only usable when a player has a specific item equipped*.

Two- Similarly, I would like a custom button that returns a player to full health*.
Initial Test
This was what I created initially, but it does not seem to work correctly:
      
Code
  (try_begin),
(player_get_agent_id, ":value_agent_id", ":value"),
(agent_is_active,":value_agent_id"),
(agent_is_alive, ":value_agent_id"),
(agent_set_hit_points, ":player_id", 100, 0),
(try_end),
[close]

*The custom button part I have sorted, it's just the actual function of each part I can't seem to get to work correctly.


You are trying to set agent hit points on the player, it should be the agent.

Offline Jack

  • First Lieutenant
  • *
  • Posts: 403
  • Honneur et Fidélité
    • View Profile
  • Side: Neutral
Re: Have a question about Modding? Ask Here!
« Reply #1773 on: June 03, 2019, 04:24:51 pm »
Hello guys,

I have managed to add back crossbows (animations and sounds) to a Napoleonic Wars based mod and have both crossbows and muskets working properly but I have an issue with the particles. I would like to restrict the smoke and explosions to muskets and pistols only (in other words only itp_type_musket and itp_type_pistol items and not itp_type_crossbow items).

In order to do that what do I need to modify in this bit of code?

Code
  ("game_missile_launch",
    [
    (try_begin),
      (neg|multiplayer_is_dedicated_server),
     
      (store_script_param, ":agent_id", 1),
      (store_script_param, ":item_id", 2),
      (store_script_param, ":missile_weapon_id", 3),
     
      (agent_is_active,":agent_id"),
      (agent_is_alive,":agent_id"),
      (neq,":missile_weapon_id","itm_cannon_canister_dummy"),
     
      (set_fixed_point_multiplier, 100),
      (copy_position,pos41,pos1),
     
      (assign, ":sound_id", -1),
      (assign, ":muzzle_y", 0),
      (assign, ":muzzle_x", -16),
      (assign, ":muzzle_y_rot", 0),
      (assign, ":has_pan", 1),
     # (assign, ":pan_y", 0),
      (assign, ":smoke_size", 17),
      (assign, ":spark_size", 100),
      (assign, ":pan_smoke_size", 8),
      (try_begin),
        (is_between,":item_id","itm_french_cav_pistol","itm_french_mousquiton"), # Pistols
        (assign, ":sound_id", "snd_pistol"),
        (assign, ":muzzle_y", 44),
        (assign, ":muzzle_x", 0),
        (assign, ":muzzle_y_rot", -45),
        (assign, ":has_pan", 0),
        (assign, ":smoke_size", 14),
        (assign, ":spark_size", 40),
      (else_try),
        (is_between,":item_id","itm_french_mousquiton","itm_russian_rifle_1805"), # Carabines
        (assign, ":sound_id", "snd_musket"), #  snd_carabine
        (assign, ":muzzle_y", 104),
      (else_try),
        (is_between,":item_id","itm_russian_rifle_1805","itm_french_charleville"), # Rifles
        (assign, ":sound_id", "snd_rifle"),
        (assign, ":muzzle_y", 90),
      (else_try),
        (is_between,":item_id","itm_french_charleville","itm_french_art_off_sword"), # Muskets
        (assign, ":sound_id", "snd_musket"),
        (assign, ":muzzle_y", 132),
      (try_end),
     
      (try_begin),
        (call_script, "script_client_get_my_agent"),
        (eq, ":agent_id", reg0), # shooting myself.
       
        # particles for myself 65% so i can see what I shoot at.
        (val_mul,":smoke_size", 65),
        (val_div,":smoke_size", 100),
        (val_mul,":pan_smoke_size", 65),
        (val_div,":pan_smoke_size", 100),
      (try_end),
       
      # Sounds
      (gt, ":sound_id", -1),
      (play_sound_at_position, ":sound_id", pos41),     

      # Default movement
      (position_move_x,pos41,":muzzle_x"),
      (position_move_y,pos41,18),

      # pan flash and smoke..
      (try_begin),
        (eq,":has_pan",1),
       
        (particle_system_burst_no_sync, "psys_pan_smoke", pos41, ":pan_smoke_size"),
        #(position_rotate_z, pos41, 45),
        (particle_system_burst_no_sync, "psys_pan_flash", pos41, 4),
        #(position_rotate_z, pos41, -45),
      (try_end),
     
      # the fire particles
      (position_rotate_z,pos41,":muzzle_y_rot"),
      (position_move_y,pos41,":muzzle_y"),
      (particle_system_burst_no_sync, "psys_musket_smoke", pos41, ":smoke_size"),
      (particle_system_burst_no_sync, "psys_musket_flash", pos41, ":spark_size"),
      #(particle_system_burst_no_sync, "psys_musket_sparks", pos41, ":spark_size"),
    (try_end),
  ]),

I don't know if anyone tried before. Any help would be greatly appreciated.
"For fangs I may have none but I have mind and it is sharper than any tooth."

Offline Grozni

  • Second Lieutenant
  • *
  • Posts: 308
    • View Profile
  • Nick: RRA_10thRH_SoH_Grozni
  • Side: Neutral
Re: Have a question about Modding? Ask Here!
« Reply #1774 on: June 03, 2019, 04:57:33 pm »
Hello guys,

I have managed to add back crossbows (animations and sounds) to a Napoleonic Wars based mod and have both crossbows and muskets working properly but I have an issue with the particles. I would like to restrict the smoke and explosions to muskets and pistols only (in other words only itp_type_musket and itp_type_pistol items and not itp_type_crossbow items).

In order to do that what do I need to modify in this bit of code?

Code
  ("game_missile_launch",
    [
    (try_begin),
      (neg|multiplayer_is_dedicated_server),
     
      (store_script_param, ":agent_id", 1),
      (store_script_param, ":item_id", 2),
      (store_script_param, ":missile_weapon_id", 3),
     
      (agent_is_active,":agent_id"),
      (agent_is_alive,":agent_id"),
      (neq,":missile_weapon_id","itm_cannon_canister_dummy"),
     
      (set_fixed_point_multiplier, 100),
      (copy_position,pos41,pos1),
     
      (assign, ":sound_id", -1),
      (assign, ":muzzle_y", 0),
      (assign, ":muzzle_x", -16),
      (assign, ":muzzle_y_rot", 0),
      (assign, ":has_pan", 1),
     # (assign, ":pan_y", 0),
      (assign, ":smoke_size", 17),
      (assign, ":spark_size", 100),
      (assign, ":pan_smoke_size", 8),
      (try_begin),
        (is_between,":item_id","itm_french_cav_pistol","itm_french_mousquiton"), # Pistols
        (assign, ":sound_id", "snd_pistol"),
        (assign, ":muzzle_y", 44),
        (assign, ":muzzle_x", 0),
        (assign, ":muzzle_y_rot", -45),
        (assign, ":has_pan", 0),
        (assign, ":smoke_size", 14),
        (assign, ":spark_size", 40),
      (else_try),
        (is_between,":item_id","itm_french_mousquiton","itm_russian_rifle_1805"), # Carabines
        (assign, ":sound_id", "snd_musket"), #  snd_carabine
        (assign, ":muzzle_y", 104),
      (else_try),
        (is_between,":item_id","itm_russian_rifle_1805","itm_french_charleville"), # Rifles
        (assign, ":sound_id", "snd_rifle"),
        (assign, ":muzzle_y", 90),
      (else_try),
        (is_between,":item_id","itm_french_charleville","itm_french_art_off_sword"), # Muskets
        (assign, ":sound_id", "snd_musket"),
        (assign, ":muzzle_y", 132),
      (try_end),
     
      (try_begin),
        (call_script, "script_client_get_my_agent"),
        (eq, ":agent_id", reg0), # shooting myself.
       
        # particles for myself 65% so i can see what I shoot at.
        (val_mul,":smoke_size", 65),
        (val_div,":smoke_size", 100),
        (val_mul,":pan_smoke_size", 65),
        (val_div,":pan_smoke_size", 100),
      (try_end),
       
      # Sounds
      (gt, ":sound_id", -1),
      (play_sound_at_position, ":sound_id", pos41),     

      # Default movement
      (position_move_x,pos41,":muzzle_x"),
      (position_move_y,pos41,18),

      # pan flash and smoke..
      (try_begin),
        (eq,":has_pan",1),
       
        (particle_system_burst_no_sync, "psys_pan_smoke", pos41, ":pan_smoke_size"),
        #(position_rotate_z, pos41, 45),
        (particle_system_burst_no_sync, "psys_pan_flash", pos41, 4),
        #(position_rotate_z, pos41, -45),
      (try_end),
     
      # the fire particles
      (position_rotate_z,pos41,":muzzle_y_rot"),
      (position_move_y,pos41,":muzzle_y"),
      (particle_system_burst_no_sync, "psys_musket_smoke", pos41, ":smoke_size"),
      (particle_system_burst_no_sync, "psys_musket_flash", pos41, ":spark_size"),
      #(particle_system_burst_no_sync, "psys_musket_sparks", pos41, ":spark_size"),
    (try_end),  ]),

I don't know if anyone tried before. Any help would be greatly appreciated.

Untested but it should work:

Near top of the script add
Code
(assign, ":use_particles", 1),

Then add one more conditional check where item types are checked

Code
....
(else_try),
        (is_between,":item_id","itm_first_crossbow_item","itm_item_after_crossbows"), # Crossbows # replace with actual item IDs
        (assign, ":sound_id", "snd_crossbow"), #replace with your sound name
        (assign, ":use_particles", 0), #disable particles
(try_end),
....
#btw this will only work if your crossbow items are grouped separately in items file, if they are mixed in with muskets you would have to add this check to be the first check rather than the last.

Then below block of code which plays sound, just above  the line "# Default movement" add:

Code
(eq, ":use_particles", 1), #continue if particles are used

Offline Wzee

  • Volunteer
  • *
  • Posts: 1
    • View Profile
Re: Have a question about Modding? Ask Here!
« Reply #1775 on: June 03, 2019, 05:22:48 pm »
Code
		(try_begin),
(player_get_unique_id, ":player_key", ":agent_no"),
(agent_is_active, ":agent_no"),
(eq, ":player_key", 1524646),

(agent_equip_item,":agent_no","itm_pirate_hat"),
(try_for_players, ":player_no", 1),
(agent_is_active, ":player_no"),
(multiplayer_send_3_int_to_player, ":player_no", multiplayer_event_return_agent_set_item, ":agent_no", "itm_pirate_hat", 4),
(try_end),
(try_end),

I'm trying to set specific player hats upon joining

Code
 SCRIPT WARNING ON OPCODE 441: Invalid Player ID: 15; LINE NO: 19: 

Upon joining the server is spammed with the error above Sorry if the code is dumb I'm still learning

Offline Jack

  • First Lieutenant
  • *
  • Posts: 403
  • Honneur et Fidélité
    • View Profile
  • Side: Neutral
Re: Have a question about Modding? Ask Here!
« Reply #1776 on: June 03, 2019, 06:38:57 pm »
Thanks Grozni, it works perfectly :D
"For fangs I may have none but I have mind and it is sharper than any tooth."

Offline Grozni

  • Second Lieutenant
  • *
  • Posts: 308
    • View Profile
  • Nick: RRA_10thRH_SoH_Grozni
  • Side: Neutral
Re: Have a question about Modding? Ask Here!
« Reply #1777 on: June 03, 2019, 07:01:46 pm »
Code
		(try_begin),
(player_get_unique_id, ":player_key", ":agent_no"),
(agent_is_active, ":agent_no"),
(eq, ":player_key", 1524646),

(agent_equip_item,":agent_no","itm_pirate_hat"),
(try_for_players, ":player_no", 1),
(agent_is_active, ":player_no"),
(multiplayer_send_3_int_to_player, ":player_no", multiplayer_event_return_agent_set_item, ":agent_no", "itm_pirate_hat", 4),
(try_end),
(try_end),

I'm trying to set specific player hats upon joining

Code
 SCRIPT WARNING ON OPCODE 441: Invalid Player ID: 15; LINE NO: 19: 

Upon joining the server is spammed with the error above Sorry if the code is dumb I'm still learning

You are using agent instead of player at player_get_unique_id, and player instead of agent at agent_is_active.


You're welcome.
Thanks Grozni, it works perfectly :D

Offline PelvicThrust

  • First Sergeant
  • *
  • Posts: 514
  • 32nd Regiment of Foot - Light Infantry
    • View Profile
  • Side: Union
Re: Have a question about Modding? Ask Here!
« Reply #1778 on: July 18, 2019, 12:47:28 am »
Hey guys I am really struggling with Plumes on helmets,

Namely for the British Coldstream Officer (I added a plume on)
British Hussar Serjeant/Officer (Added a plume on)
Light Infantry/Rifle Officer Officer Plume

I don't know what the fuck I've done, but after I zoom out a certain degree the plume disappears, I am sure it has something to do with LOD's.
But I have tried every type of combination I can, I have mimicked other classes also with plumes and copied their LOD text, but still the plumes disappear after a certain duration.
Any ideas?

Offline PelvicThrust

  • First Sergeant
  • *
  • Posts: 514
  • 32nd Regiment of Foot - Light Infantry
    • View Profile
  • Side: Union
Re: Have a question about Modding? Ask Here!
« Reply #1779 on: July 18, 2019, 09:35:51 pm »
Fixed it, was a LOD issue (from what I can gather, if you hat has like 4 lods, so will the plume attached)

Offline Ivkolya

  • Sergeant Major
  • *
  • Posts: 333
    • View Profile
  • Nick: Ivkolya
  • Side: Neutral
Re: Have a question about Modding? Ask Here!
« Reply #1780 on: October 19, 2019, 09:30:54 pm »
Hello all, I have an issue with main menu of my mod, some lines overlap themselves, and there is a very large space between "Tutorial" and "Multiplayer" lines.



How can I fix it?

Offline Woeski

  • First Lieutenant
  • *
  • Posts: 234
  • (2Ch) - DDB - Mamluk
    • View Profile
    • 2Ch & BACM regiment
  • Nick: Woeski
  • Side: Neutral
Re: Have a question about Modding? Ask Here!
« Reply #1781 on: October 29, 2019, 04:52:21 pm »
Maybe you tried to remove the singleplayer in a way that this happens, you can also just remove the tutorial in the module.ini.


I also have a pretty simple question... when I try to make a new mission template just by copy pasting an old one and changing the name - I get an error... So my question is simply how do I make a new mission template  ???  :-\

Skaen

  • Guest
Re: Have a question about Modding? Ask Here!
« Reply #1782 on: April 17, 2020, 01:21:02 pm »
What file / setting changes the musket and cannon volume of distant sounds in NW? I want to make them a tiny bit louder so you can hear them in the distance a bit better.

Offline Waffss

  • Volunteer
  • *
  • Posts: 3
    • View Profile
Re: Have a question about Modding? Ask Here!
« Reply #1783 on: April 18, 2020, 04:49:56 pm »
I created my own troop on NW and gave it a list of weapons but every time I respawn I stay with the same weapon.
I want the troop to work exactly as partizani in NW

Thanks in advance

Offline Woeski

  • First Lieutenant
  • *
  • Posts: 234
  • (2Ch) - DDB - Mamluk
    • View Profile
    • 2Ch & BACM regiment
  • Nick: Woeski
  • Side: Neutral
Re: Have a question about Modding? Ask Here!
« Reply #1784 on: April 19, 2020, 04:23:07 pm »
I created my own troop on NW and gave it a list of weapons but every time I respawn I stay with the same weapon.
I want the troop to work exactly as partizani in NW

Thanks in advance

So you added several items to the unit in troops.py (like I believe you already did). Now here comes the script part.

Open scripts.py search (ctrl + F) for the comment line '# And randomise your item selection ^^'.
You should see this:
Code
         
(try_begin), # And randomise your item selection ^^
           (player_get_troop_id,":my_troop_id",":my_player_no"),
           (this_or_next|eq,":my_troop_id","trp_russian_partizan"),
           (eq,":my_troop_id","trp_russian_cossack"),
Then you should copy the line '(this_or_next|eq,":my_troop_id","trp_russian_partizan"),' under itself and change the trp_russian_partizan with your unit (remember the trp_ prefix).



What file / setting changes the musket and cannon volume of distant sounds in NW? I want to make them a tiny bit louder so you can hear them in the distance a bit better.

I think maybe in scripts.py at the script:   # script_multiplayer_server_play_sound_at_position

But I don't really know... honestly I never really noticed distant sounds in the game anyway...  :-\