987 lines
31 KiB
Text
987 lines
31 KiB
Text
|
||
function is_npc_in_current_smart(first_speaker, second_speaker, smart_name)
|
||
local npc = who_is_npc(first_speaker, second_speaker)
|
||
local smart = xr_gulag.get_npc_smart(npc)
|
||
if not smart then return false end
|
||
return smart:name() == smart_name
|
||
end
|
||
|
||
function break_dialog(first_speaker, second_speaker, id)
|
||
first_speaker:stop_talk()
|
||
second_speaker:stop_talk()
|
||
end
|
||
|
||
function update_npc_dialog(first_speaker, second_speaker)
|
||
local npc = who_is_npc(first_speaker, second_speaker)
|
||
db.storage[npc:id()].meet.meet_manager:update()
|
||
xr_meet.process_npc_usability(npc)
|
||
xr_motivator.update_logic(npc)
|
||
end
|
||
|
||
function disable_talk_self(first_speaker, second_speaker)
|
||
first_speaker:disable_talk()
|
||
end
|
||
function disable_talk_victim(first_speaker, second_speaker)
|
||
second_speaker:disable_talk()
|
||
end
|
||
|
||
function punch(first_speaker, second_speaker)
|
||
--abort("KICK ASS !!!!")
|
||
--xr_punch.punch[first_speaker:id()] = second_speaker
|
||
db.storage[second_speaker:id()].punch.enabled = true
|
||
end
|
||
|
||
function get_money_then_leave(first_speaker, second_speaker)
|
||
db.storage[first_speaker:id()].meet.enabled = false
|
||
db.storage[first_speaker:id()].robber.enabled = true
|
||
end
|
||
|
||
function is_wounded(first_speaker, second_speaker)
|
||
-- if db.storage[first_speaker:id()].wounded ~= nil and
|
||
-- db.storage[first_speaker:id()].wounded.wound_manager.can_use_medkit == true
|
||
-- then
|
||
-- return false
|
||
-- end
|
||
local npc = who_is_npc(first_speaker, second_speaker)
|
||
return xr_wounded.is_wounded(npc)
|
||
end
|
||
--[[
|
||
function is_opp_wounded(first_speaker, second_speaker, dialog_id)
|
||
if db.storage[second_speaker:id()].wounded ~= nil and
|
||
db.storage[second_speaker:id()].wounded.wound_manager.can_use_medkit == true
|
||
then
|
||
return false
|
||
end
|
||
return xr_wounded.is_wounded(second_speaker)
|
||
end
|
||
]]--
|
||
function is_not_wounded(first_speaker, second_speaker, dn)
|
||
return not is_wounded(first_speaker, second_speaker)
|
||
end
|
||
function actor_have_medkit(first_speaker, second_speaker)
|
||
return first_speaker:object("medkit") ~= nil or
|
||
first_speaker:object("medkit_army") ~= nil or
|
||
first_speaker:object("medkit_scientic") ~= nil
|
||
end
|
||
function actor_hasnt_medkit(first_speaker, second_speaker)
|
||
return actor_have_medkit(first_speaker, second_speaker) == false
|
||
end
|
||
function actor_have_bandage(first_speaker, second_speaker)
|
||
return first_speaker:object("bandage") ~= nil
|
||
end
|
||
function transfer_medkit(first_speaker, second_speaker)
|
||
if first_speaker:object("medkit") ~= nil then
|
||
|
||
dialogs.relocate_item_section(second_speaker, "medkit", "out")
|
||
--alife():release(alife():object(second_speaker:object("medkit"):id()), true)
|
||
|
||
elseif first_speaker:object("medkit_army") ~= nil then
|
||
|
||
dialogs.relocate_item_section(second_speaker, "medkit_army", "out")
|
||
--alife():release(alife():object(second_speaker:object("medkit_army"):id()), true)
|
||
|
||
else
|
||
|
||
dialogs.relocate_item_section(second_speaker, "medkit_scientic", "out")
|
||
--alife():release(alife():object(second_speaker:object("medkit_scientic"):id()), true)
|
||
|
||
end
|
||
|
||
alife():create("medkit_script", second_speaker:position(), second_speaker:level_vertex_id(), second_speaker:game_vertex_id(), second_speaker:id())
|
||
|
||
--' <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||
xr_wounded.unlock_medkit(second_speaker)
|
||
|
||
if second_speaker:relation(first_speaker) ~= game_object.enemy then
|
||
second_speaker:set_relation(game_object.friend, first_speaker)
|
||
end
|
||
first_speaker:change_character_reputation(10);
|
||
end
|
||
function transfer_bandage(first_speaker, second_speaker)
|
||
dialogs.relocate_item_section(second_speaker, "bandage", "out")
|
||
second_speaker:set_relation(game_object.friend, first_speaker)
|
||
end
|
||
function kill_yourself(npc, actor)
|
||
npc:kill(actor)
|
||
end
|
||
|
||
--' Use this function instead.
|
||
function relocate_item_section(victim, section, type, amount)
|
||
if db.actor then
|
||
if not amount then
|
||
amount = 1
|
||
end
|
||
for i = 1, amount do
|
||
if type == "in" then
|
||
--' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||
if quest_section[section] == true and victim ~= nil and victim:object(section) ~= nil then
|
||
victim:transfer_item(victim:object(section), db.actor)
|
||
else
|
||
alife():create(section,
|
||
db.actor:position(),
|
||
db.actor:level_vertex_id(),
|
||
db.actor:game_vertex_id(),
|
||
db.actor:id())
|
||
end
|
||
elseif type == "out" then
|
||
if victim == nil then
|
||
abort("Couldn't relocate item to NULL")
|
||
end
|
||
db.actor:transfer_item(db.actor:object(section), victim)
|
||
end
|
||
end
|
||
if death_manager.ammo_sections[section] == true then
|
||
local ltx = system_ini()
|
||
local box_size = ltx:r_s32(section, "box_size")
|
||
amount = amount * box_size
|
||
end
|
||
news_manager.relocate_item(db.actor, type, section, amount)
|
||
end
|
||
end
|
||
|
||
|
||
function relocate_money(victim, num, type)
|
||
if db.actor then
|
||
if type == "in" then
|
||
db.actor:give_money(num)
|
||
game_stats.money_quest_update (num)
|
||
|
||
elseif type == "out" then
|
||
if victim == nil then
|
||
abort("Couldn't relocate money to NULL")
|
||
end
|
||
db.actor:transfer_money(num, victim)
|
||
game_stats.money_quest_update(-num)
|
||
end
|
||
news_manager.relocate_money(db.actor, type, num)
|
||
end
|
||
end
|
||
|
||
--'---------------------------------------------------------------------------------
|
||
--' DIALOG ALLOWED
|
||
--'---------------------------------------------------------------------------------
|
||
--function dialog_allowed(object, victim, id)
|
||
-- if id ~= nil then
|
||
---- printf("*DIALOGS*: dialog_allowed: %s", id)
|
||
-- else
|
||
---- printf("*DIALOGS*: dialog_allowed: nil")
|
||
-- end
|
||
-- if db.storage[victim:id()].actor_dialogs ~= nil then
|
||
-- for k,v in pairs(db.storage[victim:id()].actor_dialogs) do
|
||
-- if v == id then return true end
|
||
-- end
|
||
-- end
|
||
-- return false
|
||
--end
|
||
--function dialog_not_disable(object, victim, id)
|
||
-- if id ~= nil then
|
||
---- printf("*DIALOGS*: dialog_disable:%s", id)
|
||
-- else
|
||
---- printf("*DIALOGS*: dialog_disable:nil")
|
||
-- end
|
||
-- if db.storage[victim:id()].actor_disable ~= nil then
|
||
-- for k,v in pairs(db.storage[victim:id()].actor_disable) do
|
||
-- if v == id then return false end
|
||
-- end
|
||
-- end
|
||
-- return true
|
||
--end
|
||
|
||
function allow_wounded_dialog(object, victim, id)
|
||
if db.storage[victim:id()].wounded == nil then
|
||
return false
|
||
end
|
||
if db.storage[victim:id()].wounded.help_dialog == id then
|
||
return true
|
||
end
|
||
return false
|
||
end
|
||
|
||
--function allow_guide_dialog(object, victim, id)
|
||
-- local section = db.storage[victim:id()].active_section
|
||
-- printf("active_section %s", tostring(section))
|
||
-- if section == nil then
|
||
-- return false
|
||
-- end
|
||
-- if string.find(section, "conductor", 1) ~= nil then
|
||
-- return true
|
||
-- end
|
||
-- return false
|
||
--end
|
||
|
||
-----------------------------------------------------------------------------------
|
||
-- LEVELS
|
||
-----------------------------------------------------------------------------------
|
||
--function level_escape(first_speaker, second_speaker)
|
||
-- return level.name() == "l01_escape"
|
||
--end
|
||
--
|
||
--function level_garbage(first_speaker, second_speaker)
|
||
-- return level.name() == "l02_garbage"
|
||
--end
|
||
--
|
||
--function level_agroprom(first_speaker, second_speaker)
|
||
-- return level.name() == "l03_agroprom_ai2" or level.name() == "l03_agroprom"
|
||
--end
|
||
|
||
|
||
function level_zaton(first_speaker, second_speaker)
|
||
return level.name() == "zaton"
|
||
end
|
||
|
||
function level_jupiter(first_speaker, second_speaker)
|
||
return level.name() == "jupiter"
|
||
end
|
||
|
||
function level_pripyat(first_speaker, second_speaker)
|
||
return level.name() == "pripyat"
|
||
end
|
||
|
||
function not_level_zaton(first_speaker, second_speaker)
|
||
return level.name() ~= "zaton"
|
||
end
|
||
|
||
function not_level_jupiter(first_speaker, second_speaker)
|
||
return level.name() ~= "jupiter"
|
||
end
|
||
|
||
function not_level_pripyat(first_speaker, second_speaker)
|
||
return level.name() ~= "pripyat"
|
||
end
|
||
|
||
-----------------------------------------------------------------------------------
|
||
-- Relation functions
|
||
-----------------------------------------------------------------------------------
|
||
function is_friend(first_speaker, second_speaker)
|
||
return first_speaker:relation(second_speaker) == game_object.friend
|
||
end
|
||
|
||
function is_not_friend(first_speaker, second_speaker)
|
||
return not is_friend(first_speaker, second_speaker)
|
||
end
|
||
|
||
function become_friend(first_speaker, second_speaker)
|
||
first_speaker:set_relation(game_object.friend, second_speaker)
|
||
end
|
||
|
||
-----------------------------------------------------------------------------------
|
||
-- Community
|
||
-----------------------------------------------------------------------------------
|
||
function actor_in_dolg(actor, npc)
|
||
for k,v in pairs(sim_board.get_sim_board().players) do
|
||
if v.community_player == true and v.player_name == "dolg" then
|
||
return true
|
||
end
|
||
end
|
||
return false
|
||
end
|
||
|
||
function actor_not_in_dolg(actor, npc)
|
||
for k,v in pairs(sim_board.get_sim_board().players) do
|
||
if v.community_player == true and v.player_name == "dolg" then
|
||
return false
|
||
end
|
||
end
|
||
return true
|
||
end
|
||
|
||
function actor_set_dolg(actor, npc)
|
||
printf("ACTOR NOW IN [DOLG] COMMUNITY")
|
||
sim_board.get_sim_board():set_actor_community("dolg")
|
||
return true
|
||
end
|
||
|
||
|
||
function actor_in_freedom(actor, npc)
|
||
for k,v in pairs(sim_board.get_sim_board().players) do
|
||
if v.community_player == true and v.player_name == "freedom" then
|
||
return true
|
||
end
|
||
end
|
||
return false
|
||
end
|
||
|
||
function actor_not_in_freedom(actor, npc)
|
||
for k,v in pairs(sim_board.get_sim_board().players) do
|
||
if v.community_player == true and v.player_name == "freedom" then
|
||
return false
|
||
end
|
||
end
|
||
return true
|
||
end
|
||
|
||
function actor_set_freedom(actor, npc)
|
||
printf("ACTOR NOW IN [FREEDOM] COMMUNITY")
|
||
sim_board.get_sim_board():set_actor_community("freedom")
|
||
return true
|
||
end
|
||
|
||
|
||
function actor_in_bandit(actor, npc)
|
||
for k,v in pairs(sim_board.get_sim_board().players) do
|
||
if v.community_player == true and v.player_name == "bandit" then
|
||
return true
|
||
end
|
||
end
|
||
return false
|
||
end
|
||
|
||
function actor_not_in_bandit(actor, npc)
|
||
for k,v in pairs(sim_board.get_sim_board().players) do
|
||
if v.community_player == true and v.player_name == "bandit" then
|
||
return false
|
||
end
|
||
end
|
||
return true
|
||
end
|
||
|
||
function actor_set_bandit(actor, npc)
|
||
printf("ACTOR NOW IN [BANDIT] COMMUNITY")
|
||
sim_board.get_sim_board():set_actor_community("bandit")
|
||
return true
|
||
end
|
||
|
||
|
||
function actor_in_stalker(actor, npc)
|
||
for k,v in pairs(sim_board.get_sim_board().players) do
|
||
if v.community_player == true and v.player_name == "stalker" then
|
||
return true
|
||
end
|
||
end
|
||
return false
|
||
end
|
||
|
||
function actor_not_in_stalker(actor, npc)
|
||
for k,v in pairs(sim_board.get_sim_board().players) do
|
||
if v.community_player == true and v.player_name == "stalker" then
|
||
return false
|
||
end
|
||
end
|
||
return true
|
||
end
|
||
|
||
function actor_set_stalker(actor, npc)
|
||
printf("ACTOR NOW IN [STALKER] COMMUNITY")
|
||
sim_board.get_sim_board():set_actor_community("stalker")
|
||
return true
|
||
end
|
||
|
||
|
||
function actor_clear_community(actor, npc)
|
||
printf("ACTOR NOW IN [NEUTRAL] COMMUNITY")
|
||
sim_board.get_sim_board():set_actor_community("none")
|
||
return true
|
||
end
|
||
|
||
function npc_stalker(first_speaker, second_speaker)
|
||
local npc = who_is_npc(first_speaker, second_speaker)
|
||
return character_community(npc) == "stalker"
|
||
end
|
||
|
||
function npc_bandit(first_speaker, second_speaker)
|
||
local npc = who_is_npc(first_speaker, second_speaker)
|
||
return character_community(npc) == "bandit"
|
||
end
|
||
|
||
function npc_freedom(first_speaker, second_speaker)
|
||
local npc = who_is_npc(first_speaker, second_speaker)
|
||
return character_community(npc) == "freedom"
|
||
end
|
||
|
||
function npc_dolg(first_speaker, second_speaker)
|
||
local npc = who_is_npc(first_speaker, second_speaker)
|
||
return character_community(npc) == "dolg"
|
||
end
|
||
|
||
function npc_army(first_speaker, second_speaker)
|
||
local npc = who_is_npc(first_speaker, second_speaker)
|
||
return character_community(npc) == "army"
|
||
end
|
||
-----------------------------------------------------------------------------------
|
||
-- Money functions
|
||
-----------------------------------------------------------------------------------
|
||
function has_2000_money(first_speaker, second_speaker)
|
||
return first_speaker:money() >= 2000
|
||
end
|
||
|
||
-----------------------------------------------------------------------------------
|
||
-- TRADE
|
||
-----------------------------------------------------------------------------------
|
||
--' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
function trade_init(seller, buyer)
|
||
db.storage[seller:id()].meet.begin_wait_to_see.begin = time_global()/1000
|
||
xr_position.setPosition(db.storage[seller:id()].meet.Seller,
|
||
db.storage[seller:id()].meet.Seller:level_vertex_id())
|
||
db.storage[seller:id()].meet.Buyer = buyer
|
||
end
|
||
|
||
function want_trade(seller, buyer)
|
||
if seller:relation(buyer) == game_object.friend or
|
||
seller:relation(buyer) == game_object.neutral
|
||
then
|
||
return true
|
||
else
|
||
return false
|
||
end
|
||
end
|
||
|
||
function dont_want_trade(seller, buyer)
|
||
return not want_trade(seller,buyer)
|
||
end
|
||
|
||
----------------------------------------------------------------------------------
|
||
-- <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!!!
|
||
----------------------------------------------------------------------------------
|
||
|
||
function relocate_item_section_to_actor(first_speaker, second_speaker, section, amount)
|
||
-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
||
local npc = who_is_npc(first_speaker, second_speaker)
|
||
local v = 0
|
||
--' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||
if not amount then
|
||
amount = 1
|
||
end
|
||
|
||
local function transfer_object_item(temp, item)
|
||
--printf("item:section(): [%s]", item:section())
|
||
if (item:section() == section and v ~= 0) then
|
||
npc:transfer_item(item, db.actor)
|
||
v = v - 1
|
||
end
|
||
end
|
||
|
||
if amount > 1 then
|
||
v = amount
|
||
npc:iterate_inventory(transfer_object_item, nil)
|
||
else
|
||
if npc:object(section) ~= nil then
|
||
npc:transfer_item(npc:object(section), db.actor)
|
||
else
|
||
alife():create(section,
|
||
db.actor:position(),
|
||
db.actor:level_vertex_id(),
|
||
db.actor:game_vertex_id(),
|
||
db.actor:id())
|
||
end
|
||
end
|
||
|
||
if v ~= 0 then
|
||
for i = 1, v do
|
||
alife():create(section,
|
||
db.actor:position(),
|
||
db.actor:level_vertex_id(),
|
||
db.actor:game_vertex_id(),
|
||
db.actor:id())
|
||
end
|
||
end
|
||
if death_manager.ammo_sections[section] == true then
|
||
local ltx = system_ini()
|
||
local box_size = ltx:r_s32(section, "box_size")
|
||
amount = amount * box_size
|
||
end
|
||
news_manager.relocate_item(db.actor, "in", section, amount)
|
||
end
|
||
|
||
function relocate_money_to_actor(first_speaker, second_speaker, num)
|
||
db.actor:give_money(num)
|
||
game_stats.money_quest_update (num)
|
||
news_manager.relocate_money(db.actor, "in", num)
|
||
end
|
||
|
||
function relocate_money_from_actor(first_speaker, second_speaker, num)
|
||
local victim = who_is_npc(first_speaker, second_speaker)
|
||
if victim == nil then
|
||
abort("Couldn't relocate money to NULL")
|
||
end
|
||
db.actor:transfer_money(num, victim)
|
||
game_stats.money_quest_update(-num)
|
||
news_manager.relocate_money(db.actor, "out", num)
|
||
end
|
||
|
||
--[[ Old one
|
||
function relocate_item_section_from_actor(first_speaker, second_speaker, section)
|
||
local npc = who_is_npc(first_speaker, second_speaker)
|
||
db.actor:transfer_item(db.actor:object(section), npc)
|
||
news_manager.relocate_item(db.actor, "out", section)
|
||
end
|
||
]]--
|
||
|
||
function who_is_actor(first_speaker, second_speaker)
|
||
local npc = second_speaker
|
||
if db.actor:id() ~= npc:id() then
|
||
npc = first_speaker
|
||
end
|
||
return npc
|
||
end
|
||
|
||
--section - <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; amount - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "all"
|
||
function relocate_item_section_from_actor(first_speaker, second_speaker, section, amount)
|
||
local npc = who_is_npc(first_speaker, second_speaker)
|
||
local actor = who_is_actor(first_speaker, second_speaker)
|
||
local i = 0
|
||
--printf("Amount [%s]", tostring(amount))
|
||
if not amount then
|
||
amount = 1
|
||
end
|
||
|
||
local function transfer_object_item(temp, item)
|
||
--printf("item:section(): [%s]", item:section())
|
||
if (item:section() == section and i ~= 0) then
|
||
db.actor:transfer_item(item, npc)
|
||
i = i - 1
|
||
end
|
||
end
|
||
|
||
if amount == "all" then
|
||
i = -1
|
||
actor:iterate_inventory(transfer_object_item, nil)
|
||
amount = (i+1)*(-1)
|
||
i = 0
|
||
elseif amount > 1 then
|
||
i = amount
|
||
actor:iterate_inventory(transfer_object_item, nil)
|
||
elseif amount < 1 then
|
||
abort("Wrong parameters in function 'relocate_item_section_from_actor'!")
|
||
else
|
||
actor:transfer_item(actor:object(section), npc)
|
||
end
|
||
|
||
if i~=0 then
|
||
assert("Actor do not has enough items! Transferred [%s], needed [%s]", tostring(amount - i), tostring(amount))
|
||
end
|
||
|
||
if death_manager.ammo_sections[db.actor.section] == true then
|
||
local ltx = system_ini()
|
||
local box_size = ltx:r_s32(section, "box_size")
|
||
amount = amount * box_size
|
||
end
|
||
news_manager.relocate_item(db.actor, "out", section, amount - i)
|
||
end
|
||
|
||
function actor_has_item(first_speaker, second_speaker, section)
|
||
return db.actor:object(section) ~= nil
|
||
end
|
||
|
||
function npc_has_item(first_speaker, second_speaker, section)
|
||
local npc = who_is_npc(first_speaker, second_speaker)
|
||
return npc:object(section) ~= nil
|
||
end
|
||
|
||
function who_is_npc(first_speaker, second_speaker)
|
||
local npc = second_speaker
|
||
if db.actor:id() == npc:id() then
|
||
npc = first_speaker
|
||
end
|
||
return npc
|
||
end
|
||
|
||
--------------------------------------------------------------------------------
|
||
function transfer_any_pistol_from_actor(first_speaker, second_speaker)
|
||
local npc = who_is_npc(first_speaker, second_speaker)
|
||
db.actor:iterate_inventory(is_pistol, npc)
|
||
if(db.actor.pistol~=nil) then
|
||
db.actor:transfer_item(db.actor:object(db.actor.pistol), npc)
|
||
news_manager.relocate_item(db.actor, "out", db.actor.pistol)
|
||
db.actor.pistol = nil
|
||
end
|
||
end
|
||
|
||
function is_pistol(npc, item)
|
||
local section = item:section()
|
||
if(section=="wpn_beretta")
|
||
or(section=="wpn_colt1911")
|
||
or(section=="wpn_desert_eagle")
|
||
or(section=="wpn_fort")
|
||
or(section=="wpn_hpsa")
|
||
or(section=="wpn_pb")
|
||
or(section=="wpn_pm")
|
||
or(section=="wpn_usp")
|
||
or(section=="wpn_walther") then
|
||
db.actor.pistol = section
|
||
end
|
||
end
|
||
|
||
function have_actor_any_pistol(first_speaker, second_speaker)
|
||
local npc = who_is_npc(first_speaker, second_speaker)
|
||
db.actor:iterate_inventory(is_pistol, npc)
|
||
if(db.actor.pistol~=nil) then
|
||
return true
|
||
else
|
||
return false
|
||
end
|
||
end
|
||
|
||
--------------------------------------------------------------------------------
|
||
function transfer_any_gun_from_actor(first_speaker, second_speaker)
|
||
local npc = who_is_npc(first_speaker, second_speaker)
|
||
db.actor:iterate_inventory(is_gun, npc)
|
||
if(db.actor.gun~=nil) then
|
||
db.actor:transfer_item(db.actor:object(db.actor.gun), npc)
|
||
news_manager.relocate_item(db.actor, "out", db.actor.gun)
|
||
db.actor.gun = nil
|
||
end
|
||
end
|
||
|
||
function is_gun(npc, item)
|
||
local section = item:section()
|
||
if(section=="wpn_abakan")
|
||
or(section=="wpn_ak74")
|
||
or(section=="wpn_ak74u")
|
||
or(section=="wpn_groza")
|
||
or(section=="wpn_sig550")
|
||
or(section=="wpn_vintorez") then
|
||
db.actor.gun = section
|
||
end
|
||
end
|
||
|
||
function have_actor_any_gun(first_speaker, second_speaker)
|
||
local npc = who_is_npc(first_speaker, second_speaker)
|
||
db.actor:iterate_inventory(is_gun, npc)
|
||
if(db.actor.gun~=nil) then
|
||
return true
|
||
else
|
||
return false
|
||
end
|
||
end
|
||
|
||
--------------------------------------------------------------------------------
|
||
function transfer_any_shootgun_from_actor(first_speaker, second_speaker)
|
||
local npc = who_is_npc(first_speaker, second_speaker)
|
||
db.actor:iterate_inventory(is_shootgun, npc)
|
||
if(db.actor.shootgun~=nil) then
|
||
db.actor:transfer_item(db.actor:object(db.actor.shootgun), npc)
|
||
news_manager.relocate_item(db.actor, "out", db.actor.shootgun)
|
||
db.actor.shootgun = nil
|
||
end
|
||
end
|
||
|
||
function is_shootgun(npc, item)
|
||
local section = item:section()
|
||
if(section=="wpn_bm16")
|
||
or(section=="wpn_toz34")
|
||
or(section=="wpn_wincheaster1300")
|
||
or(section=="wpn_spas12") then
|
||
db.actor.shootgun = section
|
||
end
|
||
end
|
||
|
||
function have_actor_any_shootgun(first_speaker, second_speaker)
|
||
local npc = who_is_npc(first_speaker, second_speaker)
|
||
db.actor:iterate_inventory(is_shootgun, npc)
|
||
if(db.actor.shootgun~=nil) then
|
||
return true
|
||
else
|
||
return false
|
||
end
|
||
end
|
||
--------------------------------------------------------------------------------
|
||
-- ALIFE SUPPORT
|
||
--------------------------------------------------------------------------------
|
||
|
||
function disable_ui(first_speaker, second_speaker)
|
||
xr_effects.disable_ui(first_speaker, second_speaker)
|
||
end
|
||
|
||
function disable_ui_only(first_speaker, second_speaker)
|
||
xr_effects.disable_ui_only(first_speaker, second_speaker)
|
||
end
|
||
|
||
function is_surge_running(first_speaker, second_speaker)
|
||
return surge_manager.get_surge_manager().started == true
|
||
end
|
||
|
||
function is_surge_not_running(first_speaker, second_speaker)
|
||
return surge_manager.get_surge_manager().finished == true
|
||
end
|
||
|
||
---------------------
|
||
function quest_dialog_heli_precond(first_speaker, second_speaker)
|
||
if (has_alife_info("jup_b9_heli_1_searched") and
|
||
has_alife_info("zat_b100_heli_2_searched") and
|
||
has_alife_info("zat_b28_heli_3_searched") and
|
||
has_alife_info("jup_b8_heli_4_searched") and
|
||
has_alife_info("zat_b101_heli_5_searched")) or
|
||
has_alife_info("pri_b305_actor_wondered_done") then
|
||
return false
|
||
end
|
||
|
||
return true
|
||
end
|
||
|
||
function quest_dialog_military_precond(first_speaker, second_speaker)
|
||
if has_alife_info("zat_b28_heli_3_searched") or has_alife_info("jup_b9_blackbox_decrypted") then
|
||
if not (has_alife_info("zat_b28_heli_3_searched") and has_alife_info("jup_b9_blackbox_decrypted")) then
|
||
return true
|
||
end
|
||
end
|
||
return false
|
||
end
|
||
|
||
function quest_dialog_squad_precond(first_speaker, second_speaker)
|
||
return not (has_alife_info("jup_b218_monolith_hired") and has_alife_info("jup_b218_soldier_hired") and has_alife_info("jup_a10_vano_agree_go_und"))
|
||
end
|
||
|
||
function quest_dialog_toolkits_precond(first_speaker, second_speaker)
|
||
if has_alife_info("zat_a2_mechanic_toolkit_search") and not has_alife_info("zat_b3_task_end") then
|
||
return true
|
||
elseif has_alife_info("jup_b217_tech_instruments_start") and not has_alife_info("jup_b217_task_end") then
|
||
return true
|
||
end
|
||
return false
|
||
end
|
||
|
||
|
||
function squad_not_in_smart_b101(first_speaker, second_speaker)
|
||
local smart = "zat_b101"
|
||
return not is_npc_in_current_smart(first_speaker, second_speaker, smart)
|
||
end
|
||
|
||
function squad_not_in_smart_b103(first_speaker, second_speaker)
|
||
local smart = "zat_b103"
|
||
return not is_npc_in_current_smart(first_speaker, second_speaker, smart)
|
||
end
|
||
|
||
function squad_not_in_smart_b104(first_speaker, second_speaker)
|
||
local smart = "zat_b104"
|
||
return not is_npc_in_current_smart(first_speaker, second_speaker, smart)
|
||
end
|
||
|
||
function squad_not_in_smart_b213(first_speaker, second_speaker)
|
||
local smart = "jup_b213"
|
||
return not is_npc_in_current_smart(first_speaker, second_speaker, smart)
|
||
end
|
||
|
||
function squad_not_in_smart_b214(first_speaker, second_speaker)
|
||
local smart = "jup_b214"
|
||
return not is_npc_in_current_smart(first_speaker, second_speaker, smart)
|
||
end
|
||
|
||
function squad_not_in_smart_b304(first_speaker, second_speaker)
|
||
local smart = "pri_b304_monsters_smart_terrain"
|
||
return not is_npc_in_current_smart(first_speaker, second_speaker, smart)
|
||
end
|
||
|
||
function squad_not_in_smart_b303(first_speaker, second_speaker)
|
||
local smart = "pri_b303"
|
||
return not is_npc_in_current_smart(first_speaker, second_speaker, smart)
|
||
end
|
||
|
||
function squad_not_in_smart_b40(first_speaker, second_speaker)
|
||
local smart = "zat_b40_smart_terrain"
|
||
return not is_npc_in_current_smart(first_speaker, second_speaker, smart)
|
||
end
|
||
|
||
function squad_not_in_smart_b18(first_speaker, second_speaker)
|
||
local smart = "zat_b18"
|
||
return not is_npc_in_current_smart(first_speaker, second_speaker, smart)
|
||
end
|
||
|
||
function squad_not_in_smart_b6(first_speaker, second_speaker)
|
||
local smart = "jup_b41"
|
||
return not is_npc_in_current_smart(first_speaker, second_speaker, smart)
|
||
end
|
||
|
||
function squad_not_in_smart_b205(first_speaker, second_speaker)
|
||
local smart = "jup_b205_smart_terrain"
|
||
return not is_npc_in_current_smart(first_speaker, second_speaker, smart)
|
||
end
|
||
|
||
function squad_not_in_smart_b47(first_speaker, second_speaker)
|
||
local smart = "jup_b47"
|
||
return not is_npc_in_current_smart(first_speaker, second_speaker, smart)
|
||
end
|
||
|
||
function squad_in_smart_zat_base(first_speaker, second_speaker)
|
||
local smart = "zat_stalker_base_smart"
|
||
return is_npc_in_current_smart(first_speaker, second_speaker, smart)
|
||
end
|
||
|
||
function squad_in_smart_jup_b25(first_speaker, second_speaker)
|
||
local smart = "jup_a6"
|
||
return is_npc_in_current_smart(first_speaker, second_speaker, smart)
|
||
end
|
||
|
||
function spartak_is_alive(first_speaker, second_speaker)
|
||
return xr_conditions.is_alive(nil,nil,{"zat_b7_stalker_victim_1"})
|
||
end
|
||
|
||
function tesak_is_alive(first_speaker, second_speaker)
|
||
return xr_conditions.is_alive(nil,nil,{"zat_b103_lost_merc_leader"})
|
||
end
|
||
|
||
function gonta_is_alive(first_speaker, second_speaker)
|
||
return xr_conditions.is_alive(nil,nil,{"zat_b103_lost_merc_leader"})
|
||
end
|
||
|
||
function mityay_is_alive(first_speaker, second_speaker)
|
||
return xr_conditions.is_alive(nil,nil,{"jup_a12_stalker_assaulter"})
|
||
end
|
||
|
||
function dolg_can_work_for_sci(first_speaker, second_speaker)
|
||
return not (has_alife_info("jup_a6_freedom_leader_bunker_guards_work") or has_alife_info("jup_a6_freedom_leader_bunker_scan_work"))
|
||
end
|
||
|
||
function dolg_can_not_work_for_sci(first_speaker, second_speaker)
|
||
return has_alife_info("jup_a6_freedom_leader_bunker_guards_work") or has_alife_info("jup_a6_freedom_leader_bunker_scan_work")
|
||
end
|
||
|
||
function freedom_can_work_for_sci(first_speaker, second_speaker)
|
||
return not (has_alife_info("jup_a6_duty_leader_bunker_guards_work") or has_alife_info("jup_a6_duty_leader_bunker_scan_work"))
|
||
end
|
||
|
||
function freedom_can_not_work_for_sci(first_speaker, second_speaker)
|
||
return has_alife_info("jup_a6_duty_leader_bunker_guards_work") or has_alife_info("jup_a6_duty_leader_bunker_scan_work")
|
||
end
|
||
|
||
function monolith_leader_is_alive(first_speaker, second_speaker)
|
||
if not (has_alife_info("jup_b4_monolith_squad_in_freedom") or has_alife_info("jup_b4_monolith_squad_in_duty")) then
|
||
return xr_conditions.is_alive(nil,nil,{"jup_b4_monolith_squad_leader_monolith_skin"})
|
||
end
|
||
|
||
if has_alife_info("jup_b4_monolith_squad_in_freedom") then
|
||
return xr_conditions.is_alive(nil,nil,{"jup_b4_monolith_squad_leader_freedom_skin"})
|
||
elseif has_alife_info("jup_b4_monolith_squad_in_duty") then
|
||
return xr_conditions.is_alive(nil,nil,{"jup_b4_monolith_squad_leader_duty_skin"})
|
||
end
|
||
|
||
return false
|
||
end
|
||
|
||
function monolith_leader_dead_or_hired(first_speaker, second_speaker)
|
||
if has_alife_info("jup_b218_soldier_hired") then
|
||
return true
|
||
end
|
||
|
||
if not (has_alife_info("jup_b4_monolith_squad_in_freedom") or has_alife_info("jup_b4_monolith_squad_in_duty")) then
|
||
return not xr_conditions.is_alive(nil,nil,{"jup_b4_monolith_squad_leader_monolith_skin"})
|
||
end
|
||
|
||
if has_alife_info("jup_b4_monolith_squad_in_freedom") then
|
||
return not xr_conditions.is_alive(nil,nil,{"jup_b4_monolith_squad_leader_freedom_skin"})
|
||
elseif has_alife_info("jup_b4_monolith_squad_in_duty") then
|
||
return not xr_conditions.is_alive(nil,nil,{"jup_b4_monolith_squad_leader_duty_skin"})
|
||
end
|
||
|
||
return true
|
||
end
|
||
|
||
function monolith_leader_dead_or_dolg(first_speaker, second_speaker)
|
||
if has_alife_info("jup_b218_soldier_hired") then
|
||
return true
|
||
end
|
||
|
||
if not (has_alife_info("jup_b4_monolith_squad_in_freedom") or has_alife_info("jup_b4_monolith_squad_in_duty")) then
|
||
return not xr_conditions.is_alive(nil,nil,{"jup_b4_monolith_squad_leader_monolith_skin"})
|
||
end
|
||
|
||
if has_alife_info("jup_b4_monolith_squad_in_freedom") then
|
||
return true
|
||
elseif has_alife_info("jup_b4_monolith_squad_in_duty") then
|
||
return not xr_conditions.is_alive(nil,nil,{"jup_b4_monolith_squad_leader_duty_skin"})
|
||
end
|
||
|
||
return true
|
||
end
|
||
|
||
function monolith_leader_dead_or_freedom(first_speaker, second_speaker)
|
||
if has_alife_info("jup_b218_soldier_hired") then
|
||
return true
|
||
end
|
||
|
||
if not (has_alife_info("jup_b4_monolith_squad_in_freedom") or has_alife_info("jup_b4_monolith_squad_in_duty")) then
|
||
return not xr_conditions.is_alive(nil,nil,{"jup_b4_monolith_squad_leader_monolith_skin"})
|
||
end
|
||
|
||
if has_alife_info("jup_b4_monolith_squad_in_freedom") then
|
||
return not xr_conditions.is_alive(nil,nil,{"jup_b4_monolith_squad_leader_freedom_skin"})
|
||
elseif has_alife_info("jup_b4_monolith_squad_in_duty") then
|
||
return true
|
||
end
|
||
|
||
return true
|
||
end
|
||
|
||
-- Medic support
|
||
function medic_magic_potion(first_speaker, second_speaker)
|
||
db.actor.health = 1
|
||
db.actor.power = 1
|
||
db.actor.radiation = -1
|
||
db.actor.bleeding = 1
|
||
end
|
||
|
||
function actor_needs_bless(first_speaker, second_speaker)
|
||
if db.actor.health < 1 or
|
||
db.actor.radiation > 0 or
|
||
db.actor.bleeding > 0 then
|
||
return true
|
||
end
|
||
|
||
return false
|
||
end
|
||
|
||
function actor_is_damn_healthy(first_speaker, second_speaker)
|
||
return not actor_needs_bless(first_speaker, second_speaker)
|
||
end
|
||
|
||
function leave_zone_save(first_speaker, second_speaker)
|
||
xr_effects.scenario_autosave(db.actor,nil,{"st_save_uni_zone_to_reality"})
|
||
end
|
||
|
||
function save_uni_travel_zat_to_jup(first_speaker, second_speaker)
|
||
xr_effects.scenario_autosave(db.actor,nil,{"st_save_uni_travel_zat_to_jup"})
|
||
end
|
||
|
||
function save_uni_travel_zat_to_pri(first_speaker, second_speaker)
|
||
xr_effects.scenario_autosave(db.actor,nil,{"st_save_uni_travel_zat_to_pri"})
|
||
end
|
||
|
||
function save_uni_travel_jup_to_zat(first_speaker, second_speaker)
|
||
xr_effects.scenario_autosave(db.actor,nil,{"st_save_uni_travel_jup_to_zat"})
|
||
end
|
||
|
||
function save_uni_travel_jup_to_pri(first_speaker, second_speaker)
|
||
xr_effects.scenario_autosave(db.actor,nil,{"st_save_uni_travel_jup_to_pri"})
|
||
end
|
||
|
||
function save_uni_travel_pri_to_zat(first_speaker, second_speaker)
|
||
xr_effects.scenario_autosave(db.actor,nil,{"st_save_uni_travel_pri_to_zat"})
|
||
end
|
||
|
||
function save_uni_travel_pri_to_jup(first_speaker, second_speaker)
|
||
xr_effects.scenario_autosave(db.actor,nil,{"st_save_uni_travel_pri_to_jup"})
|
||
end
|
||
|
||
function save_jup_b218_travel_jup_to_pas(first_speaker, second_speaker)
|
||
xr_effects.scenario_autosave(db.actor,nil,{"st_save_jup_b218_travel_jup_to_pas"})
|
||
end
|
||
|
||
function save_pri_a17_hospital_start(first_speaker, second_speaker)
|
||
xr_effects.scenario_autosave(db.actor,nil,{"st_save_pri_a17_hospital_start"})
|
||
end
|
||
|
||
function save_jup_a10_gonna_return_debt(first_speaker, second_speaker)
|
||
if not has_alife_info("jup_a10_avtosave") then
|
||
xr_effects.scenario_autosave(db.actor,nil,{"st_save_jup_a10_gonna_return_debt"})
|
||
db.actor:give_info_portion("jup_a10_avtosave")
|
||
end
|
||
end
|
||
|
||
function save_jup_b6_arrived_to_fen(first_speaker, second_speaker)
|
||
xr_effects.scenario_autosave(db.actor,nil,{"st_save_jup_b6_arrived_to_fen"})
|
||
end
|
||
|
||
function save_jup_b6_arrived_to_ash_heap(first_speaker, second_speaker)
|
||
xr_effects.scenario_autosave(db.actor,nil,{"st_save_jup_b6_arrived_to_ash_heap"})
|
||
end
|
||
|
||
function save_jup_b19_arrived_to_kopachy(first_speaker, second_speaker)
|
||
xr_effects.scenario_autosave(db.actor,nil,{"st_save_jup_b19_arrived_to_kopachy"})
|
||
end
|
||
|
||
function save_zat_b106_arrived_to_chimera_lair(first_speaker, second_speaker)
|
||
xr_effects.scenario_autosave(db.actor,nil,{"st_save_zat_b106_arrived_to_chimera_lair"})
|
||
end
|
||
|
||
function save_zat_b5_met_with_others(first_speaker, second_speaker)
|
||
xr_effects.scenario_autosave(db.actor,nil,{"st_save_zat_b5_met_with_others"})
|
||
end
|