#include "scenario_common.h" // Global variable int bStartGame = 0; int IMZombieID[13]; //float IMZombieTimer[13]; int IMCount = 0; int GearZombieID[3]; int BoneLegionID[3]; int bGetDiamond = 0; // 0: not get 1: get int DoorID[3]; int EDoorID[4]; int bEDoorOpened[4]; int bCutscenePlayed = 0; int ElectricitySwitch = 1; float bSwitchMoving = 0; int ButtonID[3]; int bButtonPressed[3]; int BoxOnButton[3]; int bRoomBSwitchOn = 0; int bGetKey = 0; // 0: No key 1: Get key 1 2: Get key 2 3: Get key 3 int bWheelActive = 0; int IronBoxID[4]; int GuardCount = 0; int IronMaidenAID = -1; int IronMaidenBID = -1; int ElectricityID[21]; float EPillarTimer = 0; float GameOverTime = -1; // use secondary bUseSecondary = 1; // scene has echo bVoiceEcho = 1; // Partner Position SpawnPartnerX = 0; SpawnPartnerY = 0; SpawnPartnerZ = 50; // local variable int i, ObjectID; string itemName; float dx, dy, dz; //void SetSawRoute(); void SpawnElectricity(); void ElectrifyRoom(int idx); // --------- // Game // --------- void OnCache() { LoadScene("sw03a"); CacheLevelModel("sw03key01"); CacheLevelModel("sw03key02"); CacheLevelModel("brokenrock"); CacheLevelCharacter("cw10"); CacheLevelCharacter("cw11"); } void OnHostGame() { SetGameMaxTime(-1); InitScenario(); for (i = 0 ; i < 3 ; i++) { bButtonPressed[i] = 0; SetSceneObjectSwitch(NumToStr("PRESSURE%02dA", i), "PRESENT", 0); SetSceneObjectSwitch(NumToStr("PRESSURE%02dB", i), "PRESENT", 0); } SetSceneObjectSwitch("PRESSURE00A", "PRESENT", 1); SetSceneObjectSwitch("GEARLIGHT", "PRESENT", 0); SetSceneObjectSwitch("ROOMBLIGHT", "PRESENT", 0); // get ironmaiden A, B id randomly IronMaidenAID = FindItem(NumToStr("IRONMAIDEN_%02d", rand()%14)); for(i = 0 ; (i < 14) && (IronMaidenBID < 0) ; i++) { IronMaidenBID = FindItem(NumToStr("IRONMAIDEN_%02d", rand()%14)); if (IronMaidenBID == IronMaidenAID) IronMaidenBID = -1; } if (IronMaidenBID < 0) { IronMaidenAID = FindItem("IRONMAIDEN_12"); IronMaidenBID = FindItem("IRONMAIDEN_13"); } // get door id for ( i = 0 ; i < 3 ; i++ ) { DoorID[i] = FindItem(NumToStr("SW03DOOR_%02d", i)); } for ( i = 0 ; i < 4 ; i++ ) { EDoorID[i] = FindItem(NumToStr("EDOOR_%02d", i)); } // get button id for ( i = 0 ; i < 3 ; i++ ) { ButtonID[i] = FindItem(NumToStr("sw03button_%02d", i)); BoxOnButton[i] = 0; } // get iron box id for ( i = 0 ; i < 4 ; i++ ) { IronBoxID[i] = FindItem(NumToStr("ironbox_%02d", i)); } // show diamond SetSceneObjectSwitch("DIAMOND", "PRESENT", 1); SpawnElectricity(); ElectrifyRoom(1); // SetEntityPos(PlayerID, -20, 1317,183); var_aiLockCountLimit = 3; // mission SetMissionObjectiveText(0, MOBJ_SW03_1); SetMissionObjectiveText(1, MOBJ_SW03_2); SetMissionObjectiveText(2, MOBJ_SW03_3); SetMissionObjectiveText(3, MOBJ_SW03_4); Print("Cutscene19\n"); BeginCutscene("cutscene19"); bStartGame = 1; } void OnCharaDead(int id, int killer) { Print("Chara ", id, " is killed by ", killer, "\n"); // Player dead if (id == PlayerID) PlayerDead(); if (id == PartnerID) { PartnerDead(); ShowHint(HINT_SW03A_12, 2); GameOverTime = 2; GameOver(GAMEOVER_LOSE); } itemName = GetCharaString(id, CHARA_NAME); if (itemName == "ZOMBIE") { KillScore(0, 425); /* for (i = 0 ; i < IMCount ; i++) { if (IMZombieID[i] == id) { IMZombieTimer[i] = 20; break; } } */ } else if (itemName == "ZOMBIE_GEAR") { KillScore(0, 425); } else if (itemName == "BONELEGION") { GuardCount++; if (GuardCount == 3) { SpawnItem("key", -500, 3025, 370); } KillScore(0, 450); } } void OnTimeOver() { Print("TimeOver\n"); GameOver(GAMEOVER_LOSE); } void OnUpdate(float t) { if (bStartGame == 1) { SetAudioVariable(0, 1000); bStartGame = 0; } if (ElectricitySwitch == 1) { if (BoxOnButton[0] == 0) { if (bButtonPressed[0] == 1) { bButtonPressed[0] = 2; } else if (bButtonPressed[0] == 2) { SetItemMachine(ButtonID[0], 1, 0); // change light SetSceneObjectSwitch("PRESSURE00A", "PRESENT", 1); SetSceneObjectSwitch("PRESSURE00B", "PRESENT", 0); // close door // SetItemMachine(EDoorID[0], 1, 0); ShowEntity(EDoorID[0], 1); ActivateEntity(EDoorID[0], 1); bEDoorOpened[0] = 0; bButtonPressed[0] = 0; } } } else if (ElectricitySwitch == 3) { if (BoxOnButton[1] == 0) { if (bButtonPressed[1] == 1) { bButtonPressed[1] = 2; } else if (bButtonPressed[1] == 2) { SetItemMachine(ButtonID[1], 1, 0); // change light SetSceneObjectSwitch("PRESSURE01A", "PRESENT", 1); SetSceneObjectSwitch("PRESSURE01B", "PRESENT", 0); // close door // SetItemMachine(EDoorID[2], 1, 0); ShowEntity(EDoorID[2], 1); ActivateEntity(EDoorID[2], 1); bEDoorOpened[2] = 0; bButtonPressed[1] = 0; } } if (BoxOnButton[2] == 0) { if (bButtonPressed[2] == 1) { bButtonPressed[2] = 2; } else if (bButtonPressed[2] == 2) { SetItemMachine(ButtonID[2], 1, 0); // change light SetSceneObjectSwitch("PRESSURE02A", "PRESENT", 1); SetSceneObjectSwitch("PRESSURE02B", "PRESENT", 0); // close door // SetItemMachine(EDoorID[3], 1, 0); ShowEntity(EDoorID[3], 1); ActivateEntity(EDoorID[3], 1); bEDoorOpened[3] = 0; bButtonPressed[2] = 0; } } } EPillarTimer = EPillarTimer + t; if (EPillarTimer > 10) { if (ElectricitySwitch == 1) { // SpawnSFX("SW03A_E_Pillar", -719.003, 1752.735, 418.767); // SpawnSFX("SW03A_E_Pillar", -837.275, 1752.735, 434.619); SpawnSFX("SW03A_E_Pillar", -873.574, 1841.324, 499.894); SpawnSFX("SW03A_E_Pillar", -873.553, 1752.789, 527.459); } else if (ElectricitySwitch == 2) { SpawnSFX("SW03A_E_Pillar", -490.076, 1777.832, 553.646); SpawnSFX("SW03A_E_Pillar", -875.819, 1979.275, 469.149); SpawnSFX("SW03A_E_Pillar", -875.819, 2125.914, 424.203); SpawnSFX("SW03A_E_Pillar", -634.892, 2126.019, 405.936); } else if (ElectricitySwitch == 3) { SpawnSFX("SW03A_E_Pillar", -655.479, 2534.311, 498.941); SpawnSFX("SW03A_E_Pillar", -765.991, 2495.218, 474.93); SpawnSFX("SW03A_E_Pillar", -836.941, 2614.201, 481.357); SpawnSFX("SW03A_E_Pillar", -659.541, 2614.201, 499.039); // SpawnSFX("SW03A_E_Pillar", -494.104, 2654.311, 473.646); SpawnSFX("SW03A_E_Pillar", -494.101, 2744.697, 425.257); // SpawnSFX("SW03A_E_Pillar", -575.369, 2783.156, 415.039); // SpawnSFX("SW03A_E_Pillar", -605.667, 2648.046, 316.901); SpawnSFX("SW03A_E_Pillar", -456.667, 2611.046, 274.901); // SpawnSFX("SW03A_E_Pillar", -531.48, 2752.311, 227.715); SpawnSFX("SW03A_E_Pillar", -643.358, 2787.739, 248.804); SpawnSFX("SW03A_E_Pillar", -820.669, 2713.324, 317.356); } EPillarTimer = 0; } if (GameOverTime > 0) { GameOverTime = GameOverTime - t; if (GameOverTime < 0) PlayerDead(); } /* for (i = 0 ; i < IMCount ; i++) { if (IMZombieTimer[i] > 0) { IMZombieTimer[i] = IMZombieTimer[i] - t; if (IMZombieTimer[i] < 0) { CharaReborn(IMZombieID[i], 0); } } } */ } void OnContinueGame() { if (bGetDiamond) { // reborn bone legion for (i = 0 ; i < 3 ; i++) { CharaReborn(BoneLegionID[i]); ObjectID = FindSceneItem(NumToStr("BONELEGION_%02d", i)); GetSceneItemPos(ObjectID, x, y, z); TeleportChara(BoneLegionID[i], x, y, z); } GuardCount = 0; } // destroy key ObjectID = FindItem("key"); if (ObjectID > 0) Destroy(ObjectID); // reborn player TeleportChara(PlayerID, -653, 1728, 400); SetEntityDir(PlayerID, 0, 1, 0); CharaReborn(PlayerID, 0); // reborn iron box for (i = 0 ; i < 4 ; i++) { for (int j = 0 ; j < 3 ; j++) { if (BoxOnButton[j] == IronBoxID[i]) break; } if (j < 3) continue; ObjectID = FindSceneItem(NumToStr("ironbox_%02d", i)); GetSceneItemPos(ObjectID, x, y, z); SetEntityPos(IronBoxID[i], x, y, z); GetSceneItemRot(ObjectID, x, y, z); SetEntityRot(IronBoxID[i], x, y, z); } PlayMusic("s13_torture_bgm", 1, 1); SetAudioVariable(0, 0); bStartGame = 1; } // --------- // Enemy // --------- void ZOMBIE_InitChara(int id) { // cw11 NPCW11_InitChara(id); SetCharaAttrib(id, CHARA_MAX_HP, 300*HandicapHP); // 生命上限 SetCharaAttrib(id, CHARA_HP, 300*HandicapHP); // 生命 SetCharaAttrib(id, CHARA_TEAM, 2); SetCharaWeapon(id, 0); SetCharaDart(id, 3, 30); } void ZOMBIE_InitAI(int id) { AI_Captain(PlayerID, id); SetAIAttrib(id, AI_THINK_SPEED, 60*ResponseRate); } void BONELEGION_InitChara(int id) { // cw10 NPCW10_InitChara(id); SetCharaAttrib(id, CHARA_MAX_HP, 300*HandicapHP); // 生命上限 SetCharaAttrib(id, CHARA_HP, 300*HandicapHP); // 生命 SetCharaAttrib(id, CHARA_TEAM, 2); SetCharaWeapon(id, 62); } void BONELEGION_InitAI(int id) { AI_Captain(PlayerID, id); SetAIAttrib(id, AI_THINK_SPEED, 75*ResponseRate); } // -------------- // Machine // -------------- void KEY_InitItem(int id) { if (bGetKey > 0) SetItemAttrib(id, ITEM_MODEL, "sw03key02", 1); else SetItemAttrib(id, ITEM_MODEL, "sw03key01", 1); SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_ROTATE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); SetItemAttrib(id, ITEM_LIGHT_SFX, "OBJ_Chi_Others"); } void KEY_OnTouch(int id, int charaId) { if (charaId != PlayerID) return; Destroy(id); if (bGetKey > 0) ShowMissionItem(4, 1); else ShowMissionItem(3, 1); PlaySound("fant_01_chimes_01"); bGetKey++; if (bGetKey == 3) { SetMissionObjectiveSwitch(3, 0); // open door SetItemMachine(DoorID[1], 1, 1); SetItemMachine(DoorID[2], 1, 1); SetCutsceneDelayTime(2); BeginCutscene("cutscene_none", "GameComplete"); SetCutsceneDelayTime(0); } } void IRONMAIDEN_InitItem(int id) { GetEntityPos(id, x, y, z); GetEntityUp(id, dx, dy, dz); SetItemAttrib(id, ITEM_MODEL, "ironmaiden", 1); SetItemAttrib(id, ITEM_MOVEPOINT, 2, x, y, z, x+40*dx, y+40*dy, z+40*dz); SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); SetItemAttrib(id, ITEM_WAITTIME, 0); SetItemAttrib(id, ITEM_MOVETYPE, 0); SetItemAttrib(id, ITEM_MOVESPEED, 20); SetItemAttrib(id, ITEM_NEXTPOINT, 1); SetItemAttrib(id, ITEM_HP, 0); // opening or not } void IRONMAIDEN_OnAttack(int id, int charaId, int damage) { if (charaId != PlayerID) return; Print(id, " is hit by ", charaId, "\n"); if (id == IronMaidenAID) { if (GetItemAttrib(id, ITEM_HP)) return; SetItemAttrib(id, ITEM_HP, 1); // open iron maiden SetItemMachine(id, 1, 1); } else if (id == IronMaidenBID) { if (bGetKey < 1) { ShowHint(HINT_SW03A_1); return; } if (GetItemAttrib(id, ITEM_HP)) return; SetItemAttrib(id, ITEM_HP, 1); // open iron maiden SetItemMachine(id, 1, 1); ShowMissionItem(1, 0); } else { // open iron maiden BreakItem(id, 150); // revive zombie for (i = 0 ; i < IMCount ; i++) { if (IsCharaDead(IMZombieID[i])) { CharaReborn(IMZombieID[i], 0); } } // summon zombie GetEntityPos(id, x, y, z); GetEntityDir(id, dx, dy, dz); x = x+10*dx; y = y+10*dy; z = z+10*dz; GetEntityUp(id, dx, dy, dz); x = x-30*dx; y = y-30*dy; z = z-30*dz; GetEntityRot(id, dx, dy, dz); IMZombieID[IMCount] = SpawnChara("zombie", x, y, z, dx); IMCount++; } } void IRONMAIDEN_OnReach(int id, int np) { if (id == IronMaidenAID) { GetEntityPos(id, x, y, z); GetEntityDir(id, dx, dy, dz); x = x + 6*dx; y = y + 6*dy; z = z + 6*dz; GetEntityRot(id, dx, dy, dz); SpawnItem("key", x, y, z-40, dx, dy, dz); } else if (id == IronMaidenBID) { GetEntityPos(id, x, y, z); GetEntityDir(id, dx, dy, dz); x = x + 6*dx; y = y + 6*dy; z = z + 6*dz; GetEntityRot(id, dx, dy, dz); SpawnItem("key", x, y, z-40, dx, dy, dz); } } void IRONMAIDEN_C_OnAttack(int id, int charaId, int damage) { if (charaId != PlayerID) return; if (bGetKey < 2) { ShowHint(HINT_SW03A_1); return; } if (GetItemAttrib(id, ITEM_HP)) return; SetItemAttrib(id, ITEM_HP, 1); // open iron maiden SetItemMachine(id, 1, 1); SetMissionObjectiveSwitch(0, 0); ShowMissionItem(1, 0); SetCutsceneDelayTime(2); PlayCharaCutsceneCB("cutscene20_1", "cutscene20"); SetCutsceneDelayTime(0); } void TRAPSTONE_InitItem(int id) { GetEntityPos(id, x, y, z); SetItemAttrib(id, ITEM_MODEL, "brokenrock", 1); // SetItemAttrib(id, ITEM_MOVEPOINT, 2, x, y, z, x, y, z-350); SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NORMAL); SetItemAttrib(id, ITEM_DAMAGE, 200); // SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_MACHINE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); SetItemAttrib(id, ITEM_MASS, 0.8); SetItemAttrib(id, ITEM_BOUNCE, 0); SetItemAttrib(id, ITEM_GRAVITY, -500); SetItemAttrib(id, ITEM_ATTACKDATA, 8); // SetItemAttrib(id, ITEM_WAITTIME, 0); // SetItemAttrib(id, ITEM_MOVETYPE, 0); // SetItemAttrib(id, ITEM_MOVESPEED, 350); // SetItemAttrib(id, ITEM_NEXTPOINT, 1); } /* void TRAPSTONE_OnTouch(int id, int charaId) { GetEntityPos(id, x, y, z); CharaHurt(charaId, 1, 200, x, y, z); } void TRAPSTONE_OnReach(int id, int np) { Destroy(id); } */ void TRAPSTONE_OnAttack(int id, int charaId, int damage) { Print("be attack\n"); BreakItem(id, 100); SpawnSFXOnEntity("OBJ_Stone01", id); } void TRAPSTONE_OnHitChara(int id, int charaId) { Print("hit chara\n"); BreakItem(id, 100); SpawnSFXOnEntity("OBJ_Stone01", id); } void TRAPSTONE_OnHitItem(int id, int item) { Print("hit item\n"); BreakItem(id, 50); SpawnSFXOnEntity("OBJ_Stone01", id); } void TRAPSTONE_OnHitWall(int id) { Print("hit wall\n"); BreakItem(id, 50); SpawnSFXOnEntity("OBJ_Stone01", id); } void TRAP_InitItem(int id) { GetEntityPos(id, x, y, z); GetEntityUp(id, dx, dy, dz); SetItemAttrib(id, ITEM_MODEL, "ironmaiden", 1); SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); SetItemAttrib(id, ITEM_HP, 0); // opening or not } void TRAP_OnAttack(int id, int charaId, int damage) { if (charaId != PlayerID) return; // if (GetItemAttrib(id, ITEM_HP)) return; // SetItemAttrib(id, ITEM_HP, 1); /* GetEntityPos(id, x, y, z); GetEntityDir(id, dx, dy, dz); SpawnItem("trapstone", x+15*dx, y+15*dy, z+250, dx, dy, dz); */ string idx = substr(GetItemString(id, ITEM_NAME), 5, 2); ObjectID = FindSceneItem("TRAPROCK_"+idx); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); ObjectID = SpawnItem("trapstone", x, y, z, dx, dy, dz); ThrowItem(ObjectID, 0, 0, -100); } // Button void SW03BUTTON_InitItem(int id) { GetEntityPos(id, x, y, z); SetItemAttrib(id, ITEM_MODEL, "pressure", 1); SetItemAttrib(id, ITEM_MOVEPOINT, 2, x, y, z, x, y, z-5); SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); SetItemAttrib(id, ITEM_WAITTIME, 0); SetItemAttrib(id, ITEM_MOVETYPE, 0); SetItemAttrib(id, ITEM_MOVESPEED, 30); SetItemAttrib(id, ITEM_NEXTPOINT, 0); } void ROOMBSWITCH_InitItem(int id) { SetItemAttrib(id, ITEM_MODEL, "powerswitch", 1); SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); SetItemAttrib(id, ITEM_WAITTIME, 0); SetItemAttrib(id, ITEM_ROTATEAXIS, 0, 1, 0); } void ROOMBSWITCH_OnAttack(int id, int charaId, int damage) { if (charaId != PlayerID) return; if (ElectricitySwitch != 2) { ShowHint(HINT_SW03A_2); return; } if (bRoomBSwitchOn) return; bRoomBSwitchOn = 1; GetEntityPos(id, x, y, z); Play3DSound("inte_11_stone_trigger_on", x, y, z); SetItemAttrib(id, ITEM_ROTATESPEED, 0.5); SetItemAttrib(id, ITEM_ROTATEANGLE, 1.2); SetItemMachine(id, 1); SetSceneObjectSwitch("ROOMBLIGHT", "PRESENT", 1); // Two Door Keep Open // SetItemMachine(EDoorID[1], 1, 1); ShowEntity(EDoorID[1], 0); ActivateEntity(EDoorID[1], 0); bEDoorOpened[1] = 1; BeginCutscene("shortcut_netdoor3"); } void TRIGGER_BUTTON00_OnTouch(int id, int charaId) { if (IsItem(charaId) && GetItemString(charaId, ITEM_MODEL) == "IronBox") { if (BoxOnButton[0] > 0) return; if (GetItemLifter(charaId)) return; BoxOnButton[0] = charaId; SetItemMachine(ButtonID[0], 1, 1); if (ElectricitySwitch == 1) { // open door ShowEntity(EDoorID[0], 0); ActivateEntity(EDoorID[0], 0); bEDoorOpened[0] = 1; BeginCutscene("shortcut_netdoor2box1"); } else { BeginCutscene("shortcut_netdoor2box2"); } ActivateEntity(id, 0); } else { if (ElectricitySwitch != 1) return; if (bButtonPressed[0] == 1) return; else if (bButtonPressed[0] == 2) { bButtonPressed[0] = 1; return; } SetItemMachine(ButtonID[0], 1, 1); bButtonPressed[0] = 1; SetSceneObjectSwitch("PRESSURE00A", "PRESENT", 0); SetSceneObjectSwitch("PRESSURE00B", "PRESENT", 1); // open door // SetItemMachine(EDoorID[0], 1, 1); ShowEntity(EDoorID[0], 0); ActivateEntity(EDoorID[0], 0); bEDoorOpened[0] = 1; // first time pressed if (bCutscenePlayed == 0) { BeginCutscene("shortcut_netdoor2"); bCutscenePlayed = 1; } } } void TRIGGER_BUTTON01_OnTouch(int id, int charaId) { if (IsItem(charaId) && GetItemString(charaId, ITEM_MODEL) == "IronBox") { if (BoxOnButton[1] > 0) return; if (GetItemLifter(charaId)) return; BoxOnButton[1] = charaId; SetItemMachine(ButtonID[1], 1, 1); if (ElectricitySwitch == 3) { // open door ShowEntity(EDoorID[2], 0); ActivateEntity(EDoorID[2], 0); bEDoorOpened[2] = 1; BeginCutscene("shortcut_netdoor4box1"); } else { BeginCutscene("shortcut_netdoor4box2"); } ActivateEntity(id, 0); } else { if (ElectricitySwitch != 3) return; if (bButtonPressed[1] == 1) return; else if (bButtonPressed[1] == 2) { bButtonPressed[1] = 1; return; } SetItemMachine(ButtonID[1], 1, 1); bButtonPressed[1] = 1; SetSceneObjectSwitch("PRESSURE01A", "PRESENT", 0); SetSceneObjectSwitch("PRESSURE01B", "PRESENT", 1); // open door // SetItemMachine(EDoorID[2], 1, 1); ShowEntity(EDoorID[2], 0); ActivateEntity(EDoorID[2], 0); bEDoorOpened[2] = 1; // first time pressed if (bCutscenePlayed == 1) { BeginCutscene("shortcut_netdoor4"); bCutscenePlayed = 2; } } } void TRIGGER_BUTTON02_OnTouch(int id, int charaId) { if (IsItem(charaId) && GetItemString(charaId, ITEM_MODEL) == "IronBox") { if (BoxOnButton[2] > 0) return; if (GetItemLifter(charaId)) return; BoxOnButton[2] = charaId; SetItemMachine(ButtonID[2], 1, 1); if (ElectricitySwitch == 3) { // open door ShowEntity(EDoorID[3], 0); ActivateEntity(EDoorID[3], 0); bEDoorOpened[3] = 1; BeginCutscene("shortcut_netdoor5box1"); } else { BeginCutscene("shortcut_netdoor5box2"); } ActivateEntity(id, 0); } else { if (ElectricitySwitch != 3) return; if (bButtonPressed[2] == 1) return; else if (bButtonPressed[2] == 2) { bButtonPressed[2] = 1; return; } SetItemMachine(ButtonID[2], 1, 1); bButtonPressed[2] = 1; SetSceneObjectSwitch("PRESSURE02A", "PRESENT", 0); SetSceneObjectSwitch("PRESSURE02B", "PRESENT", 1); // open door // SetItemMachine(EDoorID[3], 1, 1); ShowEntity(EDoorID[3], 0); ActivateEntity(EDoorID[3], 0); bEDoorOpened[3] = 1; // first time pressed if (bCutscenePlayed == 2) { BeginCutscene("shortcut_netdoor5"); bCutscenePlayed = 3; } } } // Switch void POWERSWITCH_InitItem(int id) { SetItemAttrib(id, ITEM_MODEL, "powerswitch", 1); SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); SetItemAttrib(id, ITEM_WAITTIME, 0); SetItemAttrib(id, ITEM_ROTATEAXIS, 0, 1, 0); } void POWERSWITCH_OnAttack(int id, int charaId, int damage) { if (charaId != PlayerID) return; if (bSwitchMoving) return; ElectricitySwitch++; GetEntityPos(id, x, y, z); Play3DSound("inte_11_stone_trigger_on", x, y, z); if (ElectricitySwitch > 3) { ElectricitySwitch = 1; SetItemAttrib(id, ITEM_ROTATESPEED, -0.5); SetItemAttrib(id, ITEM_ROTATEANGLE, -1.2); } else { SetItemAttrib(id, ITEM_ROTATESPEED, 0.5); SetItemAttrib(id, ITEM_ROTATEANGLE, 0.6); } // move bar SetItemMachine(id, 1); bSwitchMoving = 1; ShowHint(HINT_SW03A_7+ElectricitySwitch, 1.5); } void ElectrifyRoom(int idx) { SetSceneObjectSwitch("POWERLIGHTA", "PRESENT", idx == 1); SetSceneObjectSwitch("POWERLIGHTB", "PRESENT", idx == 2); SetSceneObjectSwitch("POWERLIGHTC", "PRESENT", idx == 3); SetSceneObjectSwitch("LIGHTA", "PRESENT", idx == 1); SetSceneObjectSwitch("LIGHTB", "PRESENT", idx == 2); SetSceneObjectSwitch("LIGHTC", "PRESENT", idx == 3); for (i = 0 ; i < 10 ; i++) SetSceneLightFunction(NumToStr("ROOMA%02d", i+1), NumToStr("function=none,value=%d", idx==1)); for (i = 0 ; i < 19 ; i++) SetSceneLightFunction(NumToStr("ROOMB%02d", i+1), NumToStr("function=none,value=%d", idx==2)); for (i = 0 ; i < 29 ; i++) SetSceneLightFunction(NumToStr("ROOMC%02d", i+1), NumToStr("function=none,value=%d", idx==3)); for (i = 0 ; i < 4 ; i++) { ShowEntity(ElectricityID[i], idx == 1); ActivateEntity(ElectricityID[i], idx == 1); } for (i = 4 ; i < 12 ; i++) { ShowEntity(ElectricityID[i], idx == 2); ActivateEntity(ElectricityID[i], idx == 2); } for (i = 12 ; i < 21 ; i++) { ShowEntity(ElectricityID[i], idx == 3); ActivateEntity(ElectricityID[i], idx == 3); } } void POWERSWITCH_OnReach(int id, int np) { bSwitchMoving = 0; ElectrifyRoom(ElectricitySwitch); if (ElectricitySwitch == 1) { if ( (bEDoorOpened[0] == 0) && (BoxOnButton[0] > 0) ) { // open door ShowEntity(EDoorID[0], 0); ActivateEntity(EDoorID[0], 0); bEDoorOpened[0] = 1; BeginCutscene("shortcut_netdoor2box3"); } else { SetSceneObjectSwitch("PRESSURE00A", "PRESENT", BoxOnButton[0] <= 0); SetSceneObjectSwitch("PRESSURE00B", "PRESENT", BoxOnButton[0] > 0); SetSceneObjectSwitch("PRESSURE01A", "PRESENT", 0); SetSceneObjectSwitch("PRESSURE01B", "PRESENT", 0); SetSceneObjectSwitch("PRESSURE02A", "PRESENT", 0); SetSceneObjectSwitch("PRESSURE02B", "PRESENT", 0); } } else if (ElectricitySwitch == 3) { if ( (bEDoorOpened[2] == 0) && (BoxOnButton[1] > 0) ) { // open door ShowEntity(EDoorID[2], 0); ActivateEntity(EDoorID[2], 0); bEDoorOpened[2] = 1; BeginCutscene("shortcut_netdoor4box3"); } else if ( (bEDoorOpened[3] == 0) && (BoxOnButton[2] > 0) ) { // open door ShowEntity(EDoorID[3], 0); ActivateEntity(EDoorID[3], 0); bEDoorOpened[3] = 1; BeginCutscene("shortcut_netdoor5box3"); } else { SetSceneObjectSwitch("PRESSURE00A", "PRESENT", 0); SetSceneObjectSwitch("PRESSURE00B", "PRESENT", 0); SetSceneObjectSwitch("PRESSURE01A", "PRESENT", BoxOnButton[1] <= 0); SetSceneObjectSwitch("PRESSURE01B", "PRESENT", BoxOnButton[1] > 0); SetSceneObjectSwitch("PRESSURE02A", "PRESENT", BoxOnButton[2] <= 0); SetSceneObjectSwitch("PRESSURE02B", "PRESENT", BoxOnButton[2] > 0); } } Print("Room ", ElectricitySwitch, " is electrified\n"); } void STATUE_InitItem(int id) { GetEntityPos(id, x, y, z); SetItemAttrib(id, ITEM_MODEL, "statue", 1); SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); SetItemAttrib(id, ITEM_WAITTIME, 0); SetItemAttrib(id, ITEM_MOVEPOINT, 2, x, y, z, x, y, z-10); SetItemAttrib(id, ITEM_MOVETYPE, 0); SetItemAttrib(id, ITEM_MOVESPEED, 10); SetItemAttrib(id, ITEM_NEXTPOINT, 1); } void STATUE_OnAttack(int id, int charaId, int damage) { if (charaId != PlayerID) return; if (!bGetDiamond) { Print("Get Diamond 2\n"); bGetDiamond = 1; ShowMissionItem(2, 1); // hide diamond SetSceneObjectSwitch("DIAMOND", "PRESENT", 0); // statue down SetItemMachine(id, 1, 1); // spawn bone legion for (i = 0 ; i < 3 ; i++) { ObjectID = FindSceneItem(NumToStr("BONELEGION_%02d", i)); GetSceneItemPos(ObjectID, x, y, z); BoneLegionID[i] = SpawnChara("bonelegion", x, y, z); } /* // activate gear wheels for (i = 1 ; i < 4 ; i++) { ObjectID = FindItem(NumToStr("gearwheel%02d_01", i)); SetItemMachine(ObjectID, 1); } */ SetMissionObjectiveSwitch(2, 0); SetCutsceneDelayTime(2); BeginCutscene("shortcut_headdoor"); SetCutsceneDelayTime(0); } } void GEARSWITCH_InitItem(int id) { SetItemAttrib(id, ITEM_MODEL, "powerswitch", 1); SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); SetItemAttrib(id, ITEM_WAITTIME, 0); SetItemAttrib(id, ITEM_ROTATEAXIS, 0, 1, 0); } void GEARSWITCH_OnAttack(int id, int charaId, int damage) { if (charaId != PlayerID) return; if (bWheelActive) return; GetEntityPos(id, x, y, z); Play3DSound("inte_11_stone_trigger_on", x, y, z); SetItemAttrib(id, ITEM_ROTATESPEED, 0.5); SetItemAttrib(id, ITEM_ROTATEANGLE, 1.2); SetItemMachine(id, 1); bWheelActive = 1; SetCutsceneDelayTime(2); PlayCharaCutsceneCB("shortcut_netdoor1", "shortcut_netdoor1"); SetCutsceneDelayTime(0); } void GEARSWITCH_OnReach(int id, int np) { SetMissionObjectiveSwitch(1, 0); // activate gear wheels for (i = 1 ; i < 4 ; i++) { ObjectID = FindItem(NumToStr("gearwheel%02d_00", i)); SetItemMachine(ObjectID, 1); } SetSceneObjectSwitch("GEARLIGHT", "PRESENT", 1); } void GEARWHEEL01_InitItem(int id) { SetItemAttrib(id, ITEM_MODEL, "gearwheel01", 1); SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); SetItemAttrib(id, ITEM_WAITTIME, 0); SetItemAttrib(id, ITEM_ROTATEAXIS, 0, -1, 0); SetItemAttrib(id, ITEM_ROTATESPEED, -0.8); } void GEARWHEEL02_InitItem(int id) { SetItemAttrib(id, ITEM_MODEL, "gearwheel02", 1); SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); SetItemAttrib(id, ITEM_WAITTIME, 0); SetItemAttrib(id, ITEM_ROTATEAXIS, 0, -1, 0); SetItemAttrib(id, ITEM_ROTATESPEED, 0.8); } void GEARWHEEL03_InitItem(int id) { SetItemAttrib(id, ITEM_MODEL, "gearwheel03", 1); SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); SetItemAttrib(id, ITEM_WAITTIME, 0); SetItemAttrib(id, ITEM_ROTATEAXIS, 0, -1, 0); SetItemAttrib(id, ITEM_ROTATESPEED, -0.8); } void SW03DOOR_InitItem(int id) { GetEntityPos(id, x, y, z); SetItemAttrib(id, ITEM_MODEL, "sw03door", 1); SetItemAttrib(id, ITEM_MOVEPOINT, 2, x, y, z, x, y, z + 80); // SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_MACHINE); SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); SetItemAttrib(id, ITEM_WAITTIME, 0); SetItemAttrib(id, ITEM_MOVETYPE, 0); SetItemAttrib(id, ITEM_MOVESPEED, 20); SetItemAttrib(id, ITEM_NEXTPOINT, 1); } void EDOOR_InitItem(int id) { GetEntityPos(id, x, y, z); SetItemAttrib(id, ITEM_MODEL, "edoor", 1); SetItemAttrib(id, ITEM_MOVEPOINT, 2, x, y, z, x, y, z + 80); SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); SetItemAttrib(id, ITEM_WAITTIME, 0); SetItemAttrib(id, ITEM_MOVETYPE, 0); SetItemAttrib(id, ITEM_MOVESPEED, 20); SetItemAttrib(id, ITEM_NEXTPOINT, 1); } // ------------- // Iron Box // ------------- void IRONBOX_InitItem(int id) { SetItemAttrib(id, ITEM_MODEL, "IronBox", 1); SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NORMAL); SetItemAttrib(id, ITEM_LIFTABLE, 1); SetItemAttrib(id, ITEM_PICKABLE, 0); SetItemAttrib(id, ITEM_MASS, 1.5); SetItemAttrib(id, ITEM_FRICTION, 0.85); SetItemAttrib(id, ITEM_BOUNCE, 0.1); SetItemAttrib(id, ITEM_GRAVITY, -500); } void CUTSCENEBOX_InitItem(int id) { GetEntityPos(id, x, y, z); SetItemAttrib(id, ITEM_MODEL, "IronBox", 1); SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); SetItemAttrib(id, ITEM_MOVEPOINT, 2, x, y, z, x, y, z-5); SetItemAttrib(id, ITEM_MOVESPEED, 10); SetItemAttrib(id, ITEM_WAITTIME, 0); SetItemAttrib(id, ITEM_MOVETYPE, 0); } // ----------- // Trigger // ----------- void TRIGGER_GEAR_OnTouch(int id, int charaId) { if (charaId != PlayerID) return; PlayCharaCutscene("shortcut5_1"); ActivateEntity(id, 0); } void TRIGGER_UNDEAD_OnTouch(int id, int charaId) { if (charaId != PlayerID) return; // activate gear zombie for (i = 0 ; i < 3 ; i++) { AIPerform(GearZombieID[i], AI_PERFORM_NONE); SetAIAttrib(GearZombieID[i], AI_LOOK_ANGLE, 360); } ActivateEntity(id, 0); } void TRIGGEROPENDOOR_InitItem(int id) { SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); } void TRIGGEROPENDOOR_00_OnTouch(int id, int charaId) { if (charaId != PlayerID) return; if (!bWheelActive) { ShowHint(HINT_SW03A_3); return; } ActivateEntity(id, 0); } void TRIGGERCLOSEDOOR_InitItem(int id) { SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); } void TRIGGERCLOSEDOOR_00_OnTouch(int id, int charaId) { if (charaId != PlayerID) return; PlayCharaCutsceneCB("shortcut5_2", "shortcut5_2"); // continue point bContinue = 1; ActivateEntity(id, 0); } void TRIGGERDEADZONE_InitItem(int id) { SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); } void TRIGGERDEADZONE_OnTouch(int id, int charaId) { for (i = 0 ; i < 4 ; i++) { if (charaId == IronBoxID[i]) { ObjectID = FindSceneItem(NumToStr("ironbox_%02d", i)); GetSceneItemPos(ObjectID, x, y, z); SetEntityPos(charaId, x, y, z); SetEntityDir(charaId, 0, 1, 0); return; } } GetEntityPos(charaId, x, y, z); CharaHurt(charaId, 5, 30000, x, y, z); } void TRIGGERDIAMOND_InitItem(int id) { SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); } void TRIGGERDIAMOND_OnTouch(int id, int charaId) { if (charaId != PlayerID) return; ShowHint(HINT_SW03A_6); } void TRIGGERHINT_InitItem(int id) { SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); } void TRIGGERHINT_00_OnTouch(int id, int charaId) { if (charaId != PlayerID) return; if (ElectricitySwitch != 1) ShowHint(HINT_SW03A_2); } void TRIGGERHINT_01_OnTouch(int id, int charaId) { if (charaId != PlayerID) return; if (ElectricitySwitch != 3) ShowHint(HINT_SW03A_2); } void TRIGGERHINT_02_OnTouch(int id, int charaId) { if (charaId != PlayerID) return; if (ElectricitySwitch != 3) ShowHint(HINT_SW03A_2); } void HINTSW03A1_InitItem(int id) { SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); } void HINTSW03A1_OnTouch(int id, int charaId) { if (charaId != PlayerID) return; ShowHint(HINT_SW03A_1); } void HINTSW03A1_00_OnTouch(int id, int charaId) { if (charaId != PlayerID) return; if (!bEDoorOpened[0]) ShowHint(HINT_SW03A_1); } void HINTSW03A1_01_OnTouch(int id, int charaId) { if (charaId != PlayerID) return; if (!bEDoorOpened[1]) ShowHint(HINT_SW03A_1); } void HINTSW03A1_02_OnTouch(int id, int charaId) { if (charaId != PlayerID) return; if (!bEDoorOpened[2]) ShowHint(HINT_SW03A_1); } void HINTSW03A1_03_OnTouch(int id, int charaId) { if (charaId != PlayerID) return; if (!bEDoorOpened[3]) ShowHint(HINT_SW03A_1); } void HINTSW03A1_04_OnTouch(int id, int charaId) { if (charaId != PlayerID) return; if (GuardCount < 3) ShowHint(HINT_SW03A_1); } void HINTSW03A1_05_OnTouch(int id, int charaId) { if (charaId != PlayerID) return; if (GuardCount < 3) ShowHint(HINT_SW03A_1); } void HINTSW03A4_InitItem(int id) { SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); } void HINTSW03A4_00_OnTouch(int id, int charaId) { if (charaId != PlayerID) return; if (bWheelActive) return; ShowHint(HINT_SW03A_4); } void HINTSW03A4_01_OnTouch(int id, int charaId) { if (charaId != PlayerID) return; if (ElectricitySwitch != 2) return; ShowHint(HINT_SW03A_4); } void HINTSW03A4_02_OnTouch(int id, int charaId) { if (charaId != PlayerID) return; if (bSwitchMoving) return; ShowHint(HINT_SW03A_4); } void HINTSW03A5_InitItem(int id) { SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); } void HINTSW03A5_OnTouch(int id, int charaId) { if (charaId != PlayerID) return; ShowHint(HINT_SW03A_5); } // -------------------- // cutscene callback // -------------------- void CUTSCENE19_OnEnd() { ObjectID = FindItem("ironmaiden_cutscene"); // open iron maiden // SetItemMachine(ObjectID, 1, 1); if (ObjectID > 0) BreakItem(ObjectID, 150); // revive zombie for (i = 0 ; i < IMCount ; i++) { if (IsCharaDead(IMZombieID[i])) { CharaReborn(IMZombieID[i], 0); } } // summon zombie GetEntityPos(ObjectID, x, y, z); GetEntityDir(ObjectID, dx, dy, dz); x = x+10*dx; y = y+10*dy; z = z+10*dz; GetEntityUp(ObjectID, dx, dy, dz); x = x-40*dx; y = y-40*dy; z = z-40*dz; GetEntityRot(ObjectID, dx, dy, dz); IMZombieID[IMCount] = SpawnChara("zombie", x, y, z, dx); IMCount++; PlayMusic("s13_torture_bgm", 1, 1); SetAudioVariable(0, 0); CutsceneEndPos3(97.2, 36.2, -58.5, 0.9, -0.2, 0, 119.5, 20.7, -56.4, 0.7, 0.7, 0); } void CUTSCENE20_OnEnd() { // close iron maiden door ObjectID = FindItem("IRONMAIDEN_C"); SetItemMachine(ObjectID, 1, 0); // move player outside TeleportChara(PlayerID, 30, 1160, 160); // hide and deactivate partner ShowEntity(PartnerID, 0); ActivateEntity(PartnerID, 0); // destroy all enemy for (i = 0 ; i < IMCount ; i++) { Destroy(IMZombieID[i]); IMZombieID[i] = 0; } IMCount = 0; // spawn guards on gear wheel for (i = 0 ; i < 3 ; i++) { ObjectID = FindSceneItem(NumToStr("GEARZOMBIE_%02d", i)); GetSceneItemPos(ObjectID, x, y, z); GearZombieID[i] = SpawnChara("zombie_gear", x, y, z); SetCharaWeapon(GearZombieID[i], 22); AIPerform(GearZombieID[i], AI_PERFORM_POSE, 164, -1); } } void SHORTCUT5_2_OnEnd() { // close door SetItemAttrib(DoorID[0], ITEM_MOVESPEED, 200); SetItemMachine(DoorID[0], 1, 0); // destroy gear zombie for (i = 0 ; i < 3 ; i++) { Destroy(GearZombieID[i]); GearZombieID[i] = 0; } } void SHORTCUT_NETDOOR1_OnEnd() { // open elec door SetItemMachine(DoorID[0], 1, 1); } void SHORTCUT_NETDOOR2BOX1_OnEnd() { // can't lift anymore SetItemAttrib(BoxOnButton[0], ITEM_LIFTABLE, 0); SetItemAttrib(BoxOnButton[0], ITEM_PHYSICS, ITEM_PHYSICS_NONE); // move to hole ObjectID = FindSceneItem("sw03button_00"); GetSceneItemPos(ObjectID, x, y, z); SetEntityPos(BoxOnButton[0], x, y, z-5); GetSceneItemRot(ObjectID, x, y, z); SetEntityRot(BoxOnButton[0], x, y, z); SetSceneObjectSwitch("PRESSURE00A", "PRESENT", 0); SetSceneObjectSwitch("PRESSURE00B", "PRESENT", 1); } void SHORTCUT_NETDOOR2BOX2_OnEnd() { // can't lift anymore SetItemAttrib(BoxOnButton[0], ITEM_LIFTABLE, 0); SetItemAttrib(BoxOnButton[0], ITEM_PHYSICS, ITEM_PHYSICS_NONE); // move to hole ObjectID = FindSceneItem("sw03button_00"); GetSceneItemPos(ObjectID, x, y, z); SetEntityPos(BoxOnButton[0], x, y, z-5); GetSceneItemRot(ObjectID, x, y, z); SetEntityRot(BoxOnButton[0], x, y, z); } void SHORTCUT_NETDOOR2BOX3_OnEnd() { SetSceneObjectSwitch("PRESSURE00A", "PRESENT", 0); SetSceneObjectSwitch("PRESSURE00B", "PRESENT", 1); } void SHORTCUT_NETDOOR4BOX1_OnEnd() { // can't lift anymore SetItemAttrib(BoxOnButton[1], ITEM_LIFTABLE, 0); SetItemAttrib(BoxOnButton[1], ITEM_PHYSICS, ITEM_PHYSICS_NONE); // move to hole ObjectID = FindSceneItem("sw03button_01"); GetSceneItemPos(ObjectID, x, y, z); SetEntityPos(BoxOnButton[1], x, y, z-5); GetSceneItemRot(ObjectID, x, y, z); SetEntityRot(BoxOnButton[1], x, y, z); SetSceneObjectSwitch("PRESSURE01A", "PRESENT", 0); SetSceneObjectSwitch("PRESSURE01B", "PRESENT", 1); } void SHORTCUT_NETDOOR4BOX2_OnEnd() { // can't lift anymore SetItemAttrib(BoxOnButton[1], ITEM_LIFTABLE, 0); SetItemAttrib(BoxOnButton[1], ITEM_PHYSICS, ITEM_PHYSICS_NONE); // move to hole ObjectID = FindSceneItem("sw03button_01"); GetSceneItemPos(ObjectID, x, y, z); SetEntityPos(BoxOnButton[1], x, y, z-5); GetSceneItemRot(ObjectID, x, y, z); SetEntityRot(BoxOnButton[1], x, y, z); } void SHORTCUT_NETDOOR4BOX3_OnEnd() { SetSceneObjectSwitch("PRESSURE01A", "PRESENT", 0); SetSceneObjectSwitch("PRESSURE01B", "PRESENT", 1); } void SHORTCUT_NETDOOR5BOX1_OnEnd() { // can't lift anymore SetItemAttrib(BoxOnButton[2], ITEM_LIFTABLE, 0); SetItemAttrib(BoxOnButton[2], ITEM_PHYSICS, ITEM_PHYSICS_NONE); // move to hole ObjectID = FindSceneItem("sw03button_02"); GetSceneItemPos(ObjectID, x, y, z); SetEntityPos(BoxOnButton[2], x, y, z-5); GetSceneItemRot(ObjectID, x, y, z); SetEntityRot(BoxOnButton[2], x, y, z); SetSceneObjectSwitch("PRESSURE02A", "PRESENT", 0); SetSceneObjectSwitch("PRESSURE02B", "PRESENT", 1); } void SHORTCUT_NETDOOR5BOX2_OnEnd() { // can't lift anymore SetItemAttrib(BoxOnButton[2], ITEM_LIFTABLE, 0); SetItemAttrib(BoxOnButton[2], ITEM_PHYSICS, ITEM_PHYSICS_NONE); // move to hole ObjectID = FindSceneItem("sw03button_02"); GetSceneItemPos(ObjectID, x, y, z); SetEntityPos(BoxOnButton[2], x, y, z-5); GetSceneItemRot(ObjectID, x, y, z); SetEntityRot(BoxOnButton[2], x, y, z); } void SHORTCUT_NETDOOR5BOX3_OnEnd() { SetSceneObjectSwitch("PRESSURE02A", "PRESENT", 0); SetSceneObjectSwitch("PRESSURE02B", "PRESENT", 1); } // ---------------- // electricity // ---------------- int InitElectricity(int type, float ex1, float ey1, float ez1, float ex2, float ey2, float ez2, float ex3, float ey3, float ez3, float ex4, float ey4, float ez4) { if (type == 1) { ObjectID = SpawnItem("electricity_00", ex1, ey1, ez1 , 0, 0, 0); SetItemAttrib(ObjectID, ITEM_MOVEPOINT, 4, ex1, ey1, ez1, ex2, ey2, ez2, ex3, ey3, ez3, ex4, ey4, ez4); } if (type == 2) { ObjectID = SpawnItem("electricity_00", ex1, ey1, ez1 , 90, 0, 0); SetItemAttrib(ObjectID, ITEM_MOVEPOINT, 4, ex1, ey1, ez1, ex2, ey2, ez2, ex3, ey3, ez3, ex4, ey4, ez4); } if (type == 3) { ObjectID = SpawnItem("electricity_01", ex1, ey1, ez1 , 0, 0, 0); SetItemAttrib(ObjectID, ITEM_MOVEPOINT, 4, ex1, ey1, ez1, ex2, ey2, ez2, ex3, ey3, ez3, ex4, ey4, ez4); } if (type == 4) { ObjectID = SpawnItem("electricity_01", ex1, ey1, ez1 , 90, 0, 0); SetItemAttrib(ObjectID, ITEM_MOVEPOINT, 4, ex1, ey1, ez1, ex2, ey2, ez2, ex3, ey3, ez3, ex4, ey4, ez4); } return ObjectID; } void SpawnElectricity() { ElectricityID[0] = InitElectricity(2, -740.63, 1732.064, 419.761, -763.073, 1732.064, 419.761, -795.231, 1732.064, 435.442, -817.341, 1732.064, 435.442);; ElectricityID[1] = InitElectricity(1, -817.341, 1732.064, 435.442, -817.341, 1754.913, 435.442, -817.341, 1839.953, 482.306, -817.341, 1860.458, 482.306);; ElectricityID[2] = InitElectricity(1, -893.439, 1859.917, 501.486, -893.439, 1839.919, 501.486, -893.439, 1755.187, 528.849, -893.439, 1731.806, 528.849); ElectricityID[3] = InitElectricity(2, -893.439, 1731.806, 528.849, -827.92, 1731.806, 529.959, -776.889, 1731.806, 536.741, -714.364, 1731.806, 554.052); ElectricityID[4] = InitElectricity(1, -511.088, 1779.648, 554.259, -511.088, 1871.608, 495.758, -511.088, 1993.493, 444.492, -511.088, 2038.393, 434.698); ElectricityID[5] = InitElectricity(1, -417.788, 2038.393, 422.908, -417.788, 1858.059, 342.625, -417.788, 1793.774, 324.797, -417.788, 1755.6, 319.492); ElectricityID[6] = InitElectricity(1, -511.162, 1755.6, 309.615, -511.162, 1802.312, 297.6, -511.162, 1922.55, 258.625, -511.162, 2027.942, 233.647); ElectricityID[7] = InitElectricity(1, -594.246, 2049.834, 264.258, -594.246, 2027.526, 264.258, -594.246, 1976.314, 285.837, -594.246, 1937.412, 311.462); ElectricityID[8] = InitElectricity(1, -678.799, 1910.389, 327.424, -678.799, 1937.248, 327.424, -678.799, 2037.335, 374.485, -678.799, 2060.138, 374.485); ElectricityID[9] = InitElectricity(1, -768.469, 2060.06, 379.812, -768.469, 2037.233, 379.812, -768.469, 1964.412, 410.46, -768.469, 1937.568, 425.033); ElectricityID[10] = InitElectricity(2, -770.713, 1913.391, 425.033, -791.743, 1913.391, 425.033, -872.87, 1913.391, 470.196, -895.525, 1913.391, 470.196); ElectricityID[11] = InitElectricity(2, -895.366, 2144.511, 425.346, -873.909, 2144.511, 425.346, -757.4, 2144.511, 407.11, -651.897, 2144.511, 407.11); ElectricityID[12] = InitElectricity(2, -696.628, 2514.688, 501.178, -743.487, 2514.688, 482.624, -790.347, 2514.688, 469.549, -894.51, 2514.688, 449.552); ElectricityID[13] = InitElectricity(1, -894.51, 2515.862, 449.552, -894.51, 2535.455, 449.552, -894.51, 2612.774, 469.498, -894.51, 2634.224, 469.498); ElectricityID[14] = InitElectricity(2, -654.342, 2634.361, 500.19, -617.744, 2634.361, 500.19, -496.098, 2634.361, 474.497, -475.427, 2634.361, 474.497); ElectricityID[15] = InitElectricity(3, -475.427, 2634.361, 474.497, -475.427, 2656.475, 474.497, -475.427, 2745.981, 425.861, -475.427, 2764.279, 425.861); ElectricityID[16] = InitElectricity(4, -475.427, 2764.279, 425.861, -538.693, 2764.279, 426.231, -655.782, 2764.279, 393.281, -671.606, 2764.279, 393.281); ElectricityID[17] = InitElectricity(4, -723.357, 2667.574, 365.615, -685.023, 2667.574, 348.559, -644.549, 2667.574, 348.559, -607.865, 2671.752, 317.599); ElectricityID[18] = InitElectricity(4, -587.414, 2629.33, 317.599, -566.292, 2629.33, 317.599, -494.066, 2629.33, 274.77, -474.252, 2629.33, 274.77); ElectricityID[19] = InitElectricity(3, -474.252, 2629.33, 274.77, -474.252, 2649.851, 274.77, -474.252, 2750.27, 228.35, -474.252, 2769.928, 228.35); ElectricityID[20] = InitElectricity(4, -734.967, 2731.073, 271.771, -760.103, 2731.073, 271.771, -819.675, 2731.073, 318.395, -839.74, 2731.073, 318.395); /* ElectricityID[0] = InitElectricity(2, -717.706, 1732.064, 419.761, -763.073, 1732.064, 419.761, -795.231, 1732.064, 435.442, -839.178, 1732.064, 435.442); ElectricityID[1] = InitElectricity(1, -817.341, 1708.398, 435.442, -817.341, 1754.913, 435.442, -817.341, 1839.953, 482.306, -817.341, 1879.283, 482.306); ElectricityID[2] = InitElectricity(1, -893.439, 1880.153, 501.486, -893.439, 1839.919, 501.486, -893.439, 1755.187, 528.849, -893.439, 1710.082, 528.849); ElectricityID[3] = InitElectricity(2, -915.647, 1731.806, 528.849, -827.92, 1731.806, 529.959, -776.889, 1731.806, 536.741, -709.888, 1731.806, 555.442); ElectricityID[4] = InitElectricity(1, -511.088, 1779.648, 554.259, -511.088, 1871.608, 495.758, -511.088, 1993.493, 444.492, -511.088, 2038.393, 434.698); ElectricityID[5] = InitElectricity(1, -417.788, 2038.393, 422.908, -417.788, 1858.059, 342.625, -417.788, 1793.774, 324.797, -417.788, 1755.6, 319.492); ElectricityID[6] = InitElectricity(1, -511.162, 1755.6, 309.615, -511.162, 1802.312, 297.6, -511.162, 1922.55, 258.625, -511.162, 2027.942, 233.647); ElectricityID[7] = InitElectricity(1, -594.246, 2071.008, 264.258, -594.246, 2027.526, 264.258, -594.246, 1976.314, 285.837, -594.246, 1937.412, 311.462); ElectricityID[8] = InitElectricity(1, -678.799, 1890.123, 327.424, -678.799, 1937.248, 327.424, -678.799, 2080.547, 374.485, -678.799, 2037.335, 374.485); ElectricityID[9] = InitElectricity(1, -768.469, 2080.547, 379.812, -768.469, 2037.233, 379.812, -768.469, 1964.412, 410.46, -768.469, 1937.568, 425.033); ElectricityID[10] = InitElectricity(2, -745.541, 1913.391, 425.033, -791.743, 1913.391, 425.033, -872.87, 1913.391, 470.196, -915.803, 1913.391, 470.196); ElectricityID[11] = InitElectricity(2, -915.803, 2144.511, 425.346, -873.909, 2144.511, 425.346, -757.4, 2144.511, 407.11, -633.939, 2144.511, 407.11); ElectricityID[12] = InitElectricity(2, -653.464, 2514.688, 501.178, -696.628, 2514.688, 501.178, -790.347, 2514.688, 469.549, -873.263, 2514.688, 449.552); ElectricityID[13] = InitElectricity(1, -894.51, 2493.679, 449.552, -894.51, 2535.455, 449.552, -894.51, 2612.774, 469.498, -894.51, 2654.975, 469.498); ElectricityID[14] = InitElectricity(2, -723.357, 2667.574, 365.615, -685.023, 2667.574, 348.559, -644.549, 2667.574, 348.559, -607.865, 2671.752, 317.599); ElectricityID[15] = InitElectricity(2, -607.865, 2629.33, 317.599, -566.292, 2629.33, 317.599, -494.066, 2629.33, 274.77, -454.4, 2629.33, 274.77); ElectricityID[16] = InitElectricity(1, -474.252, 2609.179, 274.77, -474.252, 2649.851, 274.77, -474.252, 2750.27, 228.35, -474.252, 2789.245, 228.35); ElectricityID[17] = InitElectricity(2, -674.475, 2634.361, 500.19, -617.744, 2634.361, 500.19, -496.098, 2634.361, 474.497, -454.706, 2634.361, 474.497); ElectricityID[18] = InitElectricity(1, -475.03, 2614.57, 474.468, -475.03, 2656.797, 474.468, -475.03, 2742.69, 426.231, -475.03, 2784.843, 426.231); ElectricityID[19] = InitElectricity(2, -454.016, 2764.279, 426.231, -538.693, 2764.279, 426.231, -655.782, 2764.279, 393.281, -690.382, 2764.279, 393.281); */ /* float routeX[4], routeY[4], routeZ[4]; // type 1 for (int j = 0 ; j < 1 ; j++) { for (i = 0 ; i < 4 ; i++) { ObjectID = FindSceneItem(NumToStr("ELEC00%02d", j)+NumToStr("_%02d", i)); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); routeX[i] = x; routeY[i] = y; routeZ[i] = z; } Electricity00ID[j] = SpawnItem("electricity_00", routeX[0], routeY[0], routeZ[0], dx, dy, dz); SetItemAttrib(Electricity00ID[0], ITEM_MOVEPOINT, 4, routeX[0], routeY[0], routeZ[0], routeX[1], routeY[1], routeZ[1], routeX[2], routeY[2], routeZ[2], routeX[3], routeY[3], routeZ[3]); } // type 2 for (int j = 0 ; j < 1 ; j++) { for (i = 0 ; i < 4 ; i++) { ObjectID = FindSceneItem(NumToStr("ELEC01%02d", j)+NumToStr("_%02d", i)); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); routeX[i] = x; routeY[i] = y; routeZ[i] = z; } Electricity01ID[j] = SpawnItem("electricity_01", routeX[0], routeY[0], routeZ[0], dx, dy, dz); SetItemAttrib(Electricity01ID[0], ITEM_MOVEPOINT, 4, routeX[0], routeY[0], routeZ[0], routeX[1], routeY[1], routeZ[1], routeX[2], routeY[2], routeZ[2], routeX[3], routeY[3], routeZ[3]); } */ } void ELECTRICITY_InitItem(int id) { SetItemAttrib(id, ITEM_MODEL, "ELECTRICBOX", 1); SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_MACHINE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); // SetItemAttrib(id, ITEM_SIZE, 30); SetItemAttrib(id, ITEM_WAITTIME, 0); SetItemAttrib(id, ITEM_MOVETYPE, 1); SetItemAttrib(id, ITEM_MOVESPEED, 120); SetItemAttrib(id, ITEM_NEXTPOINT, 1); SetItemAttrib(id, ITEM_HP, 0); // 拿來當暫存, 存方向, 0: 順 1: 逆 2: no hurt SetItemAttrib(id, ITEM_LIGHT_SFX, "SW03A_Electric1"); } void ELECTRICITY_OnTouch(int id, int charaId) { if (charaId != PlayerID) return; if (GetItemAttrib(id, ITEM_HP) == 2) return; GetEntityPos(id, x, y, z); if (charaId == PlayerID) CharaHurt(charaId, 3, 200, x, y, z); else CharaHurt(charaId, 3, 0, x, y, z); } // 從頭開始的 sample void ELECTRICITY_00_OnReach(int id, int np) { if (np == 2) { SetItemAttrib(id, ITEM_WAITTIME, 3); } // 到最後一個點了 if (np == 3) { // 移回第一個點的位置 ShowEntity(id, 0); GetEntityPos(id, x, y, z); GetEntityRot(id, dx, dy, dz); SpawnSFX2("SW03A_Electric2", x, y, z, dx, dy, dz); SetItemAttrib(id, ITEM_NEXTPOINT, 0); SetItemAttrib(id, ITEM_MOVESPEED, 1000); SetItemAttrib(id, ITEM_WAITTIME, 0.5); SetItemAttrib(id, ITEM_HP, 2); } if (np == 0) { if (GetItemAttrib(id, ITEM_HP)) { // 停一下 GetEntityPos(id, x, y, z); GetEntityRot(id, dx, dy, dz); SpawnSFX2("SW03A_Electric0", x, y, z, dx, dy, dz); SetItemAttrib(id, ITEM_NEXTPOINT, 0); SetItemAttrib(id, ITEM_HP, 0); SetItemAttrib(id, ITEM_WAITTIME, 0); } else { // 往第二個點移動 ShowEntity(id, 1); SetItemAttrib(id, ITEM_NEXTPOINT, 1); SetItemAttrib(id, ITEM_MOVESPEED, 120); } } } // 往回走的 sample void ELECTRICITY_01_OnReach(int id, int np) { int hp = GetItemAttrib(id, ITEM_HP); if (hp == 0) { // 順向 // 開始 if (np == 0) { ShowEntity(id, 1); // 往下一個點移 SetItemAttrib(id, ITEM_NEXTPOINT, 1); } // 到最後一個點了 if (np == 3) { // 往上一個點移 SetItemAttrib(id, ITEM_NEXTPOINT, 2); // 變逆向 SetItemAttrib(id, ITEM_HP, 1); } } else if (hp == 1) { // 逆向 // 往前移 if (np == 2) { // 往上一個點移 SetItemAttrib(id, ITEM_NEXTPOINT, 1); } if (np == 1) { // 往上一個點移 SetItemAttrib(id, ITEM_NEXTPOINT, 0); SetItemAttrib(id, ITEM_WAITTIME, 3); } if (np == 0) { ShowEntity(id, 0); GetEntityPos(id, x, y, z); GetEntityRot(id, dx, dy, dz); SpawnSFX2("SW03A_Electric2", x, y, z, dx, dy, dz); // 停一下 SetItemAttrib(id, ITEM_NEXTPOINT, 0); SetItemAttrib(id, ITEM_WAITTIME, 0.5); // 不傷 SetItemAttrib(id, ITEM_HP, 2); } } else if (hp == 2) { if (np == 0) { // 播開始特效 GetEntityPos(id, x, y, z); GetEntityRot(id, dx, dy, dz); SpawnSFX2("SW03A_Electric0", x, y, z, dx, dy, dz); SetItemAttrib(id, ITEM_NEXTPOINT, 0); SetItemAttrib(id, ITEM_WAITTIME, 0); // 變順向 SetItemAttrib(id, ITEM_HP, 0); } } }