From a1fceb26c6d37de45ee7e85d07fa2d9ed7c0a55e Mon Sep 17 00:00:00 2001 From: am4u <3583562+am4u@users.noreply.github.com> Date: Sun, 24 Sep 2023 20:51:30 +0100 Subject: [PATCH] Minigame31: Open random platforms on start --- assets/map/warioware_redux_master.vmf | 17 ++-------------- src/scripting/Minigames/Minigame31.sp | 28 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/assets/map/warioware_redux_master.vmf b/assets/map/warioware_redux_master.vmf index c071c32..3eb4d64 100644 --- a/assets/map/warioware_redux_master.vmf +++ b/assets/map/warioware_redux_master.vmf @@ -2,7 +2,7 @@ versioninfo { "editorversion" "400" "editorbuild" "8864" - "mapversion" "8586" + "mapversion" "8587" "formatversion" "100" "prefab" "0" } @@ -114,7 +114,7 @@ bgimages_plus world { "id" "1" - "mapversion" "8586" + "mapversion" "8587" "classname" "worldspawn" "detailmaterial" "detail/detailsprites" "detailvbsp" "detail.vbsp" @@ -384659,19 +384659,6 @@ entity "logicalpos" "[0 -14768]" } } -entity -{ - "id" "5822298" - "classname" "info_null" - "origin" "5388 396 -180" - editor - { - "color" "220 30 220" - "visgroupshown" "1" - "visgroupautoshown" "1" - "logicalpos" "[0 -14268]" - } -} cameras { "activecamera" "0" diff --git a/src/scripting/Minigames/Minigame31.sp b/src/scripting/Minigames/Minigame31.sp index 44c624c..57da671 100644 --- a/src/scripting/Minigames/Minigame31.sp +++ b/src/scripting/Minigames/Minigame31.sp @@ -4,6 +4,9 @@ * Land Safely! */ +#define MINIGAME31_PLATFORM_MIN 1 +#define MINIGAME31_PLATFORM_MAX 4 + int g_iMinigame31PlayerIndex; public void Minigame31_EntryPoint() @@ -18,6 +21,8 @@ public void Minigame31_OnMinigameSelectedPre() if (g_iActiveMinigameId == 31) { g_iMinigame31PlayerIndex = 0; + + Minigame31_OpenPlatforms(); } } @@ -78,4 +83,27 @@ public void Minigame31_OnMinigameFinish() } } } +} + +void Minigame31_OpenPlatforms() +{ + int platform1 = GetRandomInt(MINIGAME31_PLATFORM_MIN, MINIGAME31_PLATFORM_MAX); + int platform2 = platform1; + + do + { + platform2 = GetRandomInt(MINIGAME31_PLATFORM_MIN, MINIGAME31_PLATFORM_MAX); + } + while (platform2 == platform1); + + Minigame31_TriggerPlatform(platform1); + Minigame31_TriggerPlatform(platform2); +} + +void Minigame31_TriggerPlatform(int platformId) +{ + char name[64]; + + Format(name, sizeof(name), "Minigame31_Platform%d", platformId); + SendEntityInput("func_door", name, "Open"); } \ No newline at end of file