Module Development > The Forge - Mod Development

OSP:how to add item to use. on multiplayer map (code)

<< < (5/6) > >>

Idibil:
Mm, I think that it is best by entry point:

Example:

siege_multi_items = (1,0,300,[(multiplayer_is_server)],[
      
      (try_for_range,":entry",40,50), #para atacantes #you change entry points to you wish
         (entry_point_get_position,pos1,":entry"),
         (set_spawn_position,pos1),
         (spawn_item,"itm_torch",0), #here yu change item
      (end_try),      
      ])   


Then, you add siege_multi_items to mission template.

mauromagno:

--- Quote from: Idibil on January 22, 2012, 10:55:28 AM ---Mm, I think that it is best by entry point:

Example:

siege_multi_items = (1,0,300,[(multiplayer_is_server)],[
      
      (try_for_range,":entry",40,50), #para atacantes #you change entry points to you wish
         (entry_point_get_position,pos1,":entry"),
         (set_spawn_position,pos1),
         (spawn_item,"itm_torch",0), #here yu change item
      (end_try),      
      ])   


Then, you add siege_multi_items to mission template.

--- End quote ---

I added the code at the end of mission template, but it don't appears the item (torch)....
I play in siege... I edit the map, I search entry point nÂș 40 and 50, I put the item torch above the entry point, I close....I save the change, but I do not to use...

Idibil:
You add that code to over multiplayer_server_check_belfry_movement.

Then, you copy siege_multi_items, and paste it in mission template for multiplayer siege: multiplayer_sg


When you enter to game and host, then you go to entry points enter 40-50 and you should see torchs.

mauromagno:

--- Quote from: Idibil on January 22, 2012, 09:51:41 PM ---You add that code to over multiplayer_server_check_belfry_movement.

Then, you copy siege_multi_items, and paste it in mission template for multiplayer siege: multiplayer_sg


When you enter to game and host, then you go to entry points enter 40-50 and you should see torchs.

--- End quote ---

missing something ....
not recognize siege_multi_items

mauromagno:
Thanks to Idibil (http://forums.taleworlds.com/index.php?action=profile;u=60721), I achieved the goal, with the following tutorial

-In mission_template.py search: multiplayer_server_check_belfry_movement = (
placed over the following script:


--- Code: ---siege_multi_items = (1,0,800,[(multiplayer_is_server)],[
     
      (try_for_range,":entry",40,50), #para atacantes
         (entry_point_get_position,pos1,":entry"),
         (set_spawn_position,pos1),
         (spawn_item,"itm_torch",0),
      (end_try),
     
      (try_for_range,":entry",16,22), #para defensores
         (entry_point_get_position,pos1,":entry"),
         (set_spawn_position,pos1),
         (spawn_item,"itm_scale_gauntlets",0),
      (end_try),     
      ])
--- End code ---
 

will look like


--- Code: ---siege_multi_items = (1,0,800,[(multiplayer_is_server)],[
     
      (try_for_range,":entry",40,50), #para atacantes
         (entry_point_get_position,pos1,":entry"),
         (set_spawn_position,pos1),
         (spawn_item,"itm_musket_db",0),
      (end_try),
     
      (try_for_range,":entry",16,22), #para defensores
         (entry_point_get_position,pos1,":entry"),
         (set_spawn_position,pos1),
         (spawn_item,"itm_musket_db",0),
      (end_try),     
      ])   

multiplayer_server_check_belfry_movement = (
  0, 0, 0, [],
  [
    (multiplayer_is_server),
    (set_fixed_point_multiplier, 100),
etc, etc .......

--- End code ---

##You can change the entry points, if you want, the items also..

now search: "multiplayer_sg",mtf_battle_mode,-1, #siege

continues downward and you find this code:

   
--- Code: ---   (ti_on_agent_spawn, 0, 0, [],
       [
         (store_trigger_param_1, ":agent_no"),
         (call_script, "script_multiplayer_server_on_agent_spawn_common", ":agent_no"),

         (try_begin), #if my initial team still not initialized, find and assign its value.
           (lt, "$my_team_at_start_of_round", 0),
           (multiplayer_get_my_player, ":my_player_no"),
           (ge, ":my_player_no", 0),
           (player_get_agent_id, ":my_agent_id", ":my_player_no"),
           (eq, ":my_agent_id", ":agent_no"),
           (ge, ":my_agent_id", 0),
           (agent_get_team, "$my_team_at_start_of_round", ":my_agent_id"),
         (try_end),

         (try_begin),
           (neg|multiplayer_is_server),
           (try_begin),
             (eq, "$g_round_ended", 1),
             (assign, "$g_round_ended", 0),
             (assign, "$g_my_spawn_count", 0),

             #initialize scene object slots at start of new round at clients.
             (call_script, "script_initialize_all_scene_prop_slots"),

             #these lines are done in only clients at start of each new round.
             (call_script, "script_multiplayer_initialize_belfry_wheel_rotations"),
             (call_script, "script_initialize_objects_clients"),
             #end of lines
           (try_end), 
         (try_end),         

         (try_begin),
           (multiplayer_get_my_player, ":my_player_no"),
           (ge, ":my_player_no", 0),
           (player_get_agent_id, ":my_agent_id", ":my_player_no"),
           (eq, ":my_agent_id", ":agent_no"),

           (val_add, "$g_my_spawn_count", 1),
         
           (try_begin),
             (ge, "$g_my_spawn_count", "$g_multiplayer_number_of_respawn_count"),
             (gt, "$g_multiplayer_number_of_respawn_count", 0),
             (multiplayer_get_my_player, ":my_player_no"),
             (player_get_team_no, ":my_player_team_no", ":my_player_no"),
             (eq, ":my_player_team_no", 0),
             (assign, "$g_my_spawn_count", 999),
           (try_end),
         (try_end),
         ]),
--- End code ---



paste this below siege_multi_items,

will look like

 
--- Code: ---etc etc ........
             (assign, "$g_my_spawn_count", 999),
           (try_end),
         (try_end),
         ]),

 siege_multi_items,


--- End code ---

that's all

Once again thank you very much to "Idibil" for your time and for any inconvenience

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version