Jump to content


Photo

Any way to find out if an area has been cleared?


  • Please log in to reply
6 replies to this topic

#1 temnix

temnix
  • Member
  • 983 posts

Posted 23 August 2017 - 06:10 AM

I've been breaking my noggin over this. How can the engine be told that there are no enemies left in an area? Let's assume enemies are EVILCUTOFF, not those who are blue and then go hostile after an introduction. Exists() and InMyArea() don't work with a type, and InActiveArea() breaks the game.

 

Edit: oooops, my bad. Should have read the whole trigger list first. AreaCheckAllegiance(I:Allegience*EA). Except it doesn't take 200 for EVILCUTOFF, you've got to give it 255 for ENEMY.

 

But though I found the code, I'm missing the rest of the pieces for my idea. The idea is to implement surprise attacks by monsters in areas that have been cleared and players don't expect any surprises. Sure, in places monsters still spring up even later, but spawn points often deactivate after one use, and many monsters on a map weren't spawned in the first place but put there by hand. Once those are dead, an area pretty much goes quiet. The characters relax in their pants and let their gut hang out. Whether it's a level of a dungeon to cross on the way back to the exit or a stretch of the forest, that's just safe, boring legwork for the party. And in part that's fine, even satisfying, but something should happen every so often.

 

So what I want to do, if I can't get spawn points to work with actions (what I wrote about in the neighbor thread), is to mark the fact that the area has been cleared - for each area. I can take stock of there not being any enemies in a place with !AreaCheckAllegiance(255). If this is true, then every red is dead like in the 50s and I can set a global. And afterwards, when the party is returning through this depopulated place, if some of the spawn points have activated or monsters have appeared otherwise, and the global is set (so it's a reemergence), I can use ApplySpellRES(...) with Target "Everyone" and another filter to focus on ENEMY. The effect of the spell would be Teleport Field, so all of the foes in the area would get thrown at the party. Like after this unfortunate event.

 

Commotion.jpg

 

That's what happens when a town crier jokes about running water for everyone. But with enemies it's purty much the same thing, they come from every quarter.

 

There are two places where I could use your advice:

 

1) What/how to put the global on for each area. Maybe on the first clearing I could spawn an invisible with script name "area-clear" and later check for Exists("area-clear"), as a sort of living marker? I'm open to suggestions if there are easier ways.

 

2) How to bring more monsters into play? If spawn points won't respond, well... I could just write up random ogres popping up - ogres are generic enough, I've tested on them so much, my soup tastes of ogres. Or assassins. Plenty of those everywhere anyhow. But that's too generic. It would look wrong half the time... ogres in an outer plane fortress?


Edited by temnix, 23 August 2017 - 11:21 AM.


#2 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 23 August 2017 - 12:52 PM

SoD does exactly that, activating random spawn points after player clears all manually placed encounters.

IF
  Global("BD_SPWN_ACTIVE","MYAREA",1)
  !AreaCheckAllegiance(ENEMY)
THEN
  RESPONSE #100
    SetGlobal("BD_SPWN_ACTIVE","MYAREA",2)
    SetGlobalTimer("BD_TIMER_SPWN","MYAREA",ONE_DAY)
END


IF
  Global("BD_SPWN_ACTIVE","MYAREA",2)
  GlobalTimerExpired("BD_TIMER_SPWN","MYAREA")
THEN
  RESPONSE #100
    SetGlobal("BD_SPWN_ACTIVE","MYAREA",3)
    SpawnPtActivate("Spiders01")
    SpawnPtActivate("Wolves01")
    SpawnPtActivate("Hobgoblins01")
    SpawnPtActivate("Trolls01")
    SpawnPtActivate("Boars01")
    SpawnPtActivate("Spiders02")
    SpawnPtActivate("Hobgoblins02")
    SpawnPtActivate("Boars02")
    SpawnPtActivate("Trolls02")
END

 


Retired from modding.


#3 temnix

temnix
  • Member
  • 983 posts

Posted 23 August 2017 - 01:06 PM

Okay. That's probably too much - to have them all fire at once! I mean, too much for me. Also I'm looking for some general solution, without needing special spawn point names, like here. Luckily, in the vanilla BG and, I don't know, maybe in the others they are just called "Spawn Point 1" etc. So the key thing I'm seeing here is "MYAREA" as the scope of the global, and I can do the rest. Thanks, Ardanis. I've never used that before. But let me be clear: is SpawnPtActivate what triggers spawning or SpawnPtSpawn, or both? Because I'm not having any luck with the second, but I only tried the first once.


Edited by temnix, 23 August 2017 - 01:10 PM.


#4 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 23 August 2017 - 03:36 PM

SpawnPtActivate() merely sets the point to active state, just like TriggerActivation(). It doesn't (or at least shouldn't) force spawn anything.

SpawnPtSpawn() - never used it, honestly.


Retired from modding.


#5 temnix

temnix
  • Member
  • 983 posts

Posted 23 August 2017 - 04:15 PM

Yeah, well. I'm not getting any results with it at all. How was that action tested for the G3 guide to have any description? Anyway, thanks. So, I assume Activate works. I have this crazy idea to conjure a bunch of GOODCUTOFF sped-up invisible birds with RandomFly() and have them trigger those spawn points. In a few moments they ought to scout out a map. What do you think?



#6 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 23 August 2017 - 05:46 PM

Depends on what you want, I guess? If you want to fully respawn an area and teleport everyone towards the party, then yeah, you have to force the spawn points do their work somehow first. Assuming GOODCUTOFF works, and I don't know whether it does, you can also spawn them directly over the points, though you'll need to automate it with WeiDU or collect the coordinates manually. If it doesn't, hm... nothing comes to mind off the top of my head, other than reading up the spawn groups' composition at install time and generating scripts on the fly, but you'll need about three points in WeiDU proficiency to automate that.

If you don't need a teleport, then just reactivate the points and let party walk into monsters on the backtrack.


Retired from modding.


#7 temnix

temnix
  • Member
  • 983 posts

Posted 24 August 2017 - 04:33 AM

I do need a teleport - it'll be an AMBUSH!!! :cheers:

 

[PC] birds trigger spawn points. Not convenient or reliable, though. On the plus side, it requires no script actions, just twenty invisible seagulls. As soon as any unfriendlies appear, I can scoop them up with Teleport Field. I might still give the birds a try or two.