Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
I tried to create a trigger where every 20 seconds it trys for dead players and spawns them at a particular location. The issue I am having is that it only does this properly for 1 person in the server (usually the player who joined the server first).
Here is the part where I was trying for players:

(try_for_players, ":player_no", 1),
        (player_is_active, ":player_no"),
          (player_get_agent_id,":player_agent",":player_no"),
          (neg|agent_is_alive,":player_agent"), #Is Dead

Is there some other way to go about doing this, so it includes any and all possible players who are dead? Otherwise, any other ideas why it would only be singling out 1 player only?
Thanks,
 
pete99 said:
I tried to create a trigger where every 20 seconds it trys for dead players and spawns them at a particular location. The issue I am having is that it only does this properly for 1 person in the server (usually the player who joined the server first).
Here is the part where I was trying for players:

(try_for_players, ":player_no", 1),
        (player_is_active, ":player_no"),
          (player_get_agent_id,":player_agent",":player_no"),
          (neg|agent_is_alive,":player_agent"), #Is Dead

Is there some other way to go about doing this, so it includes any and all possible players who are dead? Otherwise, any other ideas why it would only be singling out 1 player only?
Thanks,




Its  because you  create loop trought one player...


Do this that way;


Code:
(get_max_players, ":max_players"),
(try_for_players, ":player_no", ":max_players"),

or

Code:
(try_for_players, ":player_no", 256"),

 
PitchPL said:
Code:
(get_max_players, ":max_players"),
(try_for_players, ":player_no", ":max_players"),

or

Code:
(try_for_players, ":player_no", 256"),

can you share where you got your info from? I am not a MP modder, but looking at the documentation you would be wrong

Code:
try_for_players         =   17  # (try_for_players, <destination>, [skip_server]),
                                # Version 1.165+. Iterates through all players in a multiplayer game. Set optional parameter to 1 to skip server player entry.
 
kalarhan said:
PitchPL said:
Code:
(get_max_players, ":max_players"),
(try_for_players, ":player_no", ":max_players"),

or

Code:
(try_for_players, ":player_no", 256"),

can you share where you got your info from? I am not a MP modder, but looking at the documentation you would be wrong

Code:
try_for_players         =   17  # (try_for_players, <destination>, [skip_server]),
                                # Version 1.165+. Iterates through all players in a multiplayer game. Set optional parameter to 1 to skip server player entry.



omg you are right.
I made a mistake  because I modd old wfas engine and there is no even try_for_players operation. I thought he use try_for_range ;p


Thanks.However I will check that again why that can doesn't work.
 
Ivkolya said:
I want to add handgrenades to my mod,

check the OSP and tutorial subforums for area of effect mechanics. The basic code is to choose a location (for example the agent hit by a object, or the place in the ground where the prop is), use a timed trigger (delay), do a area loop (filtered by distance) and apply damage to anyone inside the range.

a example from VC is how they use stones in sieges to hit multiple agents.

Code:
["stones_siege",         "Siege Stones", [("siegestone",0)], itp_type_thrown |itp_unique|itp_primary ,itcf_throw_stone, 10 , weight(3)|difficulty(4)|spd_rtng(70) | shoot_speed(14) | thrust_damage(28 ,  blunt)|max_ammo(5)|weapon_length(14),imodbits_none, #chief cambiado
  [
    (ti_on_missile_hit,
      [
        (try_begin),
          #Solid Round Script
          #pos1 - Missile hit position
          #param_1 - Shooter agent
          (this_or_next|multiplayer_is_server),
          (neg|game_in_multiplayer_mode),
          (store_trigger_param_1,":shooter"),
          (set_fixed_point_multiplier, 100),
          (copy_position, pos63, pos1),
          (particle_system_burst,"psys_piedra_dust",pos1,1),
          (try_for_agents,":agent",pos63,100),
            (neg|agent_is_ally,":agent"),
            (agent_is_active,":agent"),
            (agent_is_alive,":agent"),
            (neq,":agent",":shooter"),
            (agent_deliver_damage_to_agent,":shooter",":agent"),
            (play_sound,"snd_shield_broken"),
          (try_end),
        (try_end),
    ]),
]],

-> above example shows how to get position and apply the filtered loop. It doesnt include the timed trigger effect.
 
@pete99

Try this.

Code:
dead_test = (
  1, 0, 0, [],
  [    
  (try_for_players, ":player_no"),
  (player_is_active, ":player_no"),
  (player_get_agent_id, ":agent_no", ":player_no"),
  (ge, ":agent_no", 0),
  (try_begin),
  (agent_is_alive, ":agent_no"),
  (display_message, "@Alive"),          ####  For me , neq| doesnt work properly with agent_is_alive operation.Just make empty try where agent_is_alive condition.
  (else_try),  #### this try is what you want
  (str_store_player_username, s10, ":player_no"),
   (display_message, "@ You are already Dead {s10}"),
(try_end),
 ])
 
PitchPL said:
@pete99

Try this.

-snip-

Missing a try_end for the loop there, so this:

Code:
dead_test = (
  1, 0, 0, [],
  [    
(try_for_players, ":player_no"),
  (player_is_active, ":player_no"),
  (player_get_agent_id, ":agent_no", ":player_no"),
  (ge, ":agent_no", 0),
  (try_begin),
       (agent_is_alive, ":agent_no"),
       (display_message, "@Alive"),          ####  For me , neq| doesnt work properly with agent_is_alive operation.Just make empty try where agent_is_alive condition.
  (else_try),  #### this try is what you want
       (str_store_player_username, s10, ":player_no"),
       (display_message, "@ You are already Dead {s10}"),
  (try_end),
(try_end),
 ]) 

Or, slightly less complex:
Code:
dead_test = (
  1, 0, 0, [],
  [    
(try_for_players, ":player_no"),
  (player_is_active, ":player_no"),
  (player_get_agent_id, ":agent_no", ":player_no"),
  (neg|agent_is_alive, ":agent_no"),
  (display_message, "@Spawny stuff here"),
(try_end),
 ]) 

Might need to check if the agent is active before checking for alive/dead to avoid errors(?).

Also, @PitchPL:
neq is not equals. to negate operations, use neg.
 
PitchPL said:
What are the counterparts of this in singleplayer?
Code:
        (multiplayer_get_my_player, ":my_player"),
		(player_get_agent_id, ":my_agent", ":my_player"),

Code:
get_player_agent_no                      = 1700  # (get_player_agent_no, <destination>),
                                                 # Retrieves the reference to the player-controlled agent. Singleplayer mode only.
 
PitchPL said:
What are the counterparts of this in singleplayer?

for operations on agents/troops you can check Lav's header_operation

Code:
# TABLE OF CONTENTS
################################################################################
#
# [ Z00 ] Introduction and Credits.
# [ Z01 ] Operation Modifiers.
# [ Z02 ] Flow Control.
# [ Z03 ] Mathematical Operations.
# [ Z04 ] Script/Trigger Parameters and Results.
# [ Z05 ] Keyboard and Mouse Input.
# [ Z06 ] World Map.
# [ Z07 ] Game Settings.
# [ Z08 ] Factions.
# [ Z09 ] Parties and Party Templates.
# [ Z10 ] Troops.
# [ Z11 ] Quests.
# [ Z12 ] Items.
# [ Z13 ] Sounds and Music Tracks.
# [ Z14 ] Positions.
# [ Z15 ] Game Notes.
# [ Z16 ] Tableaus and Heraldics.
# [ Z17 ] String Operations.
# [ Z18 ] Output And Messages.
# [ Z19 ] Game Control: Screens, Menus, Dialogs and Encounters.
# [ Z20 ] Scenes and Missions.
# [ Z21 ] Scene Props and Prop Instances.
# [ Z22 ] Agents and Teams.
# [ Z23 ] Presentations.
# [ Z24 ] Multiplayer And Networking.
# [ Z25 ] Remaining Esoteric Stuff.
# [ Z26 ] Hardcoded Compiler-Related Code.

note how the has a section for multiplayer dedicated stuff (special case). Your question is under Z22 (agents and teams) for SP.
 
Namakan said:
PitchPL said:
@pete99

Try this.

-snip-

Missing a try_end for the loop there, so this:

Code:
dead_test = (
  1, 0, 0, [],
  [    
(try_for_players, ":player_no"),
  (player_is_active, ":player_no"),
  (player_get_agent_id, ":agent_no", ":player_no"),
  (ge, ":agent_no", 0),
  (try_begin),
       (agent_is_alive, ":agent_no"),
       (display_message, "@Alive"),          ####  For me , neq| doesnt work properly with agent_is_alive operation.Just make empty try where agent_is_alive condition.
  (else_try),  #### this try is what you want
       (str_store_player_username, s10, ":player_no"),
       (display_message, "@ You are already Dead {s10}"),
  (try_end),
(try_end),
 ]) 

Or, slightly less complex:
Code:
dead_test = (
  1, 0, 0, [],
  [    
(try_for_players, ":player_no"),
  (player_is_active, ":player_no"),
  (player_get_agent_id, ":agent_no", ":player_no"),
  (neg|agent_is_alive, ":agent_no"),
  (display_message, "@Spawny stuff here"),
(try_end),
 ]) 

Might need to check if the agent is active before checking for alive/dead to avoid errors(?).

Also, @PitchPL:
neq is not equals. to negate operations, use neg.

Thanks. For some reason it still doesn't seem to work. When I try this code it doesn't seem to work for any players. Note: I am doing this for multiplayer Napoleonic Wars. Any ideas if i am missing or need to change something?
 
@pete99
Use this for debugging and then decide whether of these conditions match your use case.
Code:
(try_for_players, reg0, 0),
	(player_get_agent_id, reg1, reg0),
	(try_begin),
		(agent_is_active, reg1),
		(display_message, "@Player {reg0} has active agent {reg1}"),
		(try_begin),
			(agent_is_alive, reg1),
			(display_message, "@agent is alive"),
		(else_try),
			(display_message, "@agent is dead"),
		(try_end),
	(else_try),
		(display_message, "@Player {reg0} has no active agent"),
	(try_end),
(try_end),
 
Hi all! Can someone tell me, where is stored the data of adding outer_terrain to map? I noticed that outer terrain is the same mesh for both big and small scenes, so there must be some script for ajusting the size of it.
And I wonder if it is possible to add a collision object to the outer terrain?
And also a question - can I add my own outer terrain to the game? Or is it simplier just make a mesh of outer terrain and ajust it's size by hand? In that case - how can I discover actual size of map so I can make needed mesh of needed size in easy way? :smile:


UPD After some experiments I discovered that outer_terrain for medium-sized map is close to 37500 (50000x75%) times bigger than mesh of outer_terrain (but imported 37500 times bigger mesh is slightly higher than generated by the engine outer terrain, but it is just what I needed)
 
Ivkolya said:
Hi all! Can someone tell me, where is stored the data of adding outer_terrain to map? I noticed that outer terrain is the same mesh for both big and small scenes, so there must be some script for ajusting the size of it.
And I wonder if it is possible to add a collision object to the outer terrain?
And also a question - can I add my own outer terrain to the game? Or is it simplier just make a mesh of outer terrain and ajust it's size by hand? In that case - how can I discover actual size of map so I can make needed mesh of needed size in easy way? :smile:


Maybe someone asked this already, but I didn't find such questions :smile:

Outer terrains are just meshes. Look in the CommonRes folder at the terrain borders brfs. They all have a square hole in the middle where the inner scene sits. If you make a new border just make sure it has the same square hole in the same position. Agents can't access the borders, they're restricted to the scene, making a collision mesh for borders pointless. The border meshes are referenced at the end of each scene's code in module_scenes.py.
 
Thank you for your answer. I know where meshes of terrain_borders are and already altered one of them, but I doubt that if I just add another mesh with a new name and write that new name in the end of scene's code, it will work. I think somewhere in the module system is stored data with at least a list of terrain_borders.
Collision object I want to add meshes on the terrain_border in easier way by hitting "add object" button and placing object with the mouse.
 
Status
Not open for further replies.
Back
Top Bottom