Working with scripts, testing new chair

This commit is contained in:
Vladislav Khorev 2026-05-17 20:28:18 +03:00
parent 4044acefb2
commit 49501e32ce
9 changed files with 63646 additions and 88 deletions

View File

@ -50,8 +50,8 @@
},
{
"name": "Chair001",
"texturePath": "resources/w/dorm/ikea_chair_bake002.png",
"meshPath": "resources/w/dorm/ikea_chair001.txt",
"texturePath": "resources/black.png",
"meshPath": "resources/w/dorm/chair002.txt",
"rotationX": 0.0,
"rotationY": 0.0,
"rotationZ": 0.0,

View File

@ -51,6 +51,104 @@
"type": "End"
}
]
},
{
"id": "aiperi_dialog001",
"start": "line_1",
"nodes": [
{
"id": "line_1",
"type": "Line",
"speaker": "Айпери",
"portrait": "resources/w/avatar_girlfriend.png",
"text": "Так где нож, Бекзат? Ты мне его когда вернешь?",
"next": "line_2"
},
{
"id": "line_2",
"type": "Line",
"speaker": "Бекзат",
"portrait": "resources/w/gg/gg2_s_podsvetkoy5.png",
"text": "Извини, но этот нож внезапно мне очень нужен.",
"next": "line_3"
},
{
"id": "line_3",
"type": "Line",
"speaker": "Айпери",
"portrait": "resources/w/avatar_girlfriend.png",
"text": "Бекзат, какого черта?",
"next": "line_4"
},
{
"id": "line_4",
"type": "Line",
"speaker": "Бекзат",
"portrait": "resources/w/gg/gg2_s_podsvetkoy5.png",
"text": "У меня вопрос, ты знаешь про Бегимай с прошлого курса?",
"next": "line_5"
},
{
"id": "line_5",
"type": "Line",
"speaker": "Айпери",
"portrait": "resources/w/avatar_girlfriend.png",
"text": "Я слышала она не смогла сдать курсовую, прыгнула с окна и разбилась насмерть.",
"next": "line_6"
},
{
"id": "line_6",
"type": "Line",
"speaker": "Айпери",
"portrait": "resources/w/avatar_girlfriend.png",
"text": "Менты приезжали, следователи допрашивали ректора, такой скандал был.",
"next": "line_7"
},
{
"id": "line_7",
"type": "Line",
"speaker": "Айпери",
"portrait": "resources/w/avatar_girlfriend.png",
"text": "А зачем тебе?",
"next": "line_8"
},
{
"id": "line_8",
"type": "Line",
"speaker": "Бекзат",
"portrait": "resources/w/gg/gg2_s_podsvetkoy5.png",
"text": "Ты не знаешь кого-нибудь, кто с ней был знаком?",
"next": "line_9"
},
{
"id": "line_9",
"type": "Line",
"speaker": "Айпери",
"portrait": "resources/w/avatar_girlfriend.png",
"text": "У тебя в общаге живет Алик, в комнате напротив тебя.",
"next": "line_10"
},
{
"id": "line_10",
"type": "Line",
"speaker": "Айпери",
"portrait": "resources/w/avatar_girlfriend.png",
"text": "Он с того же курса. Можешь у него поспрашивать.",
"next": "line_11"
},
{
"id": "line_11",
"type": "Line",
"speaker": "Бекзат",
"portrait": "resources/w/gg/gg2_s_podsvetkoy5.png",
"text": "Хорошо, спасибо!",
"next": "end_1"
},
{
"id": "end_1",
"type": "End"
}
]
},
{
"id": "door_dialog001",
@ -187,6 +285,40 @@
"type": "End"
}
]
},
{
"id": "teacher_dialog003",
"start": "line_1",
"nodes": [
{
"id": "line_1",
"type": "Line",
"speaker": "Бекзат",
"portrait": "resources/w/gg/gg2_s_podsvetkoy5.png",
"text": "Аида Дженибековна, вы помните Бегимай? Она вам курсовую хотела сдать.",
"next": "line_2"
},
{
"id": "line_2",
"type": "Line",
"speaker": "Аида Дженибековна",
"portrait": "resources/w/avatar_teacher.png",
"text": "Да, она говорила что приносила курсовую, но у меня ее нигде нет.",
"next": "line_3"
},
{
"id": "line_3",
"type": "Line",
"speaker": "Аида Дженибековна",
"portrait": "resources/w/avatar_teacher.png",
"text": "Если ты найдешь и покажешь мне ее курсовую работу, я выставлю ей оценку.",
"next": "end_1"
},
{
"id": "end_1",
"type": "End"
}
]
},
{
"id": "book_dialog001",
@ -213,6 +345,132 @@
"type": "End"
}
]
},
{
"id": "ghost_dialog001",
"start": "line_1",
"nodes": [
{
"id": "line_1",
"type": "Line",
"speaker": "Бекзат",
"portrait": "resources/w/gg/gg2_s_podsvetkoy5.png",
"text": "Куда я попал?",
"next": "line_2"
},
{
"id": "line_2",
"type": "Line",
"speaker": "Бекзат",
"portrait": "resources/w/gg/gg2_s_podsvetkoy5.png",
"text": "Я что, сплю?",
"next": "end_1"
},
{
"id": "end_1",
"type": "End"
}
]
},
{
"id": "ghost_dialog002",
"start": "line_1",
"nodes": [
{
"id": "line_1",
"type": "Line",
"speaker": "Бекзат",
"portrait": "resources/w/gg/gg2_s_podsvetkoy5.png",
"text": "Я вижу какие-то тени!",
"next": "line_2"
},
{
"id": "line_2",
"type": "Line",
"speaker": "Бекзат",
"portrait": "resources/w/gg/gg2_s_podsvetkoy5.png",
"text": "Мне лучше держать нож наготове.",
"next": "end_1"
},
{
"id": "end_1",
"type": "End"
}
]
},
{
"id": "dialog_with_ghost001",
"start": "line_1",
"nodes": [
{
"id": "line_1",
"type": "Line",
"speaker": "Призрак",
"portrait": "resources/w/avatar_ghost.png",
"text": "Ты посмел заговорить со мной?",
"next": "line_2"
},
{
"id": "line_2",
"type": "Line",
"speaker": "Бекзат",
"portrait": "resources/w/gg/gg2_s_podsvetkoy5.png",
"text": "Ты кто?",
"next": "line_3"
},
{
"id": "line_3",
"type": "Line",
"speaker": "Призрак",
"portrait": "resources/w/avatar_ghost.png",
"text": "Меня зовут Бегимай, мне нужно сдать курсовую по манасоведению.",
"next": "line_4"
},
{
"id": "line_4",
"type": "Line",
"speaker": "Призрак",
"portrait": "resources/w/avatar_ghost.png",
"text": "Я появляюсь здесь каждую ночь, чтобы сдать курсовую.",
"next": "line_5"
},
{
"id": "line_5",
"type": "Line",
"speaker": "Бекзат",
"portrait": "resources/w/gg/gg2_s_podsvetkoy5.png",
"text": "И как я могу заставить тебя уйти отсюда?",
"next": "line_6"
},
{
"id": "line_6",
"type": "Line",
"speaker": "Призрак",
"portrait": "resources/w/avatar_ghost.png",
"text": "Я уйду на покой только когда увиду оценку по курсовой в своей зачетке.",
"next": "line_7"
},
{
"id": "line_7",
"type": "Line",
"speaker": "Призрак",
"portrait": "resources/w/avatar_ghost.png",
"text": "Я уйду из этого мира только когда я сдам курсовую. Поэтому я появляюсь здесь каждую ночь.",
"next": "line_8"
},
{
"id": "line_8",
"type": "Line",
"speaker": "Бекзат",
"portrait": "resources/w/gg/gg2_s_podsvetkoy5.png",
"text": "Ладно, я что-нибудь придумаю.",
"next": "end_1"
},
{
"id": "end_1",
"type": "End"
}
]
},
{
"id": "note_dialog001",
@ -239,32 +497,6 @@
"type": "End"
}
]
},
{
"id": "ghost_dialog001",
"start": "line_1",
"nodes": [
{
"id": "line_1",
"type": "Line",
"speaker": "Бекзат",
"portrait": "resources/w/gg/gg2_s_podsvetkoy5.png",
"text": "Я вижу какие-то тени!",
"next": "line_2"
},
{
"id": "line_2",
"type": "Line",
"speaker": "Бекзат",
"portrait": "resources/w/gg/gg2_s_podsvetkoy5.png",
"text": "Мне лучше держать нож наготове.",
"next": "end_1"
},
{
"id": "end_1",
"type": "End"
}
]
},
{
"id": "book_dialog002",

View File

@ -1,55 +0,0 @@
-- ============================================
-- NPC PATROL WAYPOINTS
-- ============================================
local function step2()
game_api.npc_walk_to(1, 19.5, 0.0, 32, step1)
end
function step1()
game_api.npc_walk_to(1, -6.45, 0.0, 7.82, step2)
end
step1()
local function step2x()
game_api.npc_walk_to(3, 12.7499, 0, -20.8708, step1x)
end
function step1x()
game_api.npc_walk_to(3, -5.74176, 0, -25.8261, step2x)
end
step1x()
-- ============================================
-- ITEM PICKUP HANDLER
-- ============================================
function on_health_pickup()
game_api.pickup_item("health_potion")
print("[Lua] Health potion picked up!")
end
-- ============================================
-- NPC INTERACTION HANDLER
-- ============================================
function on_npc_interact(npc_index)
print("[Lua] NPC interaction! Index: " .. tostring(npc_index))
if npc_index == 0 then
game_api.start_dialogue("dialog_student")
end
if npc_index == 1 then
game_api.start_dialogue("dialog_female_student")
end
if npc_index == 2 then
game_api.start_dialogue("dialog_mukhtar")
end
if npc_index == 4 then
game_api.start_dialogue("dialog_aida")
end
end
print("Lua script loaded successfully!")

View File

@ -72,5 +72,17 @@ game_api.set_player_hp(200)
end
end
game_api.set_location_callbacks(
function()
print("Enter location dorm")
local hp = game_api.getIntValue("player_hp")
game_api.set_player_hp(hp)
end,
function()
local hp = game_api.get_player_hp()
game_api.setIntValue("player_hp", hp)
end
)
print("Lua script loaded successfully--!")

View File

@ -27,19 +27,26 @@ end
game_api.set_darklands_callbacks(
nil,
function()
print("Lua script start_darklands_transition callback")
game_api.start_cutscene("darklands_exit001")
game_api.setIntValue("day", 1)
game_api.setIntValue("need_sleep", 1)
local need_sleep = game_api.getIntValue("need_sleep")
print("Lua script need sleep =")
print(need_sleep)
print("Lua script set need sleep 1")
game_api.set_player_hp(10)
end
)
game_api.set_location_callbacks(
function()
print("Enter location uni exterior")
local hp = game_api.getIntValue("player_hp")
game_api.set_player_hp(hp)
end,
function()
local hp = game_api.get_player_hp()
game_api.setIntValue("player_hp", hp)
end
)
game_api.set_trigger_zone_callbacks("darklands_exit001",
darklands_exit001_enter_callback,
nil

View File

@ -13,6 +13,8 @@ night_time = false
player_in_darklands = false
player_ghost_aware = false
function lection_hall_zone001_enter_callback()
--game_api.start_dialogue("")
--Start cutscene
@ -101,14 +103,23 @@ end
function on_npc_interact(npc_index)
print("[Lua] NPC interaction! Index: " .. tostring(npc_index))
if npc_index == 1 then
if (player_ghost_aware) then
game_api.start_dialogue("aiperi_dialog001")
else
game_api.start_dialogue("knife_dialog001")
end
end
if npc_index == 0 then
if (player_ghost_aware) then
game_api.start_dialogue("teacher_dialog003")
else
game_api.start_dialogue("teacher_dialog001")
end
--game_api.set_trigger_zone_enabled(2, false)
end
if npc_index == 2 then
game_api.start_dialogue("dialog_with_ghost001")
player_ghost_aware = true
end
end
@ -305,4 +316,42 @@ game_api.set_npc_enabled(3, false)
game_api.set_npc_enabled(4, false)
game_api.set_npc_enabled(5, false)
function setDay1setup()
game_api.switch_navigation(5)
game_api.deactivate_interactive_object("Room_Cover_Corridor_001")
game_api.deactivate_interactive_object("Room_Cover_Main_Hall_001")
game_api.deactivate_interactive_object("Room_Cover_North_1_001")
game_api.activate_interactive_object("Room_Cover_North_2_001")
game_api.deactivate_interactive_object("Room_Cover_North_3_001")
game_api.activate_interactive_object("Room_Cover_South_1_001")
game_api.activate_interactive_object("Room_Cover_South_2_001")
game_api.deactivate_interactive_object("Room_Cover_South_3_001")
game_api.set_npc_enabled(0, true)
game_api.set_npc_enabled(1, true)
game_api.set_npc_enabled(2, false)
game_api.set_npc_enabled(3, false)
game_api.set_npc_enabled(4, false)
game_api.set_npc_enabled(5, false)
end
game_api.set_location_callbacks(
function()
print("Enter location uni interior")
local hp = game_api.getIntValue("player_hp")
game_api.set_player_hp(hp)
local need_sleep = game_api.getIntValue("need_sleep")
local day = game_api.getIntValue("day")
if (day==1) then
setDay1setup()
end
end,
function()
local hp = game_api.get_player_hp()
game_api.setIntValue("player_hp", hp)
end
)
print("Lua script loaded successfully!")

63305
resources/w/dorm/chair002.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -188,6 +188,9 @@ namespace ZL
ItemRegistry::instance().loadFromJson("resources/config2/items.json", CONST_ZIP_FILE);
globalInts["player_hp"] = 200;
LocationSetup uniInteriorParams;
uniInteriorParams.gameObjectsJsonPath = "resources/config2/gameobjects_uni_interior.json";
uniInteriorParams.npcsJsonPath = "resources/config2/npcs_uni_interior.json";

View File

@ -198,6 +198,11 @@ namespace ZL {
if (game->player)
game->player->hp = value;
});
// get_player_hp() → float (0 if no player)
api.set_function("get_player_hp",
[game]() -> float {
return game->player ? game->player->hp : 0.0f;
});
// Global integer store — shared across all location scripts.
// setIntValue(key, value) / getIntValue(key) → int (0 if not set)