I am trying to learn coding atm
Could any of you pls help me with comprehending this part of the code of pw mod system?
cf_use_teleport_door
I don't understand the else try part
as the vornne tries to do if player has faction door key =1
if door is unlocked then lock the door and trigger the lock sound after he entered the door
but what would happen if player doesn't have the faction door key
also why the send msg part of the code is attached in the last else try ,would could trigger the send msg part?
Could any of you pls help me with comprehending this part of the code of pw mod system?
cf_use_teleport_door
I don't understand the else try part
as the vornne tries to do if player has faction door key =1
if door is unlocked then lock the door and trigger the lock sound after he entered the door
but what would happen if player doesn't have the faction door key
also why the send msg part of the code is attached in the last else try ,would could trigger the send msg part?
("cf_use_teleport_door", # server: handle agents using a door which teleports to another linked door
[(store_script_param, ":agent_id", 1), # must be valid
(store_script_param, ":instance_id", 2), # must be valid
(store_script_param, "_offset", 3),
(store_script_param, ":y_offset", 4), # position offset relative to the linked door that the agent is moved to
(store_script_param, ":z_offset", 5),
(store_script_param, ":is_pickable", 6),
(scene_prop_get_slot, ":linked_door_instance_id", ":instance_id", slot_scene_prop_linked_scene_prop),
(gt, ":linked_door_instance_id", 0),
(agent_get_player_id, ":player_id", ":agent_id"),
(player_is_active, ":player_id"),
(player_get_slot, ":player_faction_id", ":player_id", slot_player_faction_id),
(call_script, "script_scene_prop_get_owning_faction", ":instance_id"),
(assign, ":faction_id", reg0),
(assign, ":fail", 0),
(try_begin),
(eq, ":faction_id", "fac_commoners"),
(else_try),
(eq, ":faction_id", ":player_faction_id"),
(player_slot_eq, ":player_id", slot_player_has_faction_door_key, 1),
(try_begin),
(scene_prop_slot_eq, ":instance_id", slot_scene_prop_unlocked, 1),
(scene_prop_set_slot, ":instance_id", slot_scene_prop_unlocked, 0),
(scene_prop_set_slot, ":linked_door_instance_id", slot_scene_prop_unlocked, 0),
(agent_play_sound, ":agent_id", "snd_lock"),
(try_end),
(else_try),
(scene_prop_slot_eq, ":instance_id", slot_scene_prop_unlocked, 1),
(else_try),
(assign, reg0, 0),
(eq, ":is_pickable", 1),
(call_script, "script_cf_agent_pick_lock", ":agent_id", 100),
(scene_prop_set_slot, ":instance_id", slot_scene_prop_unlocked, 1),
(scene_prop_set_slot, ":linked_door_instance_id", slot_scene_prop_unlocked, 1),
(else_try),
(assign, ":fail", 1),
(gt, reg0, 0),
(else_try),
(multiplayer_send_3_int_to_player, ":player_id", server_event_preset_message, "str_door_locked_by_s1", preset_message_faction|preset_message_fail_sound, ":faction_id"),
(try_end),
(eq, ":fail", 0),
(prop_instance_get_position, pos1, ":linked_door_instance_id"),
(position_move_x, pos1, "_offset"),
(position_move_y, pos1, ":y_offset"),
(position_move_z, pos1, ":z_offset"),
(agent_set_position, ":agent_id", pos1),
]),