Jump to content

Quick Questions, Quick Answers


Mattiewagg

Recommended Posts

  • Replies 2.6k
  • Created
  • Last Reply

Top Posters In This Topic

How can I check the current light level an actor is in? Is that possible?

 

And whenever I call this http://www.creationkit.com/GetCurrentGameTime_-_Utility, it always returns 0.0000 no matter what..

If you're trying that on a new game then yes, it will return 0. Try waiting a few days then check.

 

http://www.creationkit.com/GetLightLevel_-_Actor

Link to comment
Share on other sites

How will this condition play out?

 

if (PlayerRef.HasKeyword(Vampire)==1 && isSilverEq==0) || (PlayerRef.HasKeyword(Vampire)==1 && PlayerRef.GetLightLevel<=69)

 

It checks the first paranthesis then if the first is false then it checks the second to see if it's true, right?

 

if (PlayerRef.HasKeyword(Vampire)==1 && isSilverEq==0) || (PlayerRef.HasKeyword(Vampire)==1 && PlayerRef.GetLightLevel()<=69) ;regeneration vamp
PlayerRef.RestoreActorValue("Health",PlayerRef.GetBaseActorValue("Health")/100*15)
PlayerRef.RestoreActorValue("Stamina",1000)
PlayerRef.RemoveSpell(SkyEndDamageSelf)
endif


if (PlayerRef.HasKeyword(Vampire)==1 && isSilverEq==1) || (PlayerRef.HasKeyword(Vampire)==1 && PlayerRef.GetLightLevel()>70)
PlayerRef.AddSpell(SkyEndDamageSelf)
endif

This is a snippet of the code.

Edited by Kerberus14
Link to comment
Share on other sites

 

How will this condition play out?

 

if (PlayerRef.HasKeyword(Vampire)==1 && isSilverEq==0) || (PlayerRef.HasKeyword(Vampire)==1 && PlayerRef.GetLightLevel<=69)

 

It checks the first paranthesis then if the first is false then it checks the second to see if it's true, right?

 

if (PlayerRef.HasKeyword(Vampire)==1 && isSilverEq==0) || (PlayerRef.HasKeyword(Vampire)==1 && PlayerRef.GetLightLevel()<=69) ;regeneration vamp
PlayerRef.RestoreActorValue("Health",PlayerRef.GetBaseActorValue("Health")/100*15)
PlayerRef.RestoreActorValue("Stamina",1000)
PlayerRef.RemoveSpell(SkyEndDamageSelf)
endif


if (PlayerRef.HasKeyword(Vampire)==1 && isSilverEq==1) || (PlayerRef.HasKeyword(Vampire)==1 && PlayerRef.GetLightLevel()>70)
PlayerRef.AddSpell(SkyEndDamageSelf)
endif

This is a snippet of the code.

 

If the player has the keyword vampire, then it will check if isSilverEq == 1. If they don't have the keyword vampire, the second part of the first condition will not be checked whatsoever.

 

If any part of the first condition fails, it will check the second condition. If either condition equates to true, then the code will be run. If neither, none of it will be.

Link to comment
Share on other sites

I have a logical problem that I am too dumb to figure out.

 

I have this situation:

 

I am a vampire. I have a Silver weapon equipped. I am under 70 Light Level.

I am taking damage, however.. I am still regenerating health. What can I do to that snippet of code to avoid that?

Link to comment
Share on other sites

I have a logical problem that I am too dumb to figure out.

 

I have this situation:

 

I am a vampire. I have a Silver weapon equipped. I am under 70 Light Level.

I am taking damage, however.. I am still regenerating health. What can I do to that snippet of code to avoid that?

Avoid which, taking damage or regenerating health?

 

EDIT...

 

Anyway, here is the logic. You can decide what you want to happen at each point if anything at all.

 

 

If	PlayerRef.HasKeyword(Vampire) == 1 
	If 	PlayerRef.GetLightLevel() <= 69) ;regeneration vamp
		If isSilverEq == 0
			;in low light and no silver weapon
		Else
			;in low light but with a silver weapon
		EndIf
	Else
		If isSilverEq == 0
			;in strong light and no silver weapon
		Else
			;in strong light but with a silver weapon
		EndIf
	EndIf
EndIf 

Edited by IsharaMeradin
Link to comment
Share on other sites

It worked, thanks. :D

 

This script works with concentrated spells.

 

 

Scriptname BloodMagic extends activemagiceffect
Actor Target
Float Damage
Keyword Property Concentrated auto
Event OnEffectStart(actor ActorTarget, actor ActorCarget)
Target = ActorTarget
EndEvent
Event OnSpellCast(Form s)
if s.HasKeyword(Concentrated)==0
Damage = (s as Spell).getMagickaCost()/2
Target.DamageActorValue("health", Damage)
endif
if s.HasKeyword(Concentrated)==1
Target.DamageActorValue("Health",Damage)
Damage = (s as Spell).getMagickaCost()
isConcentrated()
endif
EndEvent
Function isConcentrated()
RegisterForSingleUpdate(1.0)
EndFunction
Function InterruptCast() native
Event OnUpdate()
Target.DamageActorValue("Health",Damage)
Target.interruptcast()
EndEvent

This next script which changed only three "ActorValueName" is identical, it doesn't work with concentrated spells, why?

Scriptname EnduranceMagic extends activemagiceffect
Actor Target
Float Damage
Keyword Property Concentrated auto
Event OnEffectStart(actor ActorTarget, actor ActorCarget)
Target = ActorTarget
EndEvent
Event OnSpellCast(Form s)
if s.HasKeyword(Concentrated)==0
Damage = (s as Spell).getMagickaCost()/100*150
Target.DamageActorValue("Stamina", Damage)
endif
if s.HasKeyword(Concentrated)==1
Target.DamageActorValue("Stamina",Damage)
Damage = (s as Spell).getMagickaCost()/100*150
isConcentrated()
endif
EndEvent
Function isConcentrated()
RegisterForSingleUpdate(1.0)
EndFunction
Function InterruptCast() native
Event OnUpdate()
Target.DamageActorValue("Stamina",Damage)
Target.interruptcast()
EndEvent

Blood Magic has a perk that modifies all Spell Costs to 0.
Endurance Magic has the same perk.
Concentration keyword has been added to all Concentration Spells to make sure they are identified properly.
Edited by Kerberus14
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...