Jump to content


Photo

[SOLVED] How to detect the death of an unspecific creature in the active area?


18 replies to this topic

#1 argent77

argent77
  • Modders
  • 734 posts
  • Gender:Male

Posted 09 August 2017 - 01:24 AM

I'm currently working on a quest where you have to send a global (non-party) creature alone into a separate area. To make sure that you don't lose access to the area (e.g. by double-clicking on a party slot) I have made every party member unselectable while the creature is present in the separate area. That part already works fine.

This solution creates another problem though. If, for some reason, the creature dies on that map, then you are unable to continue the game because the party is still inaccessible. I'd like to somehow detect if the creature dies in the active area to return control to the party.

My first ideas involved checking !InMyArea([GOODCUTOFF]) in the area script, but it didn't work. !AreaCheckObject("mapname", [GOODCUTOFF]) didn't work either. I have also tried Died([GOODCUTOFF]) without success. I'm running out of options now. Does anyone have another idea that could work?

 

Btw, the quest is intended for an EE-only mod.
 


Edited by argent77, 10 August 2017 - 01:27 AM.


#2 Ulb

Ulb
  • Members
  • 146 posts
  • Gender:Male

Posted 09 August 2017 - 01:47 AM

This is probably stupid and not helpful but couldn't you just have the creature set a global when it dies and use that to detect it?



#3 lynx

lynx
  • Modders
  • 3032 posts
  • Gender:Male
  • Location:Ljubljana, Slovenija

Posted 09 August 2017 - 02:25 AM

Also, in case you tested the Died trigger in an area script: I don't think that ever works, why would the area receive the message?


GemRB - IE anywhere.
Mages needed! Looking for Planescape: Torment testers
Market android version IS NOT SUPPORTED ANYMORE: reported bugs will be ignored! Still looking for builders ...

#4 Roxanne

Roxanne

    Modder

  • Modders
  • 1673 posts
  • Gender:Female
  • Location:Auckland, NZ

Posted 09 August 2017 - 02:30 AM

I have never checked the details of how that is done but your scenario description reminds me of that spirit warrior in Watcher's Keep (Ar3023), the one you navigate by dialogue options (SSSPIR3.dlg) while your party waits outside unselectable. A creature that acts on behalf of player1 - here player 1 dies when the spirit dies, but surely this can be used to trigger anything else you want?

There is a series of cutscenes Scut01.bcs and following numbers that may interest you.


Edited by Roxanne, 09 August 2017 - 02:30 AM.

The Sandrah Saga

another piece of *buggy, cheesy, unbalanced junk*


#5 argent77

argent77
  • Modders
  • 734 posts
  • Gender:Male

Posted 09 August 2017 - 03:55 AM

This is probably stupid and not helpful but couldn't you just have the creature set a global when it dies and use that to detect it?

That would mean I'd have to (temporarily) set a new script to the creature. I don't think that's possible without side effects since I don't know what kind of creature is entering the map. In the worst case I would override an important script.

Apparently using opcode "Cast on condition: Dies or Died" is also out of question for my purposes because the creatures I'm sending to the new area can already have an instance of the same opcode applied for other reasons. This opcode can't be applied multiple times with the same parameters.
 

 

Also, in case you tested the Died trigger in an area script: I don't think that ever works, why would the area receive the message?

IESDP states that Died(Object*) checks if the specified target died in the last script round. I have assumed that it can be checked everywhere, including area or global scripts, since the target is specified as script trigger parameter. Maybe it requires a more specific target than [GOODCUTOFF] to work correctly?

 

I have never checked the details of how that is done but your scenario description reminds me of that spirit warrior in Watcher's Keep (Ar3023), the one you navigate by dialogue options (SSSPIR3.dlg) while your party waits outside unselectable. A creature that acts on behalf of player1 - here player 1 dies when the spirit dies, but surely this can be used to trigger anything else you want?

There is a series of cutscenes Scut01.bcs and following numbers that may interest you.

Unfortunately, my case is a bit more complicated than the WK spirit warrior. The WK maze transports the whole party to the same map as the warrior (you can see them at the bottom right corner of the map), and you have only limited control of the situation since everything is done via dialog options and cutscenes.

In my case I have full control over the creature. It can interact with objects and fight enemies. The overall plot of the quest line works fine already. There is only the issue of the creature dying alone on a separate map left which I haven't been able to solve yet.

Since I don't know exactly in advance what kind of creature is entering the map I can only use unspecific target types such as [GOODCUTOFF] to address the creature. The only place where I can target the creature directly is in a dialog that executes the respective actions to transport the creature to the map.
 



#6 Ulb

Ulb
  • Members
  • 146 posts
  • Gender:Male

Posted 09 August 2017 - 04:27 AM

How about you use "use EFF file on condition" on the creature for a repeated effect?

AFAIK you can have mutiple instances of that on one creature. Use it to decrease a certain global by one and have the area script increase the global by one. If the creature dies the global doesn't get reset anymore and your "return control" script executes after it hits a certain number.

 

Not very smooth or sophisticated but it just might work?



#7 argent77

argent77
  • Modders
  • 734 posts
  • Gender:Male

Posted 09 August 2017 - 04:56 AM

Interesting concept. I assume you're referring to opcode 272 (Apply Repeating EFF). I'll definitely try it out. According to IESDP timing rate can be doubled/halved by slow or haste effects, and I don't know what happens on hold or stun. So I have to be very careful with timings.
 



#8 Ulb

Ulb
  • Members
  • 146 posts
  • Gender:Male

Posted 09 August 2017 - 05:10 AM

Interesting concept. I assume you're referring to opcode 272 (Apply Repeating EFF). I'll definitely try it out. According to IESDP timing rate can be doubled/halved by slow or haste effects, and I don't know what happens on hold or stun. So I have to be very careful with timings.
 

 

Ah well, that is something I didn't consider. The slow effect could probably be accounted for but hold/stun would be a problem.

Still, I think some kind of dead-mans-switch might be the best solution.

 

Maybe you could make the creature spawn a helper creature instead. The helper then checks via "lastsummonerof" if the creature is still alive?


Edited by Ulb, 09 August 2017 - 05:11 AM.


#9 Ulb

Ulb
  • Members
  • 146 posts
  • Gender:Male

Posted 09 August 2017 - 05:22 AM

No wait, forget opcode 272.

You can just use 146 (cast spell) and loop that one. I.E. have the spell set a variable AND cast itself again on the target with a delayed 6s timer. That way it will loop itself indefinitely and it should be safe from hast/slow/stun/hold (I think). You can then later just remove it via "remove effs by resource".



#10 Ardanis

Ardanis

    A very GAR character

  • Modders
  • 2558 posts
  • Gender:Male
  • Location:Saint-Petersburg, Russia

Posted 09 August 2017 - 05:28 AM

LastSummonerOf() is a likely solution, yes.

Die() works fine, but requires to be run by self.

 

Otherwise it'd be easier to help or point in the right direction if you described the situation in more detail - what creature, what area, what means of transportation etc. How much control you (as designer) have over scenario.

If you directly control that cre, then overwriting its scripts shouldn't be an issue. If it can be something other than summons, then you may or may not run into problems regardless of touching its scripts.

 

My first ideas involved checking !InMyArea([GOODCUTOFF]) in the area script, but it didn't work. !AreaCheckObject("mapname", [GOODCUTOFF]) didn't work either. I have also tried Died([GOODCUTOFF]) without success. I'm running out of options now. Does anyone have another idea that could work?

 

[GOODCUTOFF] requires a line of sight by script owner, anything outside is false.


Edited by Ardanis, 09 August 2017 - 05:34 AM.

"Uguu~ Boku Ayu."

Before you start breaking wall tiles with your bare fists, ask yourself first - do you truly need it?

#11 argent77

argent77
  • Modders
  • 734 posts
  • Gender:Male

Posted 09 August 2017 - 07:20 AM

More info about the current situation:
The quest is intended to be part of my Golem Construction mod. It will open a hidden trapdoor to an underground complex. Because of certain conditions it can only be entered safely by non-living creatures (i.e. golems and undead).

The transition is triggered via pseudo-dialog with "LastTrigger" which executes LeaveAreaLUAPanic() and LeaveAreaLUA() on the active creature. The target area script executes ActionOverride(PlayerX, MakeUnselectable(999999)) on all party members, so that the screen doesn't accidently jumps back to the party (e.g. when you double-click on a party member slot) since you will have no way to return focus to the creature on the separate map. Party members are made accessible again via ActionOverride(PlayerX, MakeUnselectable(0)) when the creature leaves the area. Leaving the area is also handled by script.

The creature is supposed to freely explore the map, battle or dodge a number of monsters, use teleporters to access separate rooms on the same map, trigger another object to retrieve an artifact and return back to the party.

 

[GOODCUTOFF] requires a line of sight by script owner, anything outside is false.

Didn't know that [GOODCUTOFF] is limited that way.
 

Using a summoned helper creature could be a viable solution. I'm currently testing this option. It looks promising so far, but I have still trouble to safely destroy the helper creature when it's not needed anymore. Using the Died() trigger doesnt work either. I have to rely on Exists() instead, which, thankfully, returns FALSE as soon as the target creature is dead.
 



#12 kjeron

kjeron
  • Members
  • 72 posts

Posted 09 August 2017 - 08:19 AM

Apparently using opcode "Cast on condition: Dies or Died" is also out of question for my purposes because the creatures I'm sending to the new area can already have an instance of the same opcode applied for other reasons. This opcode can't be applied multiple times with the same parameters.

 

This limitation is removed if you put opcode 232 in an external EFF file called through opcode 177.



#13 argent77

argent77
  • Modders
  • 734 posts
  • Gender:Male

Posted 09 August 2017 - 09:09 AM

 

Apparently using opcode "Cast on condition: Dies or Died" is also out of question for my purposes because the creatures I'm sending to the new area can already have an instance of the same opcode applied for other reasons. This opcode can't be applied multiple times with the same parameters.

 

This limitation is removed if you put opcode 232 in an external EFF file called through opcode 177.

 

Good to know. I'll try this out when the summoned helper creature doesn't work as intended.



#14 subtledoctor

subtledoctor
  • Modders
  • 2212 posts
  • Gender:Male

Posted 09 August 2017 - 11:45 AM

How about giving the creature a min1hp item to prevent dying, but set a contingency for hp < 2 that triggers stuff like:
- create an invisicre to trigger a script...
- ... which makes party members selectable
- remove the min1hp item from the creature
- kill the creature

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#15 argent77

argent77
  • Modders
  • 734 posts
  • Gender:Male

Posted 09 August 2017 - 12:04 PM

How about giving the creature a min1hp item to prevent dying, but set a contingency for hp < 2 that triggers stuff like:
- create an invisicre to trigger a script...
- ... which makes party members selectable
- remove the min1hp item from the creature
- kill the creature

Heh, great minds think alike. I have just finished implementing and testing almost the same option.

A spell is applied to the creature with a temporary MinHP1 effect and a "Cast spell on condition: HP < 2" using kjeron's workaround. When the condition is met a helper creature is summoned that returns the target back to the party via short cutscene and removes the temporary effects from the creature. That way I can also solve a second issue - when a greater or perfect golem splits into two lesser variants on death.
 





Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users