Bauul Posted June 14, 2018 Is there a way to check in ACS if a monster is awake? I thought CheckActorState might work, but that just checks if a state exists at all. I then thought perhaps check the monster's TargetID, but as the player doesn't have an id, that doesn't shift from 0 once the monster wakes up. Anyone got any more ideas? I presumed this would be relatively easy! 0 Share this post Link to post
0 Bauul Posted June 15, 2018 Thanks for the suggestions guys! The only thing was that I was trying to avoid giving the player an TID only because it can mess up mods quite badly (and I'm trying to make this as much a pure mapset and less a mod as possible). I asked over on Discord and Gutawer came to the rescue (again!). He built the following ZScript: class ActorTargetChecker { static bool hasTarget(Actor activator, int tid) { ActorIterator it = ActorIterator.create(tid); Actor mo = it.next(); if (mo != NULL) return mo.target != NULL; else return false; } } Which then feeds into the following ACS: int MonsterCheck=1; Script 1 (void) { while (MonsterCheck<101) { int isAwake = ScriptCall("ActorTargetChecker", "hasTarget", MonsterCheck); If (isAwake == 0) { Thing_Remove(MonsterCheck); } MonsterCheck++; } } This code works through individual monsters tagged 1 to 100 and in each case removes it if it hasn't assigned itself a target. 0 Share this post Link to post
0 Gez Posted June 14, 2018 The entire difference between a sleeping monster and an awake one is whether they have a null target pointer or not. And ACS doesn't let you access pointer values directly. A possibility is to simply give the player a TID in an ENTER or OPEN script. 1 Share this post Link to post
0 Empyre Posted June 14, 2018 3 hours ago, Gez said: The entire difference between a sleeping monster and an awake one is whether they have a null target pointer or not. And ACS doesn't let you access pointer values directly. A possibility is to simply give the player a TID in an ENTER or OPEN script. You should use an ENTER script for stuff that involves players because if the map is played in coop, a player might join the game after all the OPEN scripts have already run. Also, use a RESPAWN script. Here's a ZDoom Wiki page that talks about giving players a TID: https://zdoom.org/wiki/About_Multiplayer,_Scripts,_and_TIDs 2 Share this post Link to post
Is there a way to check in ACS if a monster is awake?
I thought CheckActorState might work, but that just checks if a state exists at all.
I then thought perhaps check the monster's TargetID, but as the player doesn't have an id, that doesn't shift from 0 once the monster wakes up.
Anyone got any more ideas? I presumed this would be relatively easy!
Share this post
Link to post