Jump to content

Photo

How to detect disease contraction?

oblivion construction set disease detection obse

  • Please log in to reply
8 replies to this topic

#1
VencGanence

VencGanence

    Enthusiast

  • Supporter
  • PipPip
  • 129 posts

Is it possible to detect when the PC contracts a disease?  I don't need to know which disease it is, simply the moment they contract it.  I don't want to detect that they have a disease, but that they gained a disease.



#2
Oblivionaddicted

Oblivionaddicted

    Faithful poster

  • Members
  • PipPipPipPip
  • 2,447 posts

Nevermind.


Edited by Oblivionaddicted, 22 April 2020 - 09:20 PM.


#3
Fiore1300

Fiore1300

    Regular

  • Members
  • PipPip
  • 64 posts

https://cs.elderscro...itle=GetDisease

 

Note the function is deprecated. The page explains further.

 

So to get the time the PC contracts a disease, I'd wager you'd want to combine IsSpellTarget to detect if the PC has a disease, if yes then GetCurrentTime, then go from there? I dunno. Just spitballin.


Edited by Fiore1300, 22 April 2020 - 05:01 AM.


#4
mixxa77

mixxa77

    Old hand

  • Members
  • PipPipPip
  • 551 posts

Seems like the best way to do it is as described on the linked article from Fiore1300. Loop through the players spells, probably every second or so, and if any of them is a disease, the script can switch a variable that will kick off whatever you want to do.


Edited by mixxa77, 22 April 2020 - 12:11 PM.


#5
VencGanence

VencGanence

    Enthusiast

  • Supporter
  • PipPip
  • 129 posts

That does seem like the only way to me, but it has the unwanted drawback of being unable to detect multiple diseases unless I go a step further tracking sources of effects in addition to effect types.  That just sounds like it'd get a bit too complicated, which worries me that it may impact performance.

 

There are the OnMagicApply and OnMagicCast event handlers, but my testing of OnMagicApply fired inconsistently, plus I don't know if a disease would trigger the handler despite technically being a spell.



#6
Fiore1300

Fiore1300

    Regular

  • Members
  • PipPip
  • 64 posts
Maybe OBSE has the functions you need?

#7
VencGanence

VencGanence

    Enthusiast

  • Supporter
  • PipPip
  • 129 posts

There's functions to get the total magnitude of disease effects, but that information doesn't tell me what I want.



#8
VencGanence

VencGanence

    Enthusiast

  • Supporter
  • PipPip
  • 129 posts

I found a method to detect disease contraction, using an OnMagicApply event handler:

;Parameters
;-----------------------------------------------------------------------------
ref MagicItem
ref Caster
ref Self
short Type
;-----------------------------------------------------------------------------

;-----------------------------------------------------------------------------
begin Function { MagicItem, Caster }
;-----------------------------------------------------------------------------

	;GetSelf returns who was hit
	Let Self := GetSelf
	Let Type := GetSpellType MagicItem

	if ( Self == Player && Type == 1 )

		DebugPrint "%n contracted %n." Self MagicItem

	endif


;-----------------------------------------------------------------------------
end
;-----------------------------------------------------------------------------

Unfortunately, this handler type cannot be filtered by target, so there will be some wasted cycles.

 

Edit: oddly enough, the Caster for diseases is the victim, so I can apply a filter for Caster.  The question is if mod added diseases have the same behaviour.


Edited by VencGanence, 23 April 2020 - 11:41 AM.


#9
Fiore1300

Fiore1300

    Regular

  • Members
  • PipPip
  • 64 posts

The question is if mod added diseases have the same behaviour.

Well, you're in luck. I don't think any mods add new diseases.







Also tagged with one or more of these keywords: oblivion, construction set, disease, detection, obse

Page loaded in: 1.038 seconds