#include "net_common.h" int F1Player[16]; // store players waiting in 1F int F2Player[16]; // store players waiting in 2F int F3Player[16]; // store players waiting in 3F int F4Player[16]; // store players waiting in 4F int Fighting[16]; // store fighting players (1F: 0~7 2F: 8~11 3F: 12~13 4F: 14~15) 14 & 15 are the King int numPlayer[4]; // store player number in each floor // local variable float x, y, z; float dx, dy, dz; int ObjectID; // for debug message void PrintLevelStatus() { Print("1F: ", numPlayer[0], "\n"); Print("2F: ", numPlayer[1], "\n"); Print("3F: ", numPlayer[2], "\n"); Print("4F: ", numPlayer[3], "\n"); Log("1F: ", numPlayer[0], " 2F: ", numPlayer[1], " 3F: ", numPlayer[2], " 4F: ", numPlayer[3], "\n"); Log("Fighting: \n"); for(int i = 0 ; i < 16 ; i=i+2) Log(Fighting[i], "vs" , Fighting[i+1], "\n"); Log("1F: "); for(i = 0 ; i < 8 ; i++) Log(F1Player[i], " "); Log("\n2F: "); for(i = 0 ; i < 8 ; i++) Log(F2Player[i], " "); Log("\n3F: "); for(i = 0 ; i < 8 ; i++) Log(F3Player[i], " "); Log("\n4F: "); for(i = 0 ; i < 8 ; i++) Log(F4Player[i], " "); Log("\n"); } void MyEntityPos(int id, float x, float y, float z, float dx) { // Log(id, " move to ", x, " ", y, " ", z, "\n"); TeleportChara(id, x, y, z, dx); } void TransferPlatform(int player, int floor, int num) { if (player <= 0) return; // send player to plat i Print("Player ", player, " move to ", floor+1, "F platform ", num, "\n"); ObjectID = FindSceneItem(NumToStr("PARK%d", floor+2)+NumToStr("F_%d", num)); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(player, x, y, z, dx); } // Queue void RefreshList(int floor, int array[]) { int i; if (floor == 0) { for (i = 0 ; i < 8 ; i=i+2) { if (array[i] == 0) { array[i] = array[i+8]; TransferPlatform(array[i+8], floor, i); array[i+1] = array[i+9]; TransferPlatform(array[i+9], floor, i+1); array[i+8] = array[i+9] = 0; } } } else if (floor == 1) { for (i = 0 ; i < 4 ; i=i+2) { if (array[i] == 0) { array[i] = array[i+4]; TransferPlatform(array[i+4], floor, i); array[i+1] = array[i+5]; TransferPlatform(array[i+5], floor, i+1); array[i+4] = array[i+5] = 0; } } for (i = 4 ; i < 14 ; i=i+2) { if (array[i] == 0) { array[i] = array[i+2]; TransferPlatform(array[i+2], floor, i); array[i+1] = array[i+3]; TransferPlatform(array[i+3], floor, i+1); array[i+2] = array[i+3] = 0; } } } else if (floor == 2) { for (i = 0 ; i < 14 ; i=i+2) { if (array[i] == 0) { array[i] = array[i+2]; TransferPlatform(array[i+2], floor, i); array[i+1] = array[i+3]; TransferPlatform(array[i+3], floor, i+1); array[i+2] = array[i+3] = 0; } } } else if (floor == 3) { for (i = 0 ; i < 15 ; i++) { if (array[i] == 0) { array[i] = array[i+1]; TransferPlatform(array[i+1], floor, i); array[i+1] = 0; } } } // PrintLevelStatus(); } // Teleport // player - playerID // floor 0 - 3. // playerArray eg. F1Player void SendPlayerToFloor(int player, int floor, int playerArray[]) { int i; // Champion's arena if (floor == 3) { // rule RuleScript("Rule1On1Over("+NumToStr("%d", player)+",0 ,2);"); if (numPlayer[3] == 0) { // send to 4F Print("First Player\n"); Fighting[14] = player; ObjectID = FindSceneItem("SPAWN5F_0"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(Fighting[14], x, y, z, dx); numPlayer[3]++; return; } for (i = 0 ; i < 16 ; i++) { if ( playerArray[i] == 0 ) { // send player to plat i Print("Player ", player, " move to ", floor+1, "F platform ", i, "\n"); ObjectID = FindSceneItem(NumToStr("PARK%d", floor+2)+NumToStr("F_%d", i)); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(player, x, y, z, dx); playerArray[i] = player; break; } } } else { // If there is no one on the destination floor but there is someone waiting on next floor, // then jump to next floor. if (floor == 0) { if ( (numPlayer[0] == 0) && (numPlayer[1] < 4) ) { SendPlayerToFloor(player, 1, F2Player); return; } } else if (floor == 1) { if ( (numPlayer[1] == 0) && (numPlayer[2] < 2) ) { SendPlayerToFloor(player, 2, F3Player); return; } } else if (floor == 2) { if ( (numPlayer[2] == 0) && (numPlayer[3] < 2) ) { SendPlayerToFloor(player, 3, F4Player); return; } } // Pair 2 charas together for battle if one is waiting. // NB. charas are put in even slots before odd. for (i = 0 ; i < 16 ; i=i+2) { if ( (playerArray[i] != 0) && (playerArray[i+1] == 0) ) { // send player to plat i+1 Print("Player ", player, " move to ", floor+1, "F platform ", i+1, "\n"); ObjectID = FindSceneItem(NumToStr("PARK%d", floor+2)+NumToStr("F_%d", i+1)); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(player, x, y, z, dx); playerArray[i+1] = player; break; } } // If no-one waiting then put chara into an empty even slot if (i == 16) { for (i = 0 ; i < 16 ; i=i+2) { if ( playerArray[i] == 0 ) { // send player to plat i Print("Player ", player, " move to ", floor+1, "F platform ", i, "\n"); ObjectID = FindSceneItem(NumToStr("PARK%d", floor+2)+NumToStr("F_%d", i)); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(player, x, y, z, dx); playerArray[i] = player; break; } } } } numPlayer[floor]++; // PrintLevelStatus(); } void OnCache() { LoadScene("IN01"); PlayNetGameMusic(in01_music); SetAudioEnvironment(ENVIRONMENT_GENERIC); } void OnHostGame() { for(int i = 0 ; i < 16 ; i++) { F1Player[i] = F2Player[i] = F3Player[i] = F4Player[i] = 0; Fighting[i] = 0; } numPlayer[0] = numPlayer[1] = numPlayer[2] = numPlayer[3] = 0; } void OnUpdate(float t) { int i; // check empty arena - if 2 chars waiting around it if (Fighting[0] == 0) { if ( (F1Player[0] != 0) && (F1Player[1] != 0) ) { // send 2 into arena ObjectID = FindSceneItem("SPAWN2F_0"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F1Player[0], x, y, z, dx); ObjectID = FindSceneItem("SPAWN2F_1"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F1Player[1], x, y, z, dx); Fighting[0] = F1Player[0]; Fighting[1] = F1Player[1]; F1Player[0] = F1Player[1] = 0; SetCharaSpectatorMode(Fighting[0], 0); SetCharaSpectatorMode(Fighting[1], 0); SetCharaAttrib(Fighting[0], CHARA_TEAM, 0); SetCharaAttrib(Fighting[1], CHARA_TEAM, 0); RefreshList(0, F1Player); // shift players to fill wait positions with lower id (ie. fill in any gaps) } else { // Check other waiting slots of other arenas in same floor for (i = 0; i < 8 ; i=i+2) { if ( (F1Player[i] != 0) && (F1Player[i+1] != 0) ) { // send 2 into arena ObjectID = FindSceneItem("SPAWN2F_0"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F1Player[i], x, y, z, dx); ObjectID = FindSceneItem("SPAWN2F_1"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F1Player[i+1], x, y, z, dx); Fighting[0] = F1Player[i]; Fighting[1] = F1Player[i+1]; F1Player[i] = F1Player[i+1] = 0; SetCharaSpectatorMode(Fighting[0], 0); SetCharaSpectatorMode(Fighting[1], 0); SetCharaAttrib(Fighting[0], CHARA_TEAM, 0); SetCharaAttrib(Fighting[1], CHARA_TEAM, 0); RefreshList(0, F1Player); break; } } } } if (Fighting[2] == 0) { if ( (F1Player[2] != 0) && (F1Player[3] != 0) ) { // send 2 into arena ObjectID = FindSceneItem("SPAWN2F_2"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F1Player[2], x, y, z, dx); ObjectID = FindSceneItem("SPAWN2F_3"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F1Player[3], x, y, z, dx); Fighting[2] = F1Player[2]; Fighting[3] = F1Player[3]; F1Player[2] = F1Player[3] = 0; SetCharaSpectatorMode(Fighting[2], 0); SetCharaSpectatorMode(Fighting[3], 0); SetCharaAttrib(Fighting[2], CHARA_TEAM, 0); SetCharaAttrib(Fighting[3], CHARA_TEAM, 0); RefreshList(0, F1Player); } else { for (i = 0; i < 8 ; i=i+2) { if ( (F1Player[i] != 0) && (F1Player[i+1] != 0) ) { // send 2 into arena ObjectID = FindSceneItem("SPAWN2F_2"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F1Player[i], x, y, z, dx); ObjectID = FindSceneItem("SPAWN2F_3"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F1Player[i+1], x, y, z, dx); Fighting[2] = F1Player[i]; Fighting[3] = F1Player[i+1]; F1Player[i] = F1Player[i+1] = 0; SetCharaSpectatorMode(Fighting[2], 0); SetCharaSpectatorMode(Fighting[3], 0); SetCharaAttrib(Fighting[2], CHARA_TEAM, 0); SetCharaAttrib(Fighting[3], CHARA_TEAM, 0); RefreshList(0, F1Player); break; } } } } if (Fighting[4] == 0) { if ( (F1Player[4] != 0) && (F1Player[5] != 0) ) { // send 2 into arena ObjectID = FindSceneItem("SPAWN2F_4"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F1Player[4], x, y, z, dx); ObjectID = FindSceneItem("SPAWN2F_5"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F1Player[5], x, y, z, dx); Fighting[4] = F1Player[4]; Fighting[5] = F1Player[5]; F1Player[4] = F1Player[5] = 0; SetCharaSpectatorMode(Fighting[4], 0); SetCharaSpectatorMode(Fighting[5], 0); SetCharaAttrib(Fighting[4], CHARA_TEAM, 0); SetCharaAttrib(Fighting[5], CHARA_TEAM, 0); RefreshList(0, F1Player); } else { for (i = 0; i < 8 ; i=i+2) { if ( (F1Player[i] != 0) && (F1Player[i+1] != 0) ) { // send 2 into arena ObjectID = FindSceneItem("SPAWN2F_4"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F1Player[i], x, y, z, dx); ObjectID = FindSceneItem("SPAWN2F_5"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F1Player[i+1], x, y, z, dx); Fighting[4] = F1Player[i]; Fighting[5] = F1Player[i+1]; F1Player[i] = F1Player[i+1] = 0; SetCharaSpectatorMode(Fighting[4], 0); SetCharaSpectatorMode(Fighting[5], 0); SetCharaAttrib(Fighting[4], CHARA_TEAM, 0); SetCharaAttrib(Fighting[5], CHARA_TEAM, 0); RefreshList(0, F1Player); break; } } } } if (Fighting[6] == 0) { if ( (F1Player[6] != 0) && (F1Player[7] != 0) ) { // send 2 into arena ObjectID = FindSceneItem("SPAWN2F_6"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F1Player[6], x, y, z, dx); ObjectID = FindSceneItem("SPAWN2F_7"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F1Player[7], x, y, z, dx); Fighting[6] = F1Player[6]; Fighting[7] = F1Player[7]; F1Player[6] = F1Player[7] = 0; SetCharaSpectatorMode(Fighting[6], 0); SetCharaSpectatorMode(Fighting[7], 0); SetCharaAttrib(Fighting[6], CHARA_TEAM, 0); SetCharaAttrib(Fighting[7], CHARA_TEAM, 0); RefreshList(0, F1Player); } else { for (i = 0; i < 8 ; i=i+2) { if ( (F1Player[i] != 0) && (F1Player[i+1] != 0) ) { // send 2 into arena ObjectID = FindSceneItem("SPAWN2F_6"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F1Player[i], x, y, z, dx); ObjectID = FindSceneItem("SPAWN2F_7"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F1Player[i+1], x, y, z, dx); Fighting[6] = F1Player[i]; Fighting[7] = F1Player[i+1]; F1Player[i] = F1Player[i+1] = 0; SetCharaSpectatorMode(Fighting[6], 0); SetCharaSpectatorMode(Fighting[7], 0); SetCharaAttrib(Fighting[6], CHARA_TEAM, 0); SetCharaAttrib(Fighting[7], CHARA_TEAM, 0); RefreshList(0, F1Player); break; } } } } if (Fighting[8] == 0) { if ( (F2Player[0] != 0) && (F2Player[1] != 0) ) { // send 2 into arena ObjectID = FindSceneItem("SPAWN3F_0"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F2Player[0], x, y, z, dx); ObjectID = FindSceneItem("SPAWN3F_1"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F2Player[1], x, y, z, dx); Fighting[8] = F2Player[0]; Fighting[9] = F2Player[1]; F2Player[0] = F2Player[1] = 0; SetCharaSpectatorMode(Fighting[8], 0); SetCharaSpectatorMode(Fighting[9], 0); SetCharaAttrib(Fighting[8], CHARA_TEAM, 0); SetCharaAttrib(Fighting[9], CHARA_TEAM, 0); RefreshList(1, F2Player); } else { for (i = 0; i < 4 ; i=i+2) { if ( (F2Player[i] != 0) && (F2Player[i+1] != 0) ) { // send 2 into arena ObjectID = FindSceneItem("SPAWN3F_0"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F2Player[i], x, y, z, dx); ObjectID = FindSceneItem("SPAWN3F_1"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F2Player[i+1], x, y, z, dx); Fighting[8] = F2Player[i]; Fighting[9] = F2Player[i+1]; F2Player[i] = F2Player[i+1] = 0; SetCharaSpectatorMode(Fighting[8], 0); SetCharaSpectatorMode(Fighting[9], 0); SetCharaAttrib(Fighting[8], CHARA_TEAM, 0); SetCharaAttrib(Fighting[9], CHARA_TEAM, 0); RefreshList(1, F2Player); break; } } } } if (Fighting[10] == 0) { if ( (F2Player[2] != 0) && (F2Player[3] != 0) ) { // send 2 into arena ObjectID = FindSceneItem("SPAWN3F_2"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F2Player[2], x, y, z, dx); ObjectID = FindSceneItem("SPAWN3F_3"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F2Player[3], x, y, z, dx); Fighting[10] = F2Player[2]; Fighting[11] = F2Player[3]; F2Player[2] = F2Player[3] = 0; SetCharaSpectatorMode(Fighting[10], 0); SetCharaSpectatorMode(Fighting[11], 0); SetCharaAttrib(Fighting[10], CHARA_TEAM, 0); SetCharaAttrib(Fighting[11], CHARA_TEAM, 0); RefreshList(1, F2Player); } else { for (i = 0; i < 4 ; i=i+2) { if ( (F2Player[i] != 0) && (F2Player[i+1] != 0) ) { // send 2 into arena ObjectID = FindSceneItem("SPAWN3F_2"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F2Player[i], x, y, z, dx); ObjectID = FindSceneItem("SPAWN3F_3"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F2Player[i+1], x, y, z, dx); Fighting[10] = F2Player[i]; Fighting[11] = F2Player[i+1]; F2Player[i] = F2Player[i+1] = 0; SetCharaSpectatorMode(Fighting[10], 0); SetCharaSpectatorMode(Fighting[11], 0); SetCharaAttrib(Fighting[10], CHARA_TEAM, 0); SetCharaAttrib(Fighting[11], CHARA_TEAM, 0); RefreshList(1, F2Player); break; } } } } if (Fighting[12] == 0) { if ( (F3Player[0] != 0) && (F3Player[1] != 0) ) { // send 2 into arena ObjectID = FindSceneItem("SPAWN4F_0"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F3Player[0], x, y, z, dx); ObjectID = FindSceneItem("SPAWN4F_1"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F3Player[1], x, y, z, dx); Fighting[12] = F3Player[0]; Fighting[13] = F3Player[1]; F3Player[0] = F3Player[1] = 0; SetCharaSpectatorMode(Fighting[12], 0); SetCharaSpectatorMode(Fighting[13], 0); SetCharaAttrib(Fighting[12], CHARA_TEAM, 0); SetCharaAttrib(Fighting[13], CHARA_TEAM, 0); RefreshList(2, F3Player); } } if (Fighting[15] == 0) { if ( (F4Player[0] != 0) ) { // If there is no king then waiting player becomes king if (Fighting[14] == 0) { Fighting[14] = F4Player[0]; F4Player[0] = 0; ObjectID = FindSceneItem("SPAWN5F_0"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(Fighting[14], x, y, z, dx); SetCharaSpectatorMode(Fighting[14], 1); RefreshList(3, F4Player); } else { // send 2 into arena ObjectID = FindSceneItem("SPAWN5F_0"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(Fighting[14], x, y, z, dx); ObjectID = FindSceneItem("SPAWN5F_1"); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(F4Player[0], x, y, z, dx); Fighting[15] = F4Player[0]; F4Player[0] = 0; SetCharaSpectatorMode(Fighting[14], 0); SetCharaSpectatorMode(Fighting[15], 0); SetCharaAttrib(Fighting[14], CHARA_TEAM, 0); SetCharaAttrib(Fighting[15], CHARA_TEAM, 0); RefreshList(3, F4Player); // for(i = 0 ; i < 15 ; i++) // F4Player[i] = F4Player[i+1]; } } } } // id - charaID of chara who died. // killer - charaID, but this could be 0 - killed by non-chara eg. fire. void OnCharaDead(int id, int killer) { int winner; int floor; // arena // check killed player in which floor // check if player was in the arena (fighting) for (int i = 0 ; i < 16 ; i++) { if (Fighting[i] == id) { if (i%2) { winner = Fighting[i-1]; Fighting[i-1] = Fighting[i] = 0; } else { winner = Fighting[i+1]; Fighting[i] = Fighting[i+1] = 0; } floor = i/2; break; } } // death due to combat if (i < 16) { // send loser to B1 CharaReborn(id); SetCharaAttrib(id, CHARA_TEAM, 1); // send AI to teleport point if (!GetCharaPlayer(id)) { AIPerform(id, AI_PERFORM_MOVETOPOINT, 0); } // send winner up SetCharaAttrib(winner, CHARA_TEAM, 1); // CharaReborn(winner, 0); if ( (floor >= 0) && (floor < 4) ) // 1st floor { SendPlayerToFloor(winner, 1, F2Player); numPlayer[0] = numPlayer[0] - 2; } else if ( (floor == 4) || (floor == 5) ) // 2nd floor { SendPlayerToFloor(winner, 2, F3Player); numPlayer[1] = numPlayer[1] - 2; } else if ( floor == 6 ) // 3rd floor { SendPlayerToFloor(winner, 3, F4Player); numPlayer[2] = numPlayer[2] - 2; } else if ( floor == 7 ) // top floor { Fighting[14] = winner; numPlayer[3]--; // rule RuleScript("Rule1On1Over("+NumToStr("%d", winner)+","+NumToStr("%d", id)+",3);"); } CharaReborn(winner, 0); SetCharaSpectatorMode(winner, 1); } else // died from non-combat { Log(id, " is killed unnormal\n"); CharaReborn(id, 0); } // check wait status // make sure no-one is waiting. if a person is waiting then he will advance one floor. if ( (numPlayer[2] == 1) && (numPlayer[3] < 2) ) { for (i = 0 ; i < 16 ; i++) { if (F3Player[i] != 0) { SendPlayerToFloor(F3Player[i], 3, F4Player); F3Player[i] = 0; numPlayer[2]--; break; } } } if ( (numPlayer[1] == 1) && (numPlayer[2] < 2) ) { for (i = 0 ; i < 16 ; i++) { if (F2Player[i] != 0) { SendPlayerToFloor(F2Player[i], 2, F3Player); F2Player[i] = 0; numPlayer[1]--; break; } } } if ( (numPlayer[0] == 1) && (numPlayer[1] < 2) ) { for (i = 0 ; i < 16 ; i++) { if (F1Player[i] != 0) { SendPlayerToFloor(F1Player[i], 1, F2Player); F1Player[i] = 0; numPlayer[0]--; break; } } } // Log(killer, " killed ", id, "\n"); // PrintLevelStatus(); } void OnCharaLeave(int c) { // if king leaves if ( (Fighting[14] == c) && (Fighting[15] == 0) ) { Fighting[14] = 0; numPlayer[3]--; OnCharaDead(c, 0); return; } for (int i = 0 ; i < 16 ; i++) { if (Fighting[i] == c) { OnCharaDead(c, 0); return; } } for(i = 0 ; i < 16 ; i++) { if (F1Player[i] == c) { if (i%2) { F1Player[i] = 0; } else { F1Player[i] = F1Player[i+1]; F1Player[i+1] = 0; RefreshList(0, F1Player); } numPlayer[0]--; } if (F2Player[i] == c) { if (i%2) { F2Player[i] = 0; } else { F2Player[i] = F2Player[i+1]; F2Player[i+1] = 0; RefreshList(1, F2Player); } numPlayer[1]--; } if (F3Player[i] == c) { if (i%2) { F3Player[i] = 0; } else { F3Player[i] = F3Player[i+1]; F3Player[i+1] = 0; RefreshList(2, F3Player); } numPlayer[2]--; } if (F4Player[i] == c) { F4Player[i] = 0; RefreshList(3, F4Player); numPlayer[3]--; } } } // Portal void PARK1F_InitItem(int id) { SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); } void PARK1F_OnTouch(int id, int charaId) { // Log(charaId, " enter arena\n"); // check if chara should be fighting // Error handling code - if chara falls through floor and ends up here... shouldn't happen but has happened before! for (int i = 0 ; i < 16 ; i++) { if (Fighting[i] == charaId) { if ( i < 8 ) { ObjectID = FindSceneItem("SPAWN2F_%d", i); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(charaId, x, y, z, dx); } else if (i < 12) { ObjectID = FindSceneItem("SPAWN3F_%d", i-8); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(charaId, x, y, z, dx); } else if (i < 14) { ObjectID = FindSceneItem("SPAWN4F_%d", i-12); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(charaId, x, y, z, dx); } else if (i < 16) { ObjectID = FindSceneItem("SPAWN5F_%d", i-14); GetSceneItemPos(ObjectID, x, y, z); GetSceneItemRot(ObjectID, dx, dy, dz); MyEntityPos(charaId, x, y, z, dx); } return; } } CharaReborn(charaId, 0); // SetCharaAttrib(charaId, CHARA_TEAM, 0); // send to 1F SendPlayerToFloor(charaId, 0, F1Player); SetCharaSpectatorMode(charaId, 1); } /* int level = 1; int lp[5]; int point = 0; void TransferNext(int id) { lp[0] = 16 ; lp[1] = 8 ; lp[2] = 12 ; lp[3] = 14; lp[4] = 14; for (level = 2 ; level < 6 ; level++) { for (point = 0 ; point < lp[level-1] ; point++) { ObjectID = FindSceneItem(NumToStr("PARK%dF", level)+NumToStr("_%d", point)); GetSceneItemPos(ObjectID, x, y, z); SetEntityPos(id, x, y, z); float dx, dy, dz; GetEntityPos(id, dx, dy, dz); if ( ((dx-x)*(dx-x) + (dy-y)*(dy-y) + (dz-z)*(dz-z)) > 300 ) Print("level = ", level, ", point = ", point, "\n"); } } ObjectID = FindSceneItem(NumToStr("PARK%dF", level)+NumToStr("_%d", point)); GetSceneItemPos(ObjectID, x, y, z); SetEntityPos(id, x, y, z); point++; if (point >= lp[level-1]) { level++; point = 0; } if (level > 5) level = 1; } */ void CLTRGHINT01_InitItem(int id) { SetItemAttrib(id, ITEM_PHYSICS, ITEM_PHYSICS_NONE); SetItemAttrib(id, ITEM_LIFTABLE, 0); SetItemAttrib(id, ITEM_PICKABLE, 0); } void CLTRGHINT01_OnTouch(int id, int charaId) { if (!IsLocalPlayerChara(charaId)) return; ShowHint(HINT_IN01_1); }