Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
mr.master: since after v1.134 ti_on_weapon_attack fires on the server as well, so the first event is not necessary any more; I'd just make a script that sends the play sound message to clients from the server and call it from the attack trigger, like this:
Code:
("agent_play_sound",
 [(try_begin),
    (multiplayer_is_server),
    (store_script_param, ":agent_id", 1),
    (store_script_param, ":sound_id", 2),

    (get_max_players, ":max_players"),
    (try_for_range, ":player_id", 0, ":max_players"),
      (player_is_active, ":player_id"),
      (multiplayer_send_2_int_to_player, ":player_id", multiplayer_event_agent_play_sound, ":agent_id", ":sound_id"),
    (try_end),
  (try_end),
  ]),
...
  (else_try),
    (eq, ":event_type", multiplayer_event_agent_play_sound),
    (store_script_param, ":agent_id", 3),
    (store_script_param, ":sound_id", 4),
    (try_begin),
      (agent_is_active, ":agent_id"),
      (agent_is_alive, ":agent_id"),
      (agent_play_sound, ":agent_id", ":sound_id"),
    (else_try),
      (play_sound, ":sound_id", 0),
    (try_end),
...
 (ti_on_weapon_attack, [(store_trigger_param_1, ":agent_id"), (call_script, "script_agent_play_sound", ":agent_id", "snd_k98")])
All the (neq, ":player_no", 0) and (neg|is_between, ":agent", 0, 200) are confusing and unnecessary: just use player_is_active or agent_is_active, as these check to see if any given id is currently valid.
 
Thanks :smile: Ill test it with a few players later on today. Anyways, Any idea why this wont work?


Code:
			(multiplayer_send_int_to_server,multiplayer_event_animation_at_player, "anim_fall_in_pain"),
			(multiplayer_send_message_to_server,multiplayer_event_animation_begins_at_player),
			(agent_get_animation_progress, ":anim_progress", ":cur_agent_id", 1),
			(eq, ":anim_progress", 100),
			(try_begin),
				(multiplayer_send_int_to_server,multiplayer_event_animation_at_player, "anim_fall_in_pain_continue"),
				(multiplayer_send_message_to_server,multiplayer_event_animation_begins_at_player),
			(try_end)
,
 
mr.master said:
Thanks :smile: Ill test it with a few players later on today. Anyways, Any idea why this wont work?


Code:
			(multiplayer_send_int_to_server,multiplayer_event_animation_at_player, "anim_fall_in_pain"),
			(multiplayer_send_message_to_server,multiplayer_event_animation_begins_at_player),
			(agent_get_animation_progress, ":anim_progress", ":cur_agent_id", 1),
			(eq, ":anim_progress", 100),
			(try_begin),
				(multiplayer_send_int_to_server,multiplayer_event_animation_at_player, "anim_fall_in_pain_continue"),
				(multiplayer_send_message_to_server,multiplayer_event_animation_begins_at_player),
			(try_end)
,
What's it supposed to do? The try statement seems strange to me. Did you want to put (eq, ":anim_progress", 100) inside it? Because otherwise you could just remove try_begin and try_end.


Also, I have a problem with particles. For some reason this particle system (when called with particle_system_add_new) is only visible when you look at it from a certain angle and when you are near enough. It's not the mesh. Changing it didn't affect it.
Code:
	("laser", psf_always_emit, "laser_bolt_red",
     1, 1, 1, 0, 1, 1,     #num_particles, life, damping, gravity_strength, turbulance_size, turbulance_strength
     (0.2, 1.0), (1.0, 1.0),        #alpha keys
     (0.1, 0.5), (1, 0.5),      #red keys
     (0.1, 0.5),(1, 0.5),       #green keys
     (0.1, 0.5), (1, 0.5),      #blue keys
     (0.0, 2.0),   (1, 2.0),          #scale keys
     (0.1, 0.1, 0.1),           #emit box size
     (0, 200, 0),               #emit velocity
     0.01                       #emit dir randomness
    ),
 
Highlander: I don't know why it's only visible from a certain angle and distance, as particles have worked fine for me in MP, but has it occurred to you to use a gun item that fires bullets with itp_ignore_gravity|itp_ignore_friction set, instead?
 
Vornne said:
Highlander: I don't know why it's only visible from a certain angle and distance, as particles have worked fine for me in MP, but has it occurred to you to use a gun item that fires bullets with itp_ignore_gravity|itp_ignore_friction set, instead?
Yeah, I didn't have problems with particles before either. It actually works with particle_system_burst. But I want to make it emit constantly from a scene prop.
Yeah, I thought about spawning a missile, or using burst every once in a while, but I don't like that idea too much.
 
As far as i have seen till now, particle systems seem to be only visible when
a) The point were the particle system is emitted from is in your screen and not outside of it
b) the mesh is still the normal mesh and no .lod. When a .lod mesh is visible and not the original mesh it seems that the game does not display the particle systems too.

At least that is what I found out in my tests with a torch and a campfire.
 
Highlander said:
Also, I have a problem with particles. For some reason this particle system (when called with particle_system_add_new) is only visible when you look at it from a certain angle and when you are near enough. It's not the mesh. Changing it didn't affect it.
I believe the problem you're talking about is this:
Patta said:
As far as i have seen till now, particle systems seem to be only visible when
a) The point were the particle system is emitted from is in your screen and not outside of it
I've reported it in the bug tracker, plus added the fix to WSE until (if) they fix it.
 
Sorry to come back to this, but it seems that it wasn't missing any loop enders etc for the problem with agents not getting hit with the artillery script:


Code:
artillery_strike = (1, 5, 0,   #Artillery strike!
          [
                   (scene_prop_get_instance, ":shell", "spr_artillery_shell", 0),
                   (prop_instance_get_position, pos1, ":shell"),
                   (position_get_z, ":height", pos1),
                   (gt,":height", 10),
      
              ], 
      
	   [       (play_sound, "snd_bomb"),
                   (play_sound, "snd_artillery_fall"),
				   (call_script, "script_shake_camera", 50, 3, 5), # no. of shakes, max rotate x, max rotate z

                   #(multiplayer_is_server),
                   (scene_prop_get_instance, ":shell", "spr_artillery_shell", 0),
                   #(ge, ":shell", 0),
                   (prop_instance_get_position, pos1, ":shell"),
                   #(position_get_z, ":height", pos1),
                  #(try_begin),
                   #(gt, ":height", 10),
                   (copy_position, pos2, pos1),
                   (copy_position, pos3, pos1),
                   (copy_position, pos4, pos1),

		   (store_random_in_range, ":rand_x", -600, 600), #Store random in range from -5 to 6.
		   (store_random_in_range, ":rand_y", -600, 600),
		   (store_random_in_range, ":rand_z", 0, 4000),
		   (position_move_x, pos1, ":rand_x"),
		   (position_move_y, pos1, ":rand_y"),
		   (position_move_z, pos1, ":rand_z"),
		   (store_random_in_range, ":rand_x2", -600, 600), #Store random in range from -5 to 6.
		   (store_random_in_range, ":rand_y2", -600, 600),
		   (store_random_in_range, ":rand_z2", 0, 4000),
		   (position_move_x, pos2, ":rand_x2"),
		   (position_move_y, pos2, ":rand_y2"),
		   (position_move_z, pos2, ":rand_z2"),
		   (store_random_in_range, ":rand_x3", -600, 600), #Store random in range from -5 to 6.
		   (store_random_in_range, ":rand_y3", -600, 600),
		   (store_random_in_range, ":rand_z3", 0, 4000),
		   (position_move_x, pos3, ":rand_x3"),
		   (position_move_y, pos3, ":rand_y3"),
		   (position_move_z, pos3, ":rand_z3"),

		(assign, ":agent_list", -1),
		(try_for_agents, ":agent"),
		    (agent_is_active, ":agent"),
			(val_add, ":agent_list", 1),
		(try_end),

	           (assign, ":end_cond", 300),
	         (try_for_range, reg1, 0, ":end_cond"),
                   
                     (position_move_z, pos1, -300),
		     (particle_system_burst, "psys_dummy_smoke", pos1, 30),
                     (position_move_z, pos2, -300),
		     (particle_system_burst, "psys_dummy_smoke", pos2, 30),
                     (position_move_z, pos3, -300),
		     (particle_system_burst, "psys_dummy_smoke", pos3, 30),

		     (position_get_distance_to_ground_level, ":distance", pos1),
		     (position_get_distance_to_ground_level, ":distance2", pos2),
		     (position_get_distance_to_ground_level, ":distance3", pos3),

	            (assign, ":agent_end_cond", ":agent_list"),
                    (try_begin),
		     (le, ":distance", 200),
		     (particle_system_burst, "psys_village_fire_big", pos1, 40),
                        (try_begin),
			#Check if the artillery has hit an agent.
			(try_for_range, ":enemy_agent", 0, ":agent_end_cond"),
			    (neq, ":agent_end_cond", 0),
			    (agent_is_active, ":enemy_agent"),
				(agent_is_alive, ":enemy_agent"),
				
				#Get the distance between the shell and the possible enemy agent.
				(agent_get_position, pos5, ":enemy_agent"),
				(get_distance_between_positions, ":dist", pos1, pos5),
				
				#Damage agent if distance is sufficient and end the loops.
				(le, ":dist", 800),
				#(call_script, "script_shake_camera", 50, 3, 5), # no. of shakes, max rotate x, max rotate z
				(multiplayer_send_int_to_server, autofire_event_damage_enemy, ":enemy_agent"),
                        (try_end),
                        (try_end),
                    (try_end),
                    (try_begin),
		     (le, ":distance2", 200),
		     (particle_system_burst, "psys_village_fire_big", pos2, 40),
                        (try_begin),
			#Check if the artillery has hit an agent.
			(try_for_range, ":enemy_agent", 0, ":agent_end_cond"),
			    (neq, ":agent_end_cond", 0),
			    (agent_is_active, ":enemy_agent"),
				(agent_is_alive, ":enemy_agent"),
				
				#Get the distance between the shell and the possible enemy agent.
				(agent_get_position, pos6, ":enemy_agent"),
				(get_distance_between_positions, ":dist2", pos2, pos6),
				
				#Damage agent if distance is sufficient
				(le, ":dist2", 800), 
				(multiplayer_send_int_to_server, autofire_event_damage_enemy, ":enemy_agent"),
                                (try_end),
                        (try_end),
                    (try_end),
                    (try_begin),
		     (le, ":distance3", 200),
		     (particle_system_burst, "psys_village_fire_big", pos3, 40),
                        (try_begin),
			#Check if the artillery has hit an agent.
			(try_for_range, ":enemy_agent", 0, ":agent_end_cond"),
			    (neq, ":agent_end_cond", 0),
			    (agent_is_active, ":enemy_agent"),
				(agent_is_alive, ":enemy_agent"),
				
				#Get the distance between the shell and the possible enemy agent.
				(agent_get_position, pos7, ":enemy_agent"),
				(get_distance_between_positions, ":dist3", pos3, pos7),
				
				#Damage agent if distance is sufficient and end the loops.
				(le, ":dist3", 800), 
				(multiplayer_send_int_to_server, autofire_event_damage_enemy, ":enemy_agent"),
                                (try_end),
                        (try_end),
                    (try_end),
                    (try_begin),
                     (le, ":distance", 200),
                     (le, ":distance2", 200),
                     (le, ":distance3", 200),
		     (assign, ":end_cond", 0),
		     (assign, ":agent_end_cond", 0),
                     (position_set_z, pos4, -1000),
                     #(prop_instance_set_position, ":shell", pos4),
                    (try_end),
	          (try_end),
                 #(try_end),
	   ])


Code:
	    (eq, ":event_type", multiplayer_event_artillery_strike),
		(store_script_param, ":agent", 3),
                #(display_message, "@damage!"),
		#(player_get_agent_id, ":agent_no", ":player_no"),



		(store_random_in_range, ":damage", 50, 100),
		#e.g (agent_get_wielded_item, ":agent_no", 0),
		#(item_get_slot, ":damage_modifier", ":item", slot_item_damage_modifier),
		(store_agent_hit_points, ":hitpoints", ":agent", 1),
                (gt,":hitpoints", 0),
		(val_sub, ":hitpoints", ":damage"),
		(agent_set_hit_points, ":agent", ":hitpoints", 1),
		
		#Kill him if possible.
		(try_begin),
		    (le, ":hitpoints", 0),
			(agent_deliver_damage_to_agent, ":agent", ":agent"), # me, enemy
		(try_end), 

Code:
		    (eq, ":event_type", autofire_event_damage_enemy),
			(store_script_param, ":enemy_agent", 3),
			(ge, ":enemy_agent", 0),
			
			#Get the necessary data.
			(player_get_agent_id, ":agent_no", ":player_no"),
			(ge, ":agent_no", 0),
			(agent_get_wielded_item, ":wielded_item", ":agent_no", 0),
			(store_agent_hit_points, ":hit_points", ":enemy_agent", 1),
			(item_get_slot, ":damage_modifier_low", ":wielded_item", autofire_slot_damage_modifier_low),
			(item_get_slot, ":damage_modifier_high", ":wielded_item", autofire_slot_damage_modifier_high),
			(store_random_in_range, ":rand", ":damage_modifier_low", ":damage_modifier_high"),
			
			#Play firing sound at shooter.
			#(agent_play_sound, ":agent_no", "snd_pistol_shot"),
			
			#Damage the agent.
			(store_agent_hit_points, ":hit_points", ":enemy_agent", 1),
			(val_add, ":rand", ":damage_modifier_low"),
			(val_sub, ":hit_points", ":rand"),
			(val_max, ":hit_points", 0),
			(agent_set_hit_points, ":enemy_agent", ":hit_points", 1),
			
			#Check if we killed the agent.
			(try_begin),
			    (eq, ":hit_points", 0),
				(agent_deliver_damage_to_agent, ":agent_no", ":enemy_agent"),
			(try_end),
		(else_try),
		#Vader end

Right now I'm not entirely sure why it's not working. It used to work without problems, but for some reason, it has stopped damaging the agents.
 
Hello guys !

Can you please tell me, how to change banners above allied soldiers heads ?
There is a light-green border in SP, so you can easly see allies even on dark background, in MP it's gone - i would like to add this in MP too.

I'm not sure how it's working here - is this some image (I checked all textures but didn't find it) or is this border painted in code ? Anyway I found a function agent_troop_get_banner_mesh in scripts, which just assigns banners to players. But which function is responsible for showing this specific circle-banner above soldiers heads ?
 
I am not sure at all so may be there is a solution to this but I can imagine that this is hardcoded and happens because the single player mode requires it to show the units chosen?
I don't know, if you command around bots in multiplayer aren't they highlighted, too?
 
Yup, you are right - it's painted when units are selected. I don't play SP, that's why I didn't knew this.
But where is the function which drawns this green border ?
In module_tableau_materials, there is game_troop_label_banner (promising name ;P) - but changing this function has no effect in game (tested this in Custom Game mode).
 
Status
Not open for further replies.
Back
Top Bottom