OSP Code MP Arch3r OS: Health boxes and weapon boxes

Users who are viewing this thread

I will put all that I changed
module script
Code:
(else_try), #opening/closing door
       (this_or_next|eq, ":effected_object", "spr_door_destructible"),
       (this_or_next|eq, ":effected_object", "spr_castle_f_door_b"),
       (this_or_next|eq, ":effected_object", "spr_castle_e_sally_door_a"),
       (this_or_next|eq, ":effected_object", "spr_castle_f_sally_door_a"),
       (this_or_next|eq, ":effected_object", "spr_earth_sally_gate_left"),
       (this_or_next|eq, ":effected_object", "spr_earth_sally_gate_right"),
       (this_or_next|eq, ":effected_object", "spr_viking_keep_destroy_sally_door_left"),
       (this_or_next|eq, ":effected_object", "spr_viking_keep_destroy_sally_door_right"),
       (this_or_next|eq, ":effected_object", "spr_weapon_rack_arming_sword")
       (eq, ":effected_object", "spr_castle_f_door_a"),

       (try_begin),
         (eq, ":item_situation", 0),
         (str_store_string, s0, "str_open_door"),
       (else_try),
         (str_store_string, s0, "str_close_door"),
       (try_end),
     (else_try), #raising/dropping ladder
       (try_begin),
         (eq, ":item_situation", 0),
         (str_store_string, s0, "str_raise_ladder"),
       (else_try),
         (str_store_string, s0, "str_drop_ladder"),
       (try_end),
	 (else_try), #using box
       (eq, ":effected_object", "spr_weapon_rack_arming_sword"),
         (str_store_string, s0, "str_tageul"),
     (try_end),
   ]),

Code:
#script_game_get_use_string
  # This script is called from the game engine for getting using information text
  # INPUT: used_scene_prop_id  
  # OUTPUT: s0
  ("game_get_use_string",
   [
     (store_script_param, ":instance_id", 1),

     (prop_instance_get_scene_prop_kind, ":scene_prop_id", ":instance_id"),
     
     (try_begin),
       (this_or_next|eq, ":scene_prop_id", "spr_winch_b"),
       (eq, ":scene_prop_id", "spr_winch"),
       (assign, ":effected_object", "spr_portcullis"),
     (else_try),
       (this_or_next|eq, ":scene_prop_id", "spr_door_destructible"),
       (this_or_next|eq, ":scene_prop_id", "spr_castle_f_door_b"),
       (this_or_next|eq, ":scene_prop_id", "spr_castle_e_sally_door_a"),
       (this_or_next|eq, ":scene_prop_id", "spr_castle_f_sally_door_a"),
       (this_or_next|eq, ":scene_prop_id", "spr_earth_sally_gate_left"),
       (this_or_next|eq, ":scene_prop_id", "spr_earth_sally_gate_right"),
       (this_or_next|eq, ":scene_prop_id", "spr_viking_keep_destroy_sally_door_left"),
       (this_or_next|eq, ":scene_prop_id", "spr_viking_keep_destroy_sally_door_right"),
       (this_or_next|eq, ":scene_prop_id", "spr_castle_f_door_a"),
       (this_or_next|eq, ":scene_prop_id", "spr_siege_ladder_move_6m"),
       (this_or_next|eq, ":scene_prop_id", "spr_siege_ladder_move_8m"),
       (this_or_next|eq, ":scene_prop_id", "spr_siege_ladder_move_10m"),
       (this_or_next|eq, ":scene_prop_id", "spr_siege_ladder_move_12m"),
	   (this_or_next|eq, ":scene_prop_id", "spr_weapon_rack_arming_sword"),
       (eq, ":scene_prop_id", "spr_siege_ladder_move_14m"),
       (assign, ":effected_object", ":scene_prop_id"),
     (try_end),   

     (scene_prop_get_slot, ":item_situation", ":instance_id", scene_prop_open_or_close_slot),
   
     (try_begin), #opening/closing portcullis
       (eq, ":effected_object", "spr_portcullis"),

       (try_begin),
         (eq, ":item_situation", 0),
         (str_store_string, s0, "str_open_gate"),
       (else_try), 
         (str_store_string, s0, "str_close_gate"),
       (try_end),
     (else_try), #opening/closing door
       (this_or_next|eq, ":effected_object", "spr_door_destructible"),
       (this_or_next|eq, ":effected_object", "spr_castle_f_door_b"),
       (this_or_next|eq, ":effected_object", "spr_castle_e_sally_door_a"),
       (this_or_next|eq, ":effected_object", "spr_castle_f_sally_door_a"),
       (this_or_next|eq, ":effected_object", "spr_earth_sally_gate_left"),
       (this_or_next|eq, ":effected_object", "spr_earth_sally_gate_right"),
       (this_or_next|eq, ":effected_object", "spr_viking_keep_destroy_sally_door_left"),
       (this_or_next|eq, ":effected_object", "spr_viking_keep_destroy_sally_door_right"),
	   (this_or_next|eq, ":effected_object", "spr_weapon_rack_arming_sword"),
       (eq, ":effected_object", "spr_castle_f_door_a"),

       (try_begin),
         (eq, ":item_situation", 0),
         (str_store_string, s0, "str_open_door"),
       (else_try),
         (str_store_string, s0, "str_close_door"),
       (try_end),
     (else_try), #raising/dropping ladder
       (try_begin),
         (eq, ":item_situation", 0),
         (str_store_string, s0, "str_raise_ladder"),
       (else_try),
         (str_store_string, s0, "str_drop_ladder"),
       (try_end),
	 (else_try), #using box
       (eq, ":effected_object", "spr_weapon_rack_arming_sword"),
         (str_store_string, s0, "str_tageul"),
     (try_end),
   ]),


Module scene props :
Code:
check_ladder_animation_finish_trigger = (ti_on_scene_prop_animation_finished,
    [
      (store_trigger_param_1, ":instance_id"),

      (prop_instance_enable_physics, ":instance_id", 1),
      ])
check_weapon_rack_arming_sword = (ti_on_scene_prop_use,
    [
      (store_trigger_param_1, ":agent_id"),
      (store_trigger_param_2, ":instance_id"),

      (multiplayer_is_server),
      (assign, ":cost", 500), #gold required for spawning a weapon
      (agent_get_player_id,":player_no",":agent_id"),
      (try_begin),
        (player_is_active, ":player_no"),
        (player_get_gold, ":player_gold", ":player_no"),
        (gt, ":player_gold", ":cost"),
        (prop_instance_get_position, pos1, ":instance_id"),
        (position_move_z,pos1,-5),
        (set_spawn_position, pos1),
        (spawn_item, "itm_sword_medieval_c"), #arming sword swadian
        (val_sub, ":player_gold", ":cost"),
        (player_set_gold, ":player_no", ":player_gold", multi_max_gold_that_can_be_stored),
      (try_end),
    ])
	
("weapon_rack_arming_sword",spr_use_time(1),"weapon_rack","boweapon_rack", [
      check_weapon_rack_arming_sword
      ]),

Module string :
Code:
  ("open_gate", "Open Gate"),
  ("close_gate", "Close Gate"),
  ("open_door", "Open Door"),
  ("close_door", "Close Door"),
  ("tageul", "Close Door"),
  ("raise_ladder", "Raise Ladder"),
  ("drop_ladder", "Drop Ladder"),


THANKS


 
("weapon_rack_arming_sword",spr_use_time(1),"weapon_rack","boweapon_rack", [
      check_weapon_rack_arming_sword
      ]),

Needs to be on the bottom of scene_props, and the check needs to be at the other checks stuff.
 
hi arch3r , I want to know if this is possible :  i want know , somebody does have special item on him to can buy on object on the ground ? and how sell a object to a weapon box for example et have money in return ? . very thanks
 
What did i wrong?

mb18u.jpg
Scene Prop:
  ("rifle",spr_use_time(3),"rifle","bo_box_a", [
      buy_musket
      ]),

Script:
    (try_begin),
      (this_or_next|eq, ":scene_prop_id", "spr_winch_b"),
      (eq, ":scene_prop_id", "spr_winch"),
      (assign, ":effected_object", "spr_portcullis"),
    (else_try),
      (this_or_next|eq, ":scene_prop_id", "spr_door_destructible"),
      (this_or_next|eq, ":scene_prop_id", "spr_castle_f_door_b"),
      (this_or_next|eq, ":scene_prop_id", "spr_castle_e_sally_door_a"),
      (this_or_next|eq, ":scene_prop_id", "spr_castle_f_sally_door_a"),
      (this_or_next|eq, ":scene_prop_id", "spr_earth_sally_gate_left"),
      (this_or_next|eq, ":scene_prop_id", "spr_earth_sally_gate_right"),
      (this_or_next|eq, ":scene_prop_id", "spr_viking_keep_destroy_sally_door_left"),
      (this_or_next|eq, ":scene_prop_id", "spr_viking_keep_destroy_sally_door_right"),
      (this_or_next|eq, ":scene_prop_id", "spr_castle_f_door_a"),
      (this_or_next|eq, ":scene_prop_id", "spr_siege_ladder_move_6m"),
      (this_or_next|eq, ":scene_prop_id", "spr_siege_ladder_move_8m"),
      (this_or_next|eq, ":scene_prop_id", "spr_siege_ladder_move_10m"),
      (this_or_next|eq, ":scene_prop_id", "spr_rifle"),
      (this_or_next|eq, ":scene_prop_id", "spr_siege_ladder_move_12m"),
      (eq, ":scene_prop_id", "spr_siege_ladder_move_14m"),
      (assign, ":effected_object", ":scene_prop_id"),
    (try_end), 

    (scene_prop_get_slot, ":item_situation", ":instance_id", scene_prop_open_or_close_slot),
 
    (try_begin), #opening/closing portcullis
      (eq, ":effected_object", "spr_portcullis"),

      (try_begin),
        (eq, ":item_situation", 0),
        (str_store_string, s0, "str_open_gate"),
      (else_try),
        (str_store_string, s0, "str_close_gate"),
      (try_end),
    (else_try), #opening/closing door
      (this_or_next|eq, ":effected_object", "spr_door_destructible"),
      (this_or_next|eq, ":effected_object", "spr_castle_f_door_b"),
      (this_or_next|eq, ":effected_object", "spr_castle_e_sally_door_a"),
      (this_or_next|eq, ":effected_object", "spr_castle_f_sally_door_a"),
      (this_or_next|eq, ":effected_object", "spr_earth_sally_gate_left"),
      (this_or_next|eq, ":effected_object", "spr_earth_sally_gate_right"),
      (this_or_next|eq, ":effected_object", "spr_viking_keep_destroy_sally_door_left"),
      (this_or_next|eq, ":effected_object", "spr_viking_keep_destroy_sally_door_right"),
      (eq, ":effected_object", "spr_castle_f_door_a"),

      (try_begin),
        (eq, ":item_situation", 0),
        (str_store_string, s0, "str_open_door"),
      (else_try),
        (str_store_string, s0, "str_close_door"),
      (try_end),
    (else_try), #raising/dropping ladder
      (try_begin),
        (eq, ":item_situation", 0),
        (str_store_string, s0, "str_raise_ladder"),
      (else_try),
        (str_store_string, s0, "str_drop_ladder"),
      (try_end),
    (else_try),
        (eq, ":effected_object", "spr_spr_rifle"),
        (str_store_string, s0, "buy_musket"),
 
    (try_end),
  ]),

Strings:
  ("open_gate", "Open Gate"),
  ("close_gate", "Close Gate"),
  ("open_door", "Open Door"),
  ("close_door", "Close Door"),
  ("raise_ladder", "Raise Ladder"),
  ("drop_ladder", "Drop Ladder"),
  ("buy_musket", "Buy Musket 2000 Gold"),
 
(else_try), #raising/dropping ladder
      (try_begin),
        (eq, ":item_situation", 0),
        (str_store_string, s0, "str_raise_ladder"),
      (else_try),
        (str_store_string, s0, "str_drop_ladder"),
      (try_end),
    (else_try),
        (eq, ":effected_object", "spr_spr_rifle"),
        (str_store_string, s0, "buy_musket"),     
    (try_end),

You added the tag twice.
 
Gorillaz said:
hi arch3r , I want to know if this is possible :  i want know , somebody does have special item on him to can buy on object on the ground ? and how sell a object to a weapon box for example et have money in return ? . very thanks
Yes, you can check with (player_has_item,<item_id>), if he has the special item.
Also with (player_get_agent_id, <destination>, <player_id>), and (agent_unequip_item,<agent_id>,<item_id>), you can remove an item. Simply reverse the gold script in the OP to give gold back.
 
me his work but i got this error :

error : Warning Unmatched else_try,; line no : 44:
At script : game_get_use_string


my module script

Code:
    (this_or_next|eq, ":scene_prop_id", "spr_siege_ladder_move_8m"),
       (this_or_next|eq, ":scene_prop_id", "spr_siege_ladder_move_10m"),
	   (this_or_next|eq, ":scene_prop_id", "spr_tbfc_box5"),
       (this_or_next|eq, ":scene_prop_id", "spr_siege_ladder_move_12m"),
       (eq, ":scene_prop_id", "spr_siege_ladder_move_14m"),
       (assign, ":effected_object", ":scene_prop_id"),
     (try_end),   

     (scene_prop_get_slot, ":item_situation", ":instance_id", scene_prop_open_or_close_slot),
   
     (try_begin), #opening/closing portcullis
       (eq, ":effected_object", "spr_portcullis"),

       (try_begin),
         (eq, ":item_situation", 0),
         (str_store_string, s0, "str_open_gate"),
       (else_try), 
         (str_store_string, s0, "str_close_gate"),
       (try_end),
     (else_try), #opening/closing door
       (this_or_next|eq, ":effected_object", "spr_door_destructible"),
       (this_or_next|eq, ":effected_object", "spr_castle_f_door_b"),
       (this_or_next|eq, ":effected_object", "spr_castle_e_sally_door_a"),
       (this_or_next|eq, ":effected_object", "spr_castle_f_sally_door_a"),
       (this_or_next|eq, ":effected_object", "spr_earth_sally_gate_left"),
       (this_or_next|eq, ":effected_object", "spr_earth_sally_gate_right"),
       (this_or_next|eq, ":effected_object", "spr_viking_keep_destroy_sally_door_left"),
       (this_or_next|eq, ":effected_object", "spr_viking_keep_destroy_sally_door_right"),
       (eq, ":effected_object", "spr_castle_f_door_a"),

       (try_begin),
         (eq, ":item_situation", 0),
         (str_store_string, s0, "str_open_door"),
       (else_try),
         (str_store_string, s0, "str_close_door"),
       (try_end),
	   (else_try), #using box
       (eq, ":effected_object", "spr_tbfc_box5"),
         (str_store_string, s0, "str_tageul"),
     (try_end),
     (else_try), #raising/dropping ladder
       (try_begin),
         (eq, ":item_situation", 0),
         (str_store_string, s0, "str_raise_ladder"),
       (else_try),
         (str_store_string, s0, "str_drop_ladder"),
       (try_end),

my module string

Code:
 ("open_gate", "Open Gate"),
  ("close_gate", "Close Gate"),
  ("open_door", "Open Door"),
  ("close_door", "Close Door"),
  ("raise_ladder", "Raise Ladder"),
  ("drop_ladder", "Drop Ladder"),
  ("tageul", "Acheter"),


what the problem ?? thx
 
QBDU07 said:
    (this_or_next|eq, ":scene_prop_id", "spr_siege_ladder_move_8m"),
      (this_or_next|eq, ":scene_prop_id", "spr_siege_ladder_move_10m"),
  (this_or_next|eq, ":scene_prop_id", "spr_tbfc_box5"),
      (this_or_next|eq, ":scene_prop_id", "spr_siege_ladder_move_12m"),
      (eq, ":scene_prop_id", "spr_siege_ladder_move_14m"),
      (assign, ":effected_object", ":scene_prop_id"),
    (try_end), 

    (scene_prop_get_slot, ":item_situation", ":instance_id", scene_prop_open_or_close_slot),
 
    (try_begin), #opening/closing portcullis
      (eq, ":effected_object", "spr_portcullis"),

      (try_begin),
        (eq, ":item_situation", 0),
        (str_store_string, s0, "str_open_gate"),
      (else_try),
        (str_store_string, s0, "str_close_gate"),
      (try_end),
    (else_try), #opening/closing door
      (this_or_next|eq, ":effected_object", "spr_door_destructible"),
      (this_or_next|eq, ":effected_object", "spr_castle_f_door_b"),
      (this_or_next|eq, ":effected_object", "spr_castle_e_sally_door_a"),
      (this_or_next|eq, ":effected_object", "spr_castle_f_sally_door_a"),
      (this_or_next|eq, ":effected_object", "spr_earth_sally_gate_left"),
      (this_or_next|eq, ":effected_object", "spr_earth_sally_gate_right"),
      (this_or_next|eq, ":effected_object", "spr_viking_keep_destroy_sally_door_left"),
      (this_or_next|eq, ":effected_object", "spr_viking_keep_destroy_sally_door_right"),
      (eq, ":effected_object", "spr_castle_f_door_a"),

      (try_begin),
        (eq, ":item_situation", 0),
        (str_store_string, s0, "str_open_door"),
      (else_try),
        (str_store_string, s0, "str_close_door"),
      (try_end),
##New scene prop(s) begin
    (else_try),
        (eq, ":effected_object", "spr_tbfc_box5"),
        (str_store_string, s0, "str_tageul"),
##New scene prop(s) end

    (else_try), #raising/dropping ladder
      (try_begin),
        (eq, ":item_situation", 0),
        (str_store_string, s0, "str_raise_ladder"),
      (else_try),
        (str_store_string, s0, "str_drop_ladder"),
      (try_end),
 
can u give me help..
I'm planning to spawn ladders with your code.. so far so easy
but i want to limit abusing the ladders and destruct the balance of the map

this mean i want only 3 ladders spawned
but if a ladder is destroyed you can order a new

my problem is i can only check the player inventory but not if the ladder is build the destruction or it its only dropped..
the only workaround is wait the half maptime if the ladder is not anymore in the player inventory before give the shopping ability back

i hope i don't ask something impossible
MFG
SaltatorMortis
 
In module_scene_props destructible objects have a trigger ti_on_prop_destroy or something. If you make a global variable (server side only) that checks the total ladders in use, you can val_sub that global when a ladder gets destroyed and val_add when a ladder is bought. Add a (lt, "$g_ladders_used", 3), check so people can't buy more than 3 ladders.
 
Nice idea, and your code is very easy to change/modify. Thanks for that, Arch3r.

You know what would be cool to add to your boxes? Sound effects!

Like some snores when the bed is used, or maybe a "wheel of fortune" effect in the weapon boxes.  :mrgreen:


 
This thread is AWESOME!!!  hmm I wonder how many things can be done with this... methinks quite a few!! 

One more thing about limiting the number of items spawned.  I would like to make a one-time-use prop ... the global variable  ("$g_ladders_used", 1)  method  from above is the simplest/lightest??

Or how about a toggle action:  pressing F has a two-way sequence like opening/closing a door.  Could be for an elevator where you press F it moves platform up w/  player on it... then triggers same object to move platform down.  I guess that's just 2 triggers that are then reset to be ready again? 

EDIT:  I just realized I'm a complete noob with all this and I've wasted my first question to the master.  :oops:  haha... asking about global variables no less!!  I guess global variable (server side) sounded a little scary, idk.  I need to study more....
 
Ye, the global variable method is the easiest. Just reset it to 0 at the beginning of a mission (ti_after_mission_start) and make a check if it's 0 on use of the box and when it's used, set it to 1.
 
Sorry for the Necro but I have a question.

What would be the code for the Ammo Refill Box?

Also Just to make sure, so to get it working you have to make a scene prop with that exact name "weapon_box5"?
 
OrangeKnight said:
Sorry for the Necro but I have a question.

What would be the code for the Ammo Refill Box?

Also Just to make sure, so to get it working you have to make a scene prop with that exact name "weapon_box5"?

It's in the FUIN mod's latest  source build.... :wink:
 
Back
Top Bottom