Jump to content


Photo

On SPRITE_IS_DEAD variables


  • Please log in to reply
5 replies to this topic

#1 temnix

temnix
  • Member
  • 983 posts

Posted 29 May 2017 - 01:04 PM

The text for the Dead() trigger says: "Note that SPRITE_IS_DEAD variables are not set if the creature is killed by a neutral creature." What are those variables and what do they control? When exactly are they set? Suppose that the creature getting killed has a block triggered by Die(), the last to run. Will the variables be set by the time this block is processed or do they get set afterwards? What if the Die() block includes an action, a temporary Allegiance change to NEUTRAL for the killer - if the killer can be determined? Can a PC be made not to set the variables this way? And what will happen to the creature then? Will it fall to the ground, give XP et cetera or not?



#2 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 30 May 2017 - 12:52 PM

SPRITE_IS_DEADscriptname global is automatically set whenever the creature enters a dead state. It's done on engine level and is not affected by scripting.

Dead("scriptname") is essentially a shorthand for !Global("SPRITE_IS_DEADscriptname","global",0). You can tweak and adjust the death counter manually via SetGlobal() like any other variable, if you so wish, just be careful to understand what you're doing and why, as far as various plot conditions go.

Die() has nothing to do with either, it just marks that the active creature (read - myself) has died in the last round. It can be used to set custom counters as well, in addition to SPRITE_IS_DEAD, even reducing SPRITE_IS_DEADscriptname by 1 to mitigate the effect of hardcoded function. SoD relies quite heavily on Die()-based custom death counters to control the reinforcement spawns in siege battles - while I'm slightly reluctant (or just prejudiced?) to trust it for plot-critical events, I don't recall seeing any cases of Die() not triggering properly during many dozens of hours of testing.

 

"Note that SPRITE_IS_DEAD variables are not set if the creature is killed by a neutral creature."

Incorrect, it sets fine. Or possibly it refers to earlier/other versions of engine (vanilla PST?).


Edited by GeN1e, 30 May 2017 - 12:54 PM.

Retired from modding.


#3 temnix

temnix
  • Member
  • 983 posts

Posted 30 May 2017 - 01:26 PM

Thanks for clearing that up.



#4 temnix

temnix
  • Member
  • 983 posts

Posted 05 June 2017 - 11:29 AM

Hey, Ardanis, another thing. You say SPRITE_IS_DEADscriptname is set whenever a creature dies and can be checked and adjusted later with Global("SPRITE_IS_DEADscriptname","global",0) and such. What about creatures without script names?



#5 GeN1e

GeN1e

    A very GAR character

  • Modder
  • 1604 posts

Posted 05 June 2017 - 02:09 PM

Nothing then. Which is why it's advisable to always have a script name. At most you can set/overwrite it to use the actor entry's name in .are (bit3 flag) as a script one, but only if you pre-locate them instead of spawning.


Edited by GeN1e, 05 June 2017 - 02:11 PM.

Retired from modding.


#6 temnix

temnix
  • Member
  • 983 posts

Posted 05 June 2017 - 05:20 PM

Thanks for the explanation, but see the other thread on death. My BIG problem with script names is that the name changes owners, you know. Just applies to the latest. I want some way to refer to non-unique creatures, dammit.