DFF Posted February 20, 2018 Hey, making a small quickie map but i'm not quite sure how to proceed with the main script for them map. The main goal is for the player('s, but can be made for solo for now) to collect 7 keys (different keys, not all the same) to open a door, and what i want to happen is when a player picks up a key, it spawns a dummy prop of the key by the door (I can do this), however i want certain monsters to spawn when any amount of the 7 keys are collected (at 2, 4 and 7 keys per se) and for a door to open when all 7 are collected (instantly, not by player pressing use). I'm not terribly great at acs scripting currently, but what would the best way to setup this counter system? would giving the player an inventory item like "collectedkeys" be helpful (given when any key is picked up)? if its co-op could you set it up so it checks all players inventory for a sum of 7? any help would be appreciated. 0 Share this post Link to post
Empyre Posted February 21, 2018 Since you're using ACS, you can make a variable for that. Declare the variable outside any script or function, and it will be a map-scope variable, available to all scripts and functions in that map. Every time a player gets any key, add 1 to that variable. Have a script keep looking at that variable and do its thing when the variable reaches the desired number. Refer to https://zdoom.org/wiki/ACS for explanations of what does what and how to do stuff, and ask questions here or in the ZDoom forums when you need more help. 1 Share this post Link to post
Empyre Posted February 21, 2018 Here is more information about variable scope: https://zdoom.org/wiki/Scope I made a second post because I know you already read the previous post because you Liked it. 0 Share this post Link to post
Nevander Posted February 21, 2018 (edited) To be more specific with an example, you'd do something like this: Spoiler int keysTaken = 0; script 1 (void) { if(keysTaken >= 7) { // DOOR OPEN STUFF } else if(keysTaken == 6) { // ACTIONS WHEN 6 KEYS ARE TAKEN } else if(keysTaken == 5) { // ACTIONS WHEN 5 KEYS ARE TAKEN } etc... } script 2 (void) { keysTaken++; ACS_Execute(1, 0); // ACTIONS SPECIFIC WHEN TAKING KEY #1 } script 3 (void) { keysTaken++; ACS_Execute(1, 0); // ACTIONS SPECIFIC WHEN TAKING KEY #2 } etc... 2 Share this post Link to post
DFF Posted February 21, 2018 Thanks for both of the pointers, i'll see if i can make those work to my effect. 0 Share this post Link to post