Jump to content

[LE] Compiler misreading .psc file. Can only see EOF


dePog

Recommended Posts

I am hoping to integrate the slavetats method into my Tiefling mod so that she can change skin when she transforms from human to Tiefling (from human skin to dragon skin). Therefore I would need to add the following code into the transform spell scripting:

SlaveTats.simple_add_tattoo(Game.GetPlayer(), "Dragon", "Nether Dragon Body)")

 

That would turn normal human looking skin into this:

 

 

 

http://i.imgur.com/LmEhIsu.jpg

 

 

 

 

So Tief would look more Tieflingish

 

However, when I add that line of code, the compiler goes looking for the SlaveTats.psc file and then returns the following errors:

 

F:\SteamLibrary\steamapps\common\skyrim\Data\Scripts\Source\SlaveTats.psc(0,-1): mismatched input '<EOF>' expecting SCRIPTNAME
F:\SteamLibrary\steamapps\common\skyrim\Data\Scripts\Source\SlaveTats.psc(0,0): error while attempting to read script slavetats: Object reference not set to an instance of an object.
F:\SteamLibrary\steamapps\common\skyrim\Data\Scripts\Source\temp\TieflingEquipHornsEffect.psc(79,2): variable SlaveTats is undefined
F:\SteamLibrary\steamapps\common\skyrim\Data\Scripts\Source\temp\TieflingEquipHornsEffect.psc(79,12): none is not a known user-defined typ

 

Now I know that SlaveTats.psc is in that folder (scripts\source) because I have checked it over, and over, and over. Plus, the compiler insists that there is nothing there that starts with the line "Scriptname". However, it does start with "Scriptname SlaveTats Hidden". I have checked that many times. I have also retyped the line, and also made a new file and copy pasted the code over. But the compiler still insists that it cannot see the word "Scriptname" because it presumably sees an end of file (<EOF>) and nothing else.

 

I have contacted the author of Slavetats and basically he is saying that sometimes the CK compiler is tricky.

 

Has anybody seen this error from CK's compiler before and know how to "untrick" the damn thing? lol

 

Thanks for any input.

 

Cheers,

dePog

Link to comment
Share on other sites

It really bad form to ask for help on a Script without actually posting the entire Script. And you didn't even post a scrap. Do you really expect any help under those conditions? At least you posted the compiler Output.

 

And yeah seen output like that before, but I not guess what it means without seeing your Script. Plus what the "Source\temp" folder? The compiler doesn't use that! Have you been messing with the Editor ini? Or saving your psc in wrong spot? (which?)

 

I hate GUESSING, give some valuable information, if you expect good help.

 

Cheers

 

 

 

Without a back story too!

 

Oh.... SKSE has a code that allow for skin change. Not sure if it just works only Player, Feet Torso Hands. You might want to look into it. You may not even need SlaveTats.

; Gets/sets the skin of the actorbase
Armor Function GetSkin() native
Function SetSkin(Armor skin) native

; returns the face textureset of the actor (Player Only?)
TextureSet Function GetFaceTextureSet() native
Function SetFaceTextureSet(TextureSet textures) native

Cheeers again

 

Edit

May need a NiNode update, don't know sure, but I'm guessing it will.

Edited by PeterMartyr
Link to comment
Share on other sites

It really bad form to ask for help on a Script without actually posting the entire Script. And you didn't even post a scrap. Do you really expect any help under those conditions? At least you posted the compiler Output.

 

And yeah seen output like that before, but I not guess what it means without seeing your Script. Plus what the "Source\temp" folder? The compiler doesn't use that! Have you been messing with the Editor ini? Or saving your psc in wrong spot? (which?)

 

I hate GUESSING, give some valuable information, if you expect good help.

 

Cheers

 

 

 

Without a back story too!

 

Oh.... SKSE has a code that allow for texture change. Not sure if it just works only Player, Head Torso Hands. You might want to look into it. You may not even need SlaveTats.

; Gets/sets the skin of the actorbase
Armor Function GetSkin() native
Function SetSkin(Armor skin) native

Cheeers again

 

Thanks for the SKSE suggestion. I'll check it out.

 

My scripting compiles normally until I add the SlaveTats line that I posted, that is:

SlaveTats.simple_add_tattoo(Game.GetPlayer(), "Dragon", "Nether Dragon Body)")

 

I have no idea what the source\temp reference is. It is not on my PC and I do not reference it in my scripting. That is just what the compiler error said. It doesn't make sense to me, which is why I have asked for help. The only adjustment I have made to editor.ini is to stop the warning messages from showing when it first loads a mod. I don't use MO so all my pex and psc files are in the correct place that the compiler would expect, ie:

F:\SteamLibrary\steamapps\common\skyrim\Data\Scripts\Source\SlaveTats.psc. That is where it expects the file, and that is where it actually is. I have checked numerous times.

 

The entire script is shown below in the spoiler. It compiles and runs without errors if the Slavetats line is removed.

 

 

 

 

Scriptname TieflingEquipHornsEffect extends activemagiceffect

 

import GlobalVariable

 

GlobalVariable Property TPHealthGlobal Auto

GlobalVariable Property TPStaminaGlobal Auto

GlobalVariable Property SickMorphState auto

GlobalVariable Property TieflingTransitionGlobal auto

GlobalVariable Property TieflingMorphGlobal auto

GlobalVariable Property TieflingTailChoiceGlobal auto

GlobalVariable Property TieflingHornsChoiceGlobal auto

GlobalVariable Property TimeGlamourStart auto

GlobalVariable Property TieflingFreedomGlobal auto

Armor Property TieflingHorns1 Auto

Armor Property TieflingHorns2 Auto

Armor Property TieflingHorns3 Auto

Armor Property TieflingHorns4 Auto

Armor Property TieflingHorns5 Auto

Armor Property TieflingHorns6 Auto

Armor Property TieflingHorns7 Auto

Armor Property TieflingHorns8 Auto

Armor Property TieflingHorns9 Auto

Armor Property TieflingHorns10 Auto

Armor Property TieflingTail1 Auto

Armor Property TieflingTail2 Auto

Armor Property TieflingTail3 Auto

Armor Property TieflingTail4 Auto

Armor Property TieflingTail5 Auto

Armor Property TieflingTail6 Auto

Armor Property TieflingTail7 Auto

Armor Property TieflingTail8 Auto

Armor Property TieflingTail9 Auto

Armor Property TieflingTail10 Auto

Armor Property TieflingTail11 Auto

Faction Property TieflingFaction auto

ImageSpaceModifier property IntroFX auto

ImageSpaceModifier property BlurFX auto

ImageSpaceModifier property BlurRedFX auto

Sound Property mySFX Auto

Spell Property Vomit Auto

Sound Property IntakeSFX Auto

float Property TiefHealthPercentAtStart Auto

float Property TiefStaminaPercentAtStart Auto

Quest Property TiefQ08 Auto

Quest Property TiefQ09 Auto

Bool Property Female Auto

 

;FUNCTIONS************************************************************************

float Function GetBuffedActorValue(Actor starget, int stat)

if stat == 1

return (starget.GetActorValue("Health") / starget.GetActorValuePercentage("Health"))

elseif stat == 2

return (starget.GetActorValue("Magicka") / starget.GetActorValuePercentage("Magicka"))

elseif stat == 3

return (starget.GetActorValue("Stamina") / starget.GetActorValuePercentage("Stamina"))

endif

EndFunction

 

;**********************************************************************************

 

Event OnEffectStart(Actor akTarget, Actor akCaster)

Female = False

if Game.GetPlayer().GetActorBase().GetSex() == 1

Female = True

endIf

 

if TieflingTransitionGlobal.GetValue() == 1.0

 

if TieflingMorphGlobal.GetValue() == 0.0

 

;ADD TO TIEFLING FACTION***********************************

TieflingMorphGlobal.setValue(1.0)

introFX.apply(1)

if TieflingFreedomGlobal.getValue() != 3

Game.GetPlayer().AddToFaction(TieflingFaction)

endIf

debug.notification ("Tiefling state affects trading values")

SickMorphState.setValue(0)

SlaveTats.simple_add_tattoo(Game.GetPlayer(), "Dragon", "Nether Dragon Body")

 

;*************************************************************************************** TAIL RESET

 

TiefQ09.reset()

Game.GetPlayer().removeItem(TieflingTail1, 1, 1, none)

Game.GetPlayer().removeItem(TieflingTail2, 1, 1, none)

Game.GetPlayer().removeItem(TieflingTail3, 1, 1, none)

Game.GetPlayer().removeItem(TieflingTail4, 1, 1, none)

Game.GetPlayer().removeItem(TieflingTail5, 1, 1, none)

Game.GetPlayer().removeItem(TieflingTail6, 1, 1, none)

Game.GetPlayer().removeItem(TieflingTail7, 1, 1, none)

Game.GetPlayer().removeItem(TieflingTail8, 1, 1, none)

Game.GetPlayer().removeItem(TieflingTail9, 1, 1, none)

Game.GetPlayer().removeItem(TieflingTail10, 1, 1, none)

Game.GetPlayer().removeItem(TieflingTail11, 1, 1, none)

utility.wait(1)

TiefQ09.Start()

utility.wait(0.2)

 

int Tail = TieflingTailChoiceGlobal.GetValue() as int

 

if Tail == 1

Game.GetPlayer().EquipItem (TieflingTail1, true, true)

elseIf Tail == 2

Game.GetPlayer().EquipItem (TieflingTail2, true, true)

elseIf Tail == 3

Game.GetPlayer().EquipItem (TieflingTail3, true, true)

elseIf Tail == 4

Game.GetPlayer().EquipItem (TieflingTail4, true, true)

elseIf Tail == 5

Game.GetPlayer().EquipItem (TieflingTail5, true, true)

elseIf Tail == 6

Game.GetPlayer().EquipItem (TieflingTail6, true, true)

elseIf Tail == 7

Game.GetPlayer().EquipItem (TieflingTail7, true, true)

elseIf Tail == 8

Game.GetPlayer().EquipItem (TieflingTail8, true, true)

elseIf Tail == 9

Game.GetPlayer().EquipItem (TieflingTail9, true, true)

elseIf Tail == 10

Game.GetPlayer().EquipItem (TieflingTail10, true, true)

elseIf Tail == 11

Game.GetPlayer().EquipItem (TieflingTail11, true, true)

else

Game.GetPlayer().EquipItem (TieflingTail1, true, true)

TieflingTailChoiceGlobal.setValue(1.0)

debug.notification("hmmm... error! Fire dragon tail equipped")

endif

 

 

; ************************************************************************************** HORNS RESET

 

TiefQ08.reset()

Game.GetPlayer() .UnEquipItem (TieflingHorns1, true, true)

Game.GetPlayer() .UnEquipItem (TieflingHorns2, true, true)

Game.GetPlayer() .UnEquipItem (TieflingHorns3, true, true)

Game.GetPlayer() .UnEquipItem (TieflingHorns4, true, true)

Game.GetPlayer() .UnEquipItem (TieflingHorns5, true, true)

Game.GetPlayer() .UnEquipItem (TieflingHorns6, true, true)

Game.GetPlayer() .UnEquipItem (TieflingHorns7, true, true)

Game.GetPlayer() .UnEquipItem (TieflingHorns8, true, true)

Game.GetPlayer() .UnEquipItem (TieflingHorns9, true, true)

Game.GetPlayer() .UnEquipItem (TieflingHorns10, true, true)

 

Game.GetPlayer().removeItem(TieflingHorns1, 1, 1, none)

Game.GetPlayer().removeItem(TieflingHorns2, 1, 1, none)

Game.GetPlayer().removeItem(TieflingHorns3, 1, 1, none)

Game.GetPlayer().removeItem(TieflingHorns4, 1, 1, none)

Game.GetPlayer().removeItem(TieflingHorns5, 1, 1, none)

Game.GetPlayer().removeItem(TieflingHorns6, 1, 1, none)

Game.GetPlayer().removeItem(TieflingHorns7, 1, 1, none)

Game.GetPlayer().removeItem(TieflingHorns8, 1, 1, none)

Game.GetPlayer().removeItem(TieflingHorns9, 1, 1, none)

Game.GetPlayer().removeItem(TieflingHorns10, 1, 1, none)

utility.wait(0.1)

TiefQ08.Start()

 

if TieflingHornsChoiceGlobal.GetValue() == 1.0

Game.GetPlayer() .EquipItem (TieflingHorns1, true, true)

 

elseIf TieflingHornsChoiceGlobal.GetValue() == 2.0

Game.GetPlayer() .EquipItem (TieflingHorns2, true, true)

 

elseIf TieflingHornsChoiceGlobal.GetValue() == 3.0

Game.GetPlayer() .EquipItem (TieflingHorns3, true, true)

 

elseIf TieflingHornsChoiceGlobal.GetValue() == 4.0

Game.GetPlayer() .EquipItem (TieflingHorns4, true, true)

 

elseIf TieflingHornsChoiceGlobal.GetValue() == 5.0

Game.GetPlayer() .EquipItem (TieflingHorns5, true, true)

 

elseIf TieflingHornsChoiceGlobal.GetValue() == 6.0

Game.GetPlayer() .EquipItem (TieflingHorns6, true, true)

 

elseIf TieflingHornsChoiceGlobal.GetValue() == 7.0

Game.GetPlayer() .EquipItem (TieflingHorns7, true, true)

 

elseIf TieflingHornsChoiceGlobal.GetValue() == 8.0

Game.GetPlayer() .EquipItem (TieflingHorns8, true, true)

 

elseIf TieflingHornsChoiceGlobal.GetValue() == 9.0

Game.GetPlayer() .EquipItem (TieflingHorns9, true, true)

 

elseIf TieflingHornsChoiceGlobal.GetValue() == 10.0

Game.GetPlayer() .EquipItem (TieflingHorns10, true, true)

 

else

debug.notification("hmmm... horn error")

Game.GetPlayer() .EquipItem (TieflingHorns2, true, true)

TieflingHornsChoiceGlobal.setValue(2.0)

debug.notification("Daedric horns equipped")

endif

;************************************************************************************** NAUSEA ANIMATION

float HealthLost = TimeGlamourStart.getValue() - game.getPlayer().GetActorValue("Health")

debug.notification("Tiefling form. You are now KOS")

Stagger(game.getPlayer(), 1, (1 * ( HealthLost/25)) as int)

Stagger(game.getPlayer(), (5+(10*Utility.RandomFloat())) as int, (1 * ( HealthLost/25)) as int)

Stagger(game.getPlayer(), (5+(15*Utility.RandomFloat())) as int, (2 * ( HealthLost/25)) as int)

Stagger(game.getPlayer(), (5+(25*Utility.RandomFloat())) as int, (1 * ( HealthLost/25)) as int)

utility.wait(2.0)

 

else

TieflingMorphGlobal.setValue(0.0)

introFX.apply(1)

utility.wait(0.1)

game.getPlayer().damageActorValue("Health", 100)

utility.wait(0.1)

Debug.SendAnimationEvent(game.getPlayer(), "StaggerPlayer")

TimeGlamourStart.setValue(game.getPlayer().getActorValue("Health"))

;************************************************************************************** REMOVE HORNS

if TieflingHornsChoiceGlobal.GetValue()==1.0

Game.GetPlayer() .UnEquipItem (TieflingHorns1, true, true)

 

elseif TieflingHornsChoiceGlobal.GetValue()==2.0

Game.GetPlayer() .UnEquipItem (TieflingHorns2, true, true)

 

elseif TieflingHornsChoiceGlobal.GetValue()==3.0

Game.GetPlayer() .UnEquipItem (TieflingHorns3, true, true)

 

elseif TieflingHornsChoiceGlobal.GetValue()==4.0

Game.GetPlayer() .UnEquipItem (TieflingHorns4, true, true)

 

elseif TieflingHornsChoiceGlobal.GetValue()==5.0

Game.GetPlayer() .UnEquipItem (TieflingHorns5, true, true)

 

elseif TieflingHornsChoiceGlobal.GetValue()==6.0

Game.GetPlayer() .UnEquipItem (TieflingHorns6, true, true)

 

elseif TieflingHornsChoiceGlobal.GetValue()==7.0

Game.GetPlayer() .UnEquipItem (TieflingHorns7, true, true)

 

elseif TieflingHornsChoiceGlobal.GetValue()==8.0

Game.GetPlayer() .UnEquipItem (TieflingHorns8, true, true)

 

elseif TieflingHornsChoiceGlobal.GetValue()==9.0

Game.GetPlayer() .UnEquipItem (TieflingHorns9, true, true)

 

elseif TieflingHornsChoiceGlobal.GetValue()==10.0

Game.GetPlayer() .UnEquipItem (TieflingHorns10, true, true)

endif

;************************************************************************************** REMOVE TAIL

if TieflingTailChoiceGlobal.GetValue()==1.0

Game.GetPlayer() .UnEquipItem (TieflingTail1, true, true)

 

elseif TieflingTailChoiceGlobal.GetValue()==2.0

Game.GetPlayer() .UnEquipItem (TieflingTail2, true, true)

 

elseif TieflingTailChoiceGlobal.GetValue()==3.0

Game.GetPlayer() .UnEquipItem (TieflingTail3, true, true)

 

elseif TieflingTailChoiceGlobal.GetValue()==4.0

Game.GetPlayer() .UnEquipItem (TieflingTail4, true, true)

 

elseif TieflingTailChoiceGlobal.GetValue()==5.0

Game.GetPlayer() .UnEquipItem (TieflingTail5, true, true)

 

elseif TieflingTailChoiceGlobal.GetValue()==6.0

Game.GetPlayer() .UnEquipItem (TieflingTail6, true, true)

 

elseif TieflingTailChoiceGlobal.GetValue()==7.0

Game.GetPlayer() .UnEquipItem (TieflingTail7, true, true)

 

elseif TieflingTailChoiceGlobal.GetValue()==8.0

Game.GetPlayer() .UnEquipItem (TieflingTail8, true, true)

 

elseif TieflingTailChoiceGlobal.GetValue()==9.0

Game.GetPlayer() .UnEquipItem (TieflingTail9, true, true)

 

elseif TieflingTailChoiceGlobal.GetValue()==10.0

Game.GetPlayer() .UnEquipItem (TieflingTail10, true, true)

 

elseif TieflingTailChoiceGlobal.GetValue()==11.0

Game.GetPlayer() .UnEquipItem (TieflingTail11, true, true)

endif

 

Game.GetPlayer().RemoveFromFaction(TieflingFaction)

BlurFX.apply(0.9)

utility.wait(2.0)

debug.notification("Morphed to human form")

debug.notification ("Trading values improved")

utility.wait(5.0)

Debug.SendAnimationEvent(game.getPlayer(), "IdleStop")

endIf

 

else

debug.notification("Cannot morph whilst glamoured")

 

endIf

 

endEvent

 

 

 

; STAGGER FUNCTION ********************************************************

float Function Stagger(Actor starget, Int Interim, int BleedTime)

float RandomBleed = (Utility.RandomFloat()*BleedTime*Utility.RandomFloat())

if RandomBleed > 5

RandomBleed = 5

endIf

Game.DisablePlayerControls(True, True,True,False, True,True, True, True)

if Utility.RandomFloat() > 0.49

Utility.Wait((Utility.RandomFloat()*Interim*Utility.RandomFloat()) + 1.5)

Debug.SendAnimationEvent(game.getPlayer(), "idleInjured")

if Female

IntakeSFX.play(game.getPlayer())

endIf

utility.wait(1.5)

Debug.SendAnimationEvent(game.getPlayer(), "idleStop")

utility.wait(0.5)

if RandomBleed > 4.5

Debug.SendAnimationEvent(game.getPlayer(), "IdleInjured")

debug.notification("Glamour recovery nausea")

utility.wait(1.5)

Debug.SendAnimationEvent(game.getPlayer(), "StaggerPlayer")

mySFX.play(game.getPlayer())

Vomit.Cast(game.getPlayer(),game.getPlayer())

Utility.Wait(RandomBleed)

BlurRedFX.apply(RandomBleed / 5)

Debug.SendAnimationEvent(game.getPlayer(), "StaggerPlayer")

mySFX.play(game.getPlayer())

Vomit.Cast(game.getPlayer(),game.getPlayer())

elseif RandomBleed > 2.5

Debug.SendAnimationEvent(game.getPlayer(), "IdleInjured")

debug.notification("Glamour recovery nausea")

BlurRedFX.apply(RandomBleed / 5)

utility.wait(1.5)

Debug.SendAnimationEvent(game.getPlayer(), "StaggerPlayer")

mySFX.play(game.getPlayer())

Vomit.Cast(game.getPlayer(),game.getPlayer())

else

Debug.SendAnimationEvent(game.getPlayer(), "IdleInjured")

debug.notification("Glamour recovery nausea")

BlurRedFX.apply(RandomBleed / 5)

endIf

Utility.Wait(RandomBleed + 1.0)

 

else

if RandomBleed > 4.5

Debug.SendAnimationEvent(game.getPlayer(), "IdleInjured")

if Female

IntakeSFX.play(game.getPlayer())

endIf

elseIf RandomBleed > 3.0

Debug.SendAnimationEvent(game.getPlayer(), "StaggerPlayer")

if Female

IntakeSFX.play(game.getPlayer())

endIf

else

if Female

IntakeSFX.play(game.getPlayer())

endIf

endIf

BlurFX.apply(RandomBleed / 5)

Utility.Wait(RandomBleed)

endIf

Debug.SendAnimationEvent(game.getPlayer(), "IdleStop")

Game.EnablePlayerControls()

 

EndFunction

 

 

 

Thanks for your reply and SKSE suggestion.

 

EDIT: I have had a look at the SKSE SetFaceTextureSet command and I cannot see any example scripting on the syntax of how it would apply a new face texture to the Player. Have you any experience with it?

 

EDIT2: By NiNode update, do you mean game.getPlayer().QueueNiNodeUpdate() ?

 

EDIT3: I have added the following lines

ActorBase base = game.getPlayer().GetActorBase()

base.SetFaceTextureSet(Dragon)

They compile without error. I have created a face texture set with the appropriate dragon style facial skin and have it referenced in the script properties. However, when the spell is cast in game the player's face does not change texture. I have tried adding regenerateHead() as shown below,

ActorBase base = game.getPlayer().GetActorBase()

base.SetFaceTextureSet(Dragon)

game.getPlayer().RegenerateHead()

also tried QueueNiNodeUpdate() as below

ActorBase base = game.getPlayer().GetActorBase()

base.SetFaceTextureSet(Dragon)

game.getPlayer().QueueNiNodeUpdate(),

both of which compile OK, but make absolutely no difference. The player's head remains unchanged.

 

Cheers,

dePog

Edited by dePog
Link to comment
Share on other sites

dePog wrote:
The script "SlaveTats.psc" is existing within the right folder "Scripts\source"
and has a first line like that "Scriptname SlaveTats Hidden".
You have a codeline within an ActiveMagicEffect script as follow:
SlaveTats.simple_add_tattoo(Game.GetPlayer(), "Dragon", "Nether Dragon Body)")


What does it mean?
Your script "SlaveTats" is a script without self. Every function inside that script need a special attached keyword "Global".

The next code could be helpful to understand, it's a rough guess of mine.

a sample magicEffect script as follow:

Scriptname Spell_TransformScript extends ActiveMagicEffect
 
  ; -- EVENTs --
 
EVENT OnEffectStart(Actor akTarget, Actor akCaster)
    Debug.Trace("TS: OnEffectStart() - target = " +akTarget+ ",  caster = " +akCaster)

IF (akCaster == Game.GetPlayer())
    myF_Transform(akCaster)        ; we assume the player is the caster, if not take akTarget instead
ENDIF
ENDEVENT

EVENT OnEffectFinish(Actor akTarget, Actor akCaster)
    Debug.Trace("TS: OnEffectFinish() - has been reached..")
ENDEVENT

; -- FUNCTION --

FUNCTION myF_Transform(Actor Player)
;-----------------------------------
    ; code before
    SlaveTats.simple_add_tattoo(Player, "Dragon", "Nether Dragon Body)")
    ; code behind
ENDFUNCTION

Variant (A) - no self available

Scriptname SlaveTats Hidden
{this script may not have any variables, properties or events}

; -- FUNCTIONs --

FUNCTION simple_add_tattoo(Actor aRef, String s, String s2) Global  ; the special function keyword
;----------------------------------------------------------
; aRef = Player
;   s  = "Dragon"
;   s2 = "Nether Dragon Body)"    <-- is this string right?

  ; your tattoo code here
ENDFUNCTION

Variant (B) - self is an Object

Scriptname SlaveTats extends ObjectReference Hidden
{this script may have variables, properties and events}

; -- FUNCTIONs --

FUNCTION simple_add_tattoo(Actor aRef, String s, String s2)
;----------------------------------------------------------
; aRef = Player
;   s  = "Dragon"
;   s2 = "Nether Dragon Body)"    <-- is this string right?

  ; your tattoo code here
ENDFUNCTION
Edited by ReDragon2013
Link to comment
Share on other sites

You also posted a script, which I changed a bit as follow:

Keep in mind here we take the Target, not the Caster like sample script from above.

 

TieflingEquipHornsEffect

 

Scriptname TieflingEquipHornsEffect extends ActiveMagicEffect  
{rewritten by ReDragon 2017}

; https://forums.nexusmods.com/index.php?/topic/5775832-compiler-misreading-psc-file-can-only-see-eof/
; depog wrote: "Anybody else have any thoughts?"

  Quest PROPERTY TiefQ08 auto
  Quest PROPERTY TiefQ09 auto

  GlobalVariable PROPERTY TPHealthGlobal            auto
  GlobalVariable PROPERTY TPStaminaGlobal           auto
  GlobalVariable PROPERTY SickMorphState            auto
  GlobalVariable PROPERTY TieflingTransitionGlobal  auto
  GlobalVariable PROPERTY TieflingMorphGlobal       auto
  GlobalVariable PROPERTY TieflingTailChoiceGlobal  auto
  GlobalVariable PROPERTY TieflingHornsChoiceGlobal auto
  GlobalVariable PROPERTY TimeGlamourStart          auto
  GlobalVariable PROPERTY TieflingFreedomGlobal     auto

  Spell PROPERTY Vomit     auto
  Sound PROPERTY mySFX     auto
  Sound PROPERTY IntakeSFX auto

  Faction PROPERTY TieflingFaction auto

  ImageSpaceModifier PROPERTY IntroFX   auto
  ImageSpaceModifier PROPERTY BlurFX    auto
  ImageSpaceModifier PROPERTY BlurRedFX auto


 ;Armor[] PROPERTY TieflingSkinList auto      ; just in case you want to reduce properties here
 
Armor Property TieflingHorns1 Auto            ; TieflingSkinList[0]
Armor Property TieflingHorns2 Auto
Armor Property TieflingHorns3 Auto
Armor Property TieflingHorns4 Auto
Armor Property TieflingHorns5 Auto
Armor Property TieflingHorns6 Auto
Armor Property TieflingHorns7 Auto
Armor Property TieflingHorns8 Auto
Armor Property TieflingHorns9 Auto
Armor Property TieflingHorns10 Auto            ; TieflingSkinList[9]

Armor Property TieflingTail1 Auto              ; TieflingSkinList[10]
Armor Property TieflingTail2 Auto
Armor Property TieflingTail3 Auto
Armor Property TieflingTail4 Auto
Armor Property TieflingTail5 Auto
Armor Property TieflingTail6 Auto
Armor Property TieflingTail7 Auto
Armor Property TieflingTail8 Auto
Armor Property TieflingTail9 Auto
Armor Property TieflingTail10 Auto
Armor Property TieflingTail11 Auto             ; TieflingSkinList[20]

  Float PROPERTY TiefHealthPercentAtStart  auto
  Float PROPERTY TiefStaminaPercentAtStart auto

 ;Bool PROPERTY Female auto


; -- EVENTs --

EVENT OnEffectStart(Actor akTarget, Actor akCaster)
IF (akTarget == Game.GetPlayer())                        ; we assume the target should be the player!
ELSE
;;;    self.Dispel()
    RETURN    ; - STOP -    not the player
ENDIF
;---------------------
IF (TieflingTransitionGlobal.GetValue() == 1.0)          ; * Which script is setting this globalVar to One? (ReDragon)
ELSE
    Debug.Notification("Cannot morph whilst glamoured!")
    RETURN    ; - STOP - hmm.. !?
ENDIF
;---------------------
;;;    TieflingTransitionGlobal.SetValue(1)              ; *1*

IF (TieflingMorphGlobal.GetValue() == 0.0)
    TieflingMorphGlobal.SetValue(1.0)
    myF_MorphToTiefling(akTarget)
    Utility.Wait(2.0)
;;;    TieflingTransitionGlobal.SetValue(0)              ; ***
    RETURN    ;- STOP -    morphing from human to creature is done
ENDIF
;---------------------
    TieflingMorphGlobal.SetValue(0.0)
    myF_BackToHuman(akTarget)
    Utility.Wait(2.0)

    Debug.Notification ("Trading values improved")
    Utility.Wait(5.0)
    Debug.SendAnimationEvent(akTarget as ObjectReference, "IdleStop")
;;;    TieflingTransitionGlobal.SetValue(0)               ; ***
ENDEVENT


; -- FUNCTIONs -- 3

;-------------------------------------
FUNCTION myF_BackToHuman(Actor Player)
;-------------------------------------
    introFX.Apply(1)
    Utility.Wait(0.1)

    Player.DamageActorValue("Health", 100)
    Utility.Wait(0.1)

    Debug.SendAnimationEvent(Player as ObjectReference, "StaggerPlayer")
    TimeGlamourStart.SetValue( Player.GetActorValue("Health") )
        
;**************************************************************************************    REMOVE HORNS
    float f
    armor AR

    f = TieflingHornsChoiceGlobal.GetValue()
;;;    AR = None

    IF     (f == 1)
                    AR = TieflingHorns1
    ELSEIF (f == 2)
                    AR = TieflingHorns2
    ELSEIF (f == 3)
                    AR = TieflingHorns3
    ELSEIF (f == 4)
                    AR = TieflingHorns4
    ELSEIF (f == 5)
                    AR = TieflingHorns5
    ELSEIF (f == 6)
                    AR = TieflingHorns6
    ELSEIF (f == 7)
                    AR = TieflingHorns7
    ELSEIF (f == 8)
                    AR = TieflingHorns8
    ELSEIF (f == 9)
                    AR = TieflingHorns9
    ELSEIF (f == 10)
                    AR = TieflingHorns10
    ENDIF

    IF ( AR )
        Player.UnEquipItem(AR as Form, TRUE, TRUE)
    ENDIF

;**************************************************************************************    REMOVE TAIL
    f = TieflingTailChoiceGlobal.GetValue()
    AR = None

    IF     (f == 1)
                    AR = TieflingTail1
    ELSEIF (f == 2)
                    AR = TieflingTail2
    ELSEIF (f == 3)
                    AR = TieflingTail3
    ELSEIF (f == 4)
                    AR = TieflingTail4
    ELSEIF (f == 5)
                    AR = TieflingTail5
    ELSEIF (f == 6)
                    AR = TieflingTail6
    ELSEIF (f == 7)
                    AR = TieflingTail7
    ELSEIF (f == 8)
                    AR = TieflingTail8
    ELSEIF (f == 9)
                    AR = TieflingTail9
    ELSEIF (f == 10)
                    AR = TieflingTail10
    ELSEIF (f == 11)
                    AR = TieflingTail11
    ENDIF

    IF ( AR )
        Player.UnEquipItem(AR as Form, TRUE, TRUE)
    ENDIF

    Debug.Notification("Morphed to human form")
    Player.RemoveFromFaction(TieflingFaction)
    BlurFX.Apply(0.9)
ENDFUNCTION


;-----------------------------------------
FUNCTION myF_MorphToTiefling(Actor Player)
;-----------------------------------------
    bool bFemale = (Player.GetActorBase().GetSex() == 1)
    introFX.Apply(1)

    IF (TieflingFreedomGlobal.GetValue() == 3)
    ELSE
        Player.AddToFaction(TieflingFaction)
    ENDIF

    Debug.Notification ("Tiefling state affects trading values")

    SickMorphState.SetValue(0)
    SlaveTats.simple_add_tattoo(Player, "Dragon", "Nether Dragon Body")        ; call external function, the culprit !!!

 ;***************************************************************************************    TAIL RESET
    TiefQ09.Reset()

    Player.RemoveItem(TieflingTail1, 1, TRUE)
    Player.RemoveItem(TieflingTail2, 1, TRUE)
    Player.RemoveItem(TieflingTail3, 1, TRUE)
    Player.RemoveItem(TieflingTail4, 1, TRUE)
    Player.RemoveItem(TieflingTail5, 1, TRUE)
    Player.RemoveItem(TieflingTail6, 1, TRUE)
    Player.RemoveItem(TieflingTail7, 1, TRUE)
    Player.RemoveItem(TieflingTail8, 1, TRUE)
    Player.RemoveItem(TieflingTail9, 1, TRUE)
    Player.RemoveItem(TieflingTail10, 1, TRUE)
    Player.RemoveItem(TieflingTail11, 1, TRUE)
    Utility.Wait(1.0)

    TiefQ09.Start()
    Utility.Wait(0.2)

    float f = TieflingTailChoiceGlobal.GetValue()
    armor AR

    IF     (f == 1)
                    AR = TieflingTail1
    ELSEIF (f == 2)
                    AR = TieflingTail2
    ELSEIF (f == 3)
                    AR = TieflingTail3
    ELSEIF (f == 4)
                    AR = TieflingTail4
    ELSEIF (f == 5)
                    AR = TieflingTail5
    ELSEIF (f == 6)
                    AR = TieflingTail6
    ELSEIF (f == 7)
                    AR = TieflingTail7
    ELSEIF (f == 8)
                    AR = TieflingTail8
    ELSEIF (f == 9)
                    AR = TieflingTail9
    ELSEIF (f == 10)
                    AR = TieflingTail10
    ELSEIF (f == 11)
                    AR = TieflingTail11
    ELSE
        TieflingTailChoiceGlobal.SetValue(1)
        Debug.Notification("hmmm... error! Fire dragon tail equipped")
                    AR = TieflingTail1
    ENDIF

    Player.EquipItem(AR as Form, TRUE, TRUE)

; **************************************************************************************    HORNS RESET
    TiefQ08.Reset()

    Player.UnEquipItem(TieflingHorns1, TRUE, TRUE)
    Player.UnEquipItem(TieflingHorns2, TRUE, TRUE)
    Player.UnEquipItem(TieflingHorns3, TRUE, TRUE)
    Player.UnEquipItem(TieflingHorns4, TRUE, TRUE)
    Player.UnEquipItem(TieflingHorns5, TRUE, TRUE)
    Player.UnEquipItem(TieflingHorns6, TRUE, TRUE)
    Player.UnEquipItem(TieflingHorns7, TRUE, TRUE)
    Player.UnEquipItem(TieflingHorns8, TRUE, TRUE)
    Player.UnEquipItem(TieflingHorns9, TRUE, TRUE)
    Player.UnEquipItem(TieflingHorns10, TRUE, TRUE)

    Player.RemoveItem(TieflingHorns1, 1, TRUE)
    Player.RemoveItem(TieflingHorns2, 1, TRUE)
    Player.RemoveItem(TieflingHorns3, 1, TRUE)
    Player.RemoveItem(TieflingHorns4, 1, TRUE)
    Player.RemoveItem(TieflingHorns5, 1, TRUE)
    Player.RemoveItem(TieflingHorns6, 1, TRUE)
    Player.RemoveItem(TieflingHorns7, 1, TRUE)
    Player.RemoveItem(TieflingHorns8, 1, TRUE)
    Player.RemoveItem(TieflingHorns9, 1, TRUE)
    Player.RemoveItem(TieflingHorns10, 1, TRUE)
    Utility.Wait(0.1)

    TiefQ08.Start()

    f = TieflingHornsChoiceGlobal.GetValue()

    IF     (f == 1)
                    AR = TieflingHorns1
    ELSEIF (f == 2)
                    AR = TieflingHorns2
    ELSEIF (f == 3)
                    AR = TieflingHorns3
    ELSEIF (f == 4)
                    AR = TieflingHorns4
    ELSEIF (f == 5)
                    AR = TieflingHorns5
    ELSEIF (f == 6)
                    AR = TieflingHorns6
    ELSEIF (f == 7)
                    AR = TieflingHorns7
    ELSEIF (f == 8)
                    AR = TieflingHorns8
    ELSEIF (f == 9)
                    AR = TieflingHorns9
    ELSEIF (f == 10)
                    AR = TieflingHorns10
    ELSE
        TieflingHornsChoiceGlobal.SetValue(2.0)
        Debug.Notification("hmmm...  error! Daedric horns equipped")
                    AR = TieflingHorns2
    ENDIF

    Player.EquipItem(AR as Form, TRUE, TRUE)
 
; **************************************************************************************    NAUSEA ANIMATION
    float fBT = (TimeGlamourStart.GetValue() - Player.GetActorValue("Health")) / 25.0        ; fBT = HealthLost
    Debug.Notification("Tiefling form. You are now KOS")

    Stagger(Player as ObjectReference, bFemale,  1, fBT)
    Stagger(Player as ObjectReference, bFemale, 10, fBT)
    Stagger(Player as ObjectReference, bFemale, 15, fBT*2.0)
    Stagger(Player as ObjectReference, bFemale, 25, fBT)
ENDFUNCTION


;----------------------------------------------------------------------------
FUNCTION Stagger(ObjectReference PlayerRef, Bool bFemale, Float r, Float fBT)                ; r = Interim, fBT = BleedTime
;----------------------------------------------------------------------------
    float f = Utility.RandomFloat() * Utility.RandomFloat() * fBT                            ; f = RandomBleed
    IF (f > 5)
        f = 5.0
    ENDIF

    Game.DisablePlayerControls(TRUE,TRUE,TRUE, False, TRUE,TRUE, TRUE,TRUE)

IF (Utility.RandomFloat() >= 0.5)
    float w
    IF (r == 1)
        w = r
    ELSE
        w = Utility.RandomFloat() * 2.0
        w =((Utility.RandomFloat() * r) + 5.0) * w
    ENDIF
    Utility.Wait(1.5 + w)
    
    Debug.SendAnimationEvent(PlayerRef, "idleInjured")

    IF ( bFemale )
        IntakeSFX.Play(PlayerRef)
    ENDIF
    Utility.Wait(1.5)

    Debug.SendAnimationEvent(PlayerRef, "idleStop")
    Utility.Wait(0.5)

    IF     (f > 4.5)
        Debug.SendAnimationEvent(PlayerRef, "IdleInjured")
        Debug.notification("Glamour recovery nausea")
        Utility.Wait(1.5)

        Debug.SendAnimationEvent(PlayerRef, "StaggerPlayer")
        mySFX.Play(PlayerRef)
        Vomit.Cast(PlayerRef, PlayerRef)
        Utility.Wait(f)

        BlurRedFX.Apply(f/5)
        Debug.SendAnimationEvent(PlayerRef, "StaggerPlayer")
        mySFX.Play(PlayerRef)
        Vomit.Cast(PlayerRef, PlayerRef)

    ELSEIF (f > 2.5)
        Debug.SendAnimationEvent(PlayerRef, "IdleInjured")
        Debug.notification("Glamour recovery nausea")
        BlurRedFX.Apply(f/5)
        Utility.Wait(1.5)

        Debug.SendAnimationEvent(PlayerRef, "StaggerPlayer")
        mySFX.Play(PlayerRef)
        Vomit.Cast(PlayerRef, PlayerRef)

    ELSE
        Debug.SendAnimationEvent(PlayerRef, "IdleInjured")
        Debug.notification("Glamour recovery nausea")
        BlurRedFX.Apply(f/5)
    ENDIF
    f = f + 1.0

ELSE
    IF     (f > 4.5)
        Debug.SendAnimationEvent(PlayerRef, "IdleInjured")
    ELSEIF (f > 3.0)
        Debug.SendAnimationEvent(PlayerRef, "StaggerPlayer")
    ENDIF

    IF ( bFemale )
        IntakeSFX.Play(PlayerRef)
    ENDIF

    BlurFX.Apply(f/5)
ENDIF

    Utility.Wait(f)
    Debug.SendAnimationEvent(PlayerRef, "IdleStop")

    Game.EnablePlayerControls()
ENDFUNCTION

;/ *** obsolete by default
;------------------------------------------------------
Float FUNCTION GetBuffedActorValue(Actor target, int i)
;------------------------------------------------------
    float f

IF (i == 1)
    f = target.GetActorValuePercentage("Health")
    RETURN (target.GetActorValue("Health") / f)
ENDIF
;---------
IF (i == 2)
    f = target.GetActorValuePercentage("Magicka")
    RETURN (target.GetActorValue("Magicka") / f)
ENDIF
;---------
IF (i == 3)
    f = target.GetActorValuePercentage("Stamina")
    RETURN (target.GetActorValue("Stamina") / f)
ENDIF
;---------
    RETURN f        ; safety first, returns Zero
ENDFUNCTION
*** /;

 

 

Edited by ReDragon2013
Link to comment
Share on other sites

You also posted a script, which I changed a bit as follow:

Keep in mind here we take the Target, not the Caster like sample script from above.

 

TieflingEquipHornsEffect

 

Scriptname TieflingEquipHornsEffect extends ActiveMagicEffect  
{rewritten by ReDragon 2017}

; https://forums.nexusmods.com/index.php?/topic/5775832-compiler-misreading-psc-file-can-only-see-eof/
; depog wrote: "Anybody else have any thoughts?"

  Quest PROPERTY TiefQ08 auto
  Quest PROPERTY TiefQ09 auto

  GlobalVariable PROPERTY TPHealthGlobal            auto
  GlobalVariable PROPERTY TPStaminaGlobal           auto
  GlobalVariable PROPERTY SickMorphState            auto
  GlobalVariable PROPERTY TieflingTransitionGlobal  auto
  GlobalVariable PROPERTY TieflingMorphGlobal       auto
  GlobalVariable PROPERTY TieflingTailChoiceGlobal  auto
  GlobalVariable PROPERTY TieflingHornsChoiceGlobal auto
  GlobalVariable PROPERTY TimeGlamourStart          auto
  GlobalVariable PROPERTY TieflingFreedomGlobal     auto

  Spell PROPERTY Vomit     auto
  Sound PROPERTY mySFX     auto
  Sound PROPERTY IntakeSFX auto

  Faction PROPERTY TieflingFaction auto

  ImageSpaceModifier PROPERTY IntroFX   auto
  ImageSpaceModifier PROPERTY BlurFX    auto
  ImageSpaceModifier PROPERTY BlurRedFX auto


 ;Armor[] PROPERTY TieflingSkinList auto      ; just in case you want to reduce properties here
 
Armor Property TieflingHorns1 Auto            ; TieflingSkinList[0]
Armor Property TieflingHorns2 Auto
Armor Property TieflingHorns3 Auto
Armor Property TieflingHorns4 Auto
Armor Property TieflingHorns5 Auto
Armor Property TieflingHorns6 Auto
Armor Property TieflingHorns7 Auto
Armor Property TieflingHorns8 Auto
Armor Property TieflingHorns9 Auto
Armor Property TieflingHorns10 Auto            ; TieflingSkinList[9]

Armor Property TieflingTail1 Auto              ; TieflingSkinList[10]
Armor Property TieflingTail2 Auto
Armor Property TieflingTail3 Auto
Armor Property TieflingTail4 Auto
Armor Property TieflingTail5 Auto
Armor Property TieflingTail6 Auto
Armor Property TieflingTail7 Auto
Armor Property TieflingTail8 Auto
Armor Property TieflingTail9 Auto
Armor Property TieflingTail10 Auto
Armor Property TieflingTail11 Auto             ; TieflingSkinList[20]

  Float PROPERTY TiefHealthPercentAtStart  auto
  Float PROPERTY TiefStaminaPercentAtStart auto

 ;Bool PROPERTY Female auto


; -- EVENTs --

EVENT OnEffectStart(Actor akTarget, Actor akCaster)
IF (akTarget == Game.GetPlayer())                        ; we assume the target should be the player!
ELSE
;;;    self.Dispel()
    RETURN    ; - STOP -    not the player
ENDIF
;---------------------
IF (TieflingTransitionGlobal.GetValue() == 1.0)          ; * Which script is setting this globalVar to One? (ReDragon)
ELSE
    Debug.Notification("Cannot morph whilst glamoured!")
    RETURN    ; - STOP - hmm.. !?
ENDIF
;---------------------
;;;    TieflingTransitionGlobal.SetValue(1)              ; *1*

IF (TieflingMorphGlobal.GetValue() == 0.0)
    TieflingMorphGlobal.SetValue(1.0)
    myF_MorphToTiefling(akTarget)
    Utility.Wait(2.0)
;;;    TieflingTransitionGlobal.SetValue(0)              ; ***
    RETURN    ;- STOP -    morphing from human to creature is done
ENDIF
;---------------------
    TieflingMorphGlobal.SetValue(0.0)
    myF_BackToHuman(akTarget)
    Utility.Wait(2.0)

    Debug.Notification ("Trading values improved")
    Utility.Wait(5.0)
    Debug.SendAnimationEvent(akTarget as ObjectReference, "IdleStop")
;;;    TieflingTransitionGlobal.SetValue(0)               ; ***
ENDEVENT


; -- FUNCTIONs -- 3

;-------------------------------------
FUNCTION myF_BackToHuman(Actor Player)
;-------------------------------------
    introFX.Apply(1)
    Utility.Wait(0.1)

    Player.DamageActorValue("Health", 100)
    Utility.Wait(0.1)

    Debug.SendAnimationEvent(Player as ObjectReference, "StaggerPlayer")
    TimeGlamourStart.SetValue( Player.GetActorValue("Health") )
        
;**************************************************************************************    REMOVE HORNS
    float f
    armor AR

    f = TieflingHornsChoiceGlobal.GetValue()
;;;    AR = None

    IF     (f == 1)
                    AR = TieflingHorns1
    ELSEIF (f == 2)
                    AR = TieflingHorns2
    ELSEIF (f == 3)
                    AR = TieflingHorns3
    ELSEIF (f == 4)
                    AR = TieflingHorns4
    ELSEIF (f == 5)
                    AR = TieflingHorns5
    ELSEIF (f == 6)
                    AR = TieflingHorns6
    ELSEIF (f == 7)
                    AR = TieflingHorns7
    ELSEIF (f == 8)
                    AR = TieflingHorns8
    ELSEIF (f == 9)
                    AR = TieflingHorns9
    ELSEIF (f == 10)
                    AR = TieflingHorns10
    ENDIF

    IF ( AR )
        Player.UnEquipItem(AR as Form, TRUE, TRUE)
    ENDIF

;**************************************************************************************    REMOVE TAIL
    f = TieflingTailChoiceGlobal.GetValue()
    AR = None

    IF     (f == 1)
                    AR = TieflingTail1
    ELSEIF (f == 2)
                    AR = TieflingTail2
    ELSEIF (f == 3)
                    AR = TieflingTail3
    ELSEIF (f == 4)
                    AR = TieflingTail4
    ELSEIF (f == 5)
                    AR = TieflingTail5
    ELSEIF (f == 6)
                    AR = TieflingTail6
    ELSEIF (f == 7)
                    AR = TieflingTail7
    ELSEIF (f == 8)
                    AR = TieflingTail8
    ELSEIF (f == 9)
                    AR = TieflingTail9
    ELSEIF (f == 10)
                    AR = TieflingTail10
    ELSEIF (f == 11)
                    AR = TieflingTail11
    ENDIF

    IF ( AR )
        Player.UnEquipItem(AR as Form, TRUE, TRUE)
    ENDIF

    Debug.Notification("Morphed to human form")
    Player.RemoveFromFaction(TieflingFaction)
    BlurFX.Apply(0.9)
ENDFUNCTION


;-----------------------------------------
FUNCTION myF_MorphToTiefling(Actor Player)
;-----------------------------------------
    bool bFemale = (Player.GetActorBase().GetSex() == 1)
    introFX.Apply(1)

    IF (TieflingFreedomGlobal.GetValue() == 3)
    ELSE
        Player.AddToFaction(TieflingFaction)
    ENDIF

    Debug.Notification ("Tiefling state affects trading values")

    SickMorphState.SetValue(0)
    SlaveTats.simple_add_tattoo(Player, "Dragon", "Nether Dragon Body")        ; call external function, the culprit !!!

 ;***************************************************************************************    TAIL RESET
    TiefQ09.Reset()

    Player.RemoveItem(TieflingTail1, 1, TRUE)
    Player.RemoveItem(TieflingTail2, 1, TRUE)
    Player.RemoveItem(TieflingTail3, 1, TRUE)
    Player.RemoveItem(TieflingTail4, 1, TRUE)
    Player.RemoveItem(TieflingTail5, 1, TRUE)
    Player.RemoveItem(TieflingTail6, 1, TRUE)
    Player.RemoveItem(TieflingTail7, 1, TRUE)
    Player.RemoveItem(TieflingTail8, 1, TRUE)
    Player.RemoveItem(TieflingTail9, 1, TRUE)
    Player.RemoveItem(TieflingTail10, 1, TRUE)
    Player.RemoveItem(TieflingTail11, 1, TRUE)
    Utility.Wait(1.0)

    TiefQ09.Start()
    Utility.Wait(0.2)

    float f = TieflingTailChoiceGlobal.GetValue()
    armor AR

    IF     (f == 1)
                    AR = TieflingTail1
    ELSEIF (f == 2)
                    AR = TieflingTail2
    ELSEIF (f == 3)
                    AR = TieflingTail3
    ELSEIF (f == 4)
                    AR = TieflingTail4
    ELSEIF (f == 5)
                    AR = TieflingTail5
    ELSEIF (f == 6)
                    AR = TieflingTail6
    ELSEIF (f == 7)
                    AR = TieflingTail7
    ELSEIF (f == 8)
                    AR = TieflingTail8
    ELSEIF (f == 9)
                    AR = TieflingTail9
    ELSEIF (f == 10)
                    AR = TieflingTail10
    ELSEIF (f == 11)
                    AR = TieflingTail11
    ELSE
        TieflingTailChoiceGlobal.SetValue(1)
        Debug.Notification("hmmm... error! Fire dragon tail equipped")
                    AR = TieflingTail1
    ENDIF

    Player.EquipItem(AR as Form, TRUE, TRUE)

; **************************************************************************************    HORNS RESET
    TiefQ08.Reset()

    Player.UnEquipItem(TieflingHorns1, TRUE, TRUE)
    Player.UnEquipItem(TieflingHorns2, TRUE, TRUE)
    Player.UnEquipItem(TieflingHorns3, TRUE, TRUE)
    Player.UnEquipItem(TieflingHorns4, TRUE, TRUE)
    Player.UnEquipItem(TieflingHorns5, TRUE, TRUE)
    Player.UnEquipItem(TieflingHorns6, TRUE, TRUE)
    Player.UnEquipItem(TieflingHorns7, TRUE, TRUE)
    Player.UnEquipItem(TieflingHorns8, TRUE, TRUE)
    Player.UnEquipItem(TieflingHorns9, TRUE, TRUE)
    Player.UnEquipItem(TieflingHorns10, TRUE, TRUE)

    Player.RemoveItem(TieflingHorns1, 1, TRUE)
    Player.RemoveItem(TieflingHorns2, 1, TRUE)
    Player.RemoveItem(TieflingHorns3, 1, TRUE)
    Player.RemoveItem(TieflingHorns4, 1, TRUE)
    Player.RemoveItem(TieflingHorns5, 1, TRUE)
    Player.RemoveItem(TieflingHorns6, 1, TRUE)
    Player.RemoveItem(TieflingHorns7, 1, TRUE)
    Player.RemoveItem(TieflingHorns8, 1, TRUE)
    Player.RemoveItem(TieflingHorns9, 1, TRUE)
    Player.RemoveItem(TieflingHorns10, 1, TRUE)
    Utility.Wait(0.1)

    TiefQ08.Start()

    f = TieflingHornsChoiceGlobal.GetValue()

    IF     (f == 1)
                    AR = TieflingHorns1
    ELSEIF (f == 2)
                    AR = TieflingHorns2
    ELSEIF (f == 3)
                    AR = TieflingHorns3
    ELSEIF (f == 4)
                    AR = TieflingHorns4
    ELSEIF (f == 5)
                    AR = TieflingHorns5
    ELSEIF (f == 6)
                    AR = TieflingHorns6
    ELSEIF (f == 7)
                    AR = TieflingHorns7
    ELSEIF (f == 8)
                    AR = TieflingHorns8
    ELSEIF (f == 9)
                    AR = TieflingHorns9
    ELSEIF (f == 10)
                    AR = TieflingHorns10
    ELSE
        TieflingHornsChoiceGlobal.SetValue(2.0)
        Debug.Notification("hmmm...  error! Daedric horns equipped")
                    AR = TieflingHorns2
    ENDIF

    Player.EquipItem(AR as Form, TRUE, TRUE)
 
; **************************************************************************************    NAUSEA ANIMATION
    float fBT = (TimeGlamourStart.GetValue() - Player.GetActorValue("Health")) / 25.0        ; fBT = HealthLost
    Debug.Notification("Tiefling form. You are now KOS")

    Stagger(Player as ObjectReference, bFemale,  1, fBT)
    Stagger(Player as ObjectReference, bFemale, 10, fBT)
    Stagger(Player as ObjectReference, bFemale, 15, fBT*2.0)
    Stagger(Player as ObjectReference, bFemale, 25, fBT)
ENDFUNCTION


;----------------------------------------------------------------------------
FUNCTION Stagger(ObjectReference PlayerRef, Bool bFemale, Float r, Float fBT)                ; r = Interim, fBT = BleedTime
;----------------------------------------------------------------------------
    float f = Utility.RandomFloat() * Utility.RandomFloat() * fBT                            ; f = RandomBleed
    IF (f > 5)
        f = 5.0
    ENDIF

    Game.DisablePlayerControls(TRUE,TRUE,TRUE, False, TRUE,TRUE, TRUE,TRUE)

IF (Utility.RandomFloat() >= 0.5)
    float w
    IF (r == 1)
        w = r
    ELSE
        w = Utility.RandomFloat() * 2.0
        w =((Utility.RandomFloat() * r) + 5.0) * w
    ENDIF
    Utility.Wait(1.5 + w)
    
    Debug.SendAnimationEvent(PlayerRef, "idleInjured")

    IF ( bFemale )
        IntakeSFX.Play(PlayerRef)
    ENDIF
    Utility.Wait(1.5)

    Debug.SendAnimationEvent(PlayerRef, "idleStop")
    Utility.Wait(0.5)

    IF     (f > 4.5)
        Debug.SendAnimationEvent(PlayerRef, "IdleInjured")
        Debug.notification("Glamour recovery nausea")
        Utility.Wait(1.5)

        Debug.SendAnimationEvent(PlayerRef, "StaggerPlayer")
        mySFX.Play(PlayerRef)
        Vomit.Cast(PlayerRef, PlayerRef)
        Utility.Wait(f)

        BlurRedFX.Apply(f/5)
        Debug.SendAnimationEvent(PlayerRef, "StaggerPlayer")
        mySFX.Play(PlayerRef)
        Vomit.Cast(PlayerRef, PlayerRef)

    ELSEIF (f > 2.5)
        Debug.SendAnimationEvent(PlayerRef, "IdleInjured")
        Debug.notification("Glamour recovery nausea")
        BlurRedFX.Apply(f/5)
        Utility.Wait(1.5)

        Debug.SendAnimationEvent(PlayerRef, "StaggerPlayer")
        mySFX.Play(PlayerRef)
        Vomit.Cast(PlayerRef, PlayerRef)

    ELSE
        Debug.SendAnimationEvent(PlayerRef, "IdleInjured")
        Debug.notification("Glamour recovery nausea")
        BlurRedFX.Apply(f/5)
    ENDIF
    f = f + 1.0

ELSE
    IF     (f > 4.5)
        Debug.SendAnimationEvent(PlayerRef, "IdleInjured")
    ELSEIF (f > 3.0)
        Debug.SendAnimationEvent(PlayerRef, "StaggerPlayer")
    ENDIF

    IF ( bFemale )
        IntakeSFX.Play(PlayerRef)
    ENDIF

    BlurFX.Apply(f/5)
ENDIF

    Utility.Wait(f)
    Debug.SendAnimationEvent(PlayerRef, "IdleStop")

    Game.EnablePlayerControls()
ENDFUNCTION

;/ *** obsolete by default
;------------------------------------------------------
Float FUNCTION GetBuffedActorValue(Actor target, int i)
;------------------------------------------------------
    float f

IF (i == 1)
    f = target.GetActorValuePercentage("Health")
    RETURN (target.GetActorValue("Health") / f)
ENDIF
;---------
IF (i == 2)
    f = target.GetActorValuePercentage("Magicka")
    RETURN (target.GetActorValue("Magicka") / f)
ENDIF
;---------
IF (i == 3)
    f = target.GetActorValuePercentage("Stamina")
    RETURN (target.GetActorValue("Stamina") / f)
ENDIF
;---------
    RETURN f        ; safety first, returns Zero
ENDFUNCTION
*** /;

 

 

Wow, you certainly spent some time on it. Thank you

Link to comment
Share on other sites

 

 

 

 

 

dePog wrote:
The script "SlaveTats.psc" is existing within the right folder "Scripts\source"
and has a first line like that "Scriptname SlaveTats Hidden".
You have a codeline within an ActiveMagicEffect script as follow:
SlaveTats.simple_add_tattoo(Game.GetPlayer(), "Dragon", "Nether Dragon Body)")


What does it mean?
Your script "SlaveTats" is a script without self. Every function inside that script need a special attached keyword "Global".

The next code could be helpful to understand, it's a rough guess of mine.

a sample magicEffect script as follow:

Scriptname Spell_TransformScript extends ActiveMagicEffect
 
  ; -- EVENTs --
 
EVENT OnEffectStart(Actor akTarget, Actor akCaster)
    Debug.Trace("TS: OnEffectStart() - target = " +akTarget+ ",  caster = " +akCaster)

IF (akCaster == Game.GetPlayer())
    myF_Transform(akCaster)        ; we assume the player is the caster, if not take akTarget instead
ENDIF
ENDEVENT

EVENT OnEffectFinish(Actor akTarget, Actor akCaster)
    Debug.Trace("TS: OnEffectFinish() - has been reached..")
ENDEVENT

; -- FUNCTION --

FUNCTION myF_Transform(Actor Player)
;-----------------------------------
    ; code before
    SlaveTats.simple_add_tattoo(Player, "Dragon", "Nether Dragon Body)")
    ; code behind
ENDFUNCTION

Variant (A) - no self available

Scriptname SlaveTats Hidden
{this script may not have any variables, properties or events}

; -- FUNCTIONs --

FUNCTION simple_add_tattoo(Actor aRef, String s, String s2) Global  ; the special function keyword
;----------------------------------------------------------
; aRef = Player
;   s  = "Dragon"
;   s2 = "Nether Dragon Body)"    <-- is this string right?

  ; your tattoo code here
ENDFUNCTION

Variant (B) - self is an Object

Scriptname SlaveTats extends ObjectReference Hidden
{this script may have variables, properties and events}

; -- FUNCTIONs --

FUNCTION simple_add_tattoo(Actor aRef, String s, String s2)
;----------------------------------------------------------
; aRef = Player
;   s  = "Dragon"
;   s2 = "Nether Dragon Body)"    <-- is this string right?

  ; your tattoo code here
ENDFUNCTION

 

 

 

 

Thanks ReDragon2013.

 

I'll have a play around with this and see what happens.

 

 

However, with regards to your comment:

What does it mean?
Your script "SlaveTats" is a script without self. Every function inside that script need a special attached keyword "Global".

 

It was my understanding that this line was calling the SlaveTats.psc file and using it to apply the new texture. (Posted some of it in the spoiler below)

 

 

 

scriptname SlaveTats hidden

import NiOverride
import NetImmerse

; A "tattoo" is a JMap containing the following keys:
; name -> string The name to display for the tattoo. Should be unique within its section
; section -> string The section to place the tattoo under, in the menu
; texture -> string The path to the texture, relative to Data\Textures\Actors\Character\slavetats
; area -> string One of "Body", "Face", "Hands", "Feet"

; The following keys are also meaningful, but not required:
; slot -> int The overlay index to use. Will be automatically selected and filled by add_tattoo() if absent
; color -> int The color to use. Can be overridden via the menu
; glow -> int The glow color to use. Can be overridden via the menu
; gloss -> int If > 0, use skin-like gloss. Otherwise, use matte color
; bump -> string Currently ignored. Will be the bump map to apply, once I figure out how
; locked -> int If > 0, the tattoo can not be removed except by passing ignore_locked = true to remove_tattoos()
; excluded_by -> string If an applied tattoo has a key equal to the excluded_by value, add_tattoo() will fail
; requires -> string add_tattoo() will fail unless an applied tattoo has a key equal to the requires value, and tattoos with unmet requirements will be removed during synchronize_tattoos()
; requires_plugin -> string The file name of an esp or esm file that must be loaded before query_available_tattoos() will include this tattoo in the result set. If this is a list of names instead of a name, requires_formid must be a list as well, and at least one of the plugin/formid pairs must be available
; requires_formid -> string The form id that must be loadable from the requires_plugin file before query_available_tattoos() will include this tattoo in the result set. If this is a list of formids instead of a formid, requires_plugin must be a list as well, and at least one of the plugin/formid pairs must be available
; domain -> string If this is specified, the tattoo will not appear in the menu. The only way to access the tattoo will be from a mod that requests that specific domain from query_available_tattoos()
; spell_plugin -> string The file name of the esp or esm file containing the spell to cast when the tattoo is applied, or a list of such filenames in order of preference
; spell_formid -> int The form id for the spell, relative to the spell_plugin file, or a list of such formids relative to the corresponding names in spell_plugin
; spell_source_plugin -> string Similar to spell_plugin, except it determines who is "casting" the spell. Rarely needed.
; spell_source_formid -> int Similar to spell_formid, except it determines who is "casting" the spell. Rarely needed
; event -> string The name of a ModEvent to send when the tattoo is applied or cleared. The event is sent with "applied" or "cleared" as the first parameter, and the target actor as the second.
; credit -> string The person who should be credited artistically for the tattoo
; in_bsa -> int If not 0, the tattoo texture may be loaded from a BSA file

; Arbitrary additional keys are allowed, which is helpful with excluded_by and requires, and may be useful for other mods using the API


; The 'high-level' API consists of the functions:
; simple_add_tattoo()
; simple_remove_tattoo()


; The primary API consists of the functions:
; query_available_tattoos()
; query_applied_tattoos()
; add_tattoo()
; remove_tattoos()
; synchronize_tatoos()

; The other functions are situationally useful, or helpers.



; Constants defined this way don't get stuck with old values after code updates. This is no slower than accessing a property.
string function VERSION() global
return "1.0.0" ; This is the data structure version, not the release number that's shown to users
endfunction

string function ROOT() global
return "Data\\Textures\\"
endfunction

string function PREFIX() global
return "Actors\\Character\\slavetats\\"
endfunction

int function SLOTS(string area) global
if area == "Body"
return NiOverride.GetNumBodyOverlays()
elseif area == "Face"
return NiOverride.GetNumFaceOverlays()
elseif area == "Hands"
return NiOverride.GetNumHandOverlays()
elseif area == "Feet"
return NiOverride.GetNumFeetOverlays()
else
return 0
endif
endfunction

; Finds the tattoo with the matching section name and tattoo name, and inks it on
; the target in the specified color. Returns true if successful, otherwise false.
; If you're planning on adding more than one tattoo at the same time, pass false to the
; 'last' parameter for all but the last one.
bool function simple_add_tattoo(Actor target, string section, string name, int color = 0, bool last = true, bool silent = false, float alpha = 1.0) global
int template = JValue.addToPool(JMap.object(), "SlaveTatsHighLevel")
int matches = JValue.addToPool(JArray.object(), "SlaveTatsHighLevel")
int tattoo = 0

JMap.setStr(template, "section", section)
JMap.setStr(template, "name", name)

if query_available_tattoos(template, matches)
JValue.cleanPool("SlaveTatsHighLevel")
return false
endif

tattoo = JValue.addToPool(JArray.getObj(matches, 0), "SlaveTatsHighLevel")
JMap.setInt(tattoo, "color", color)
JMap.setFlt(tattoo, "invertedAlpha", 1.0 - alpha)

JArray.clear(matches)

if query_applied_tattoos(target, template, matches)
JValue.cleanPool("SlaveTatsHighLevel")
return false
endif

if JArray.count(matches) > 0
JValue.cleanPool("SlaveTatsHighLevel")
return false
endif

if add_tattoo(target, tattoo, -1, false, true)
JValue.cleanPool("SlaveTatsHighLevel")
return false
endif

if last
if synchronize_tattoos(target, silent)
JValue.cleanPool("SlaveTatsHighLevel")
return false
endif
endif

JValue.cleanPool("SlaveTatsHighLevel")
return true
endfunction

; Removes the tattoo with the given section name and tattoo name from the actor. Returns true if
; successful, false otherwise.
; If you're planning on removing more than one tattoo at the same time, pass false to the
; 'last' parameter for all but the last one.
bool function simple_remove_tattoo(Actor target, string section, string name, bool last = true, bool silent = false) global
int template = JValue.addToPool(JMap.object(), "SlaveTatsHighLevel")
int matches = JValue.addToPool(JArray.object(), "SlaveTatsHighLevel")
int tattoo = 0

JMap.setStr(template, "section", section)
JMap.setStr(template, "name", name)

if query_applied_tattoos(target, template, matches)
JValue.cleanPool("SlaveTatsHighLevel")
return false
endif

if JArray.count(matches) == 0
JValue.cleanPool("SlaveTatsHighLevel")
return false
endif

tattoo = JValue.addToPool(JArray.getObj(matches, 0), "SlaveTatsHighLevel")

if remove_tattoos(target, tattoo, true, true)
JValue.cleanPool("SlaveTatsHighLevel")
return false
endif

if last
if synchronize_tattoos(target, silent)
JValue.cleanPool("SlaveTatsHighLevel")
return false
endif
endif

JValue.cleanPool("SlaveTatsHighLevel")
return true
endfunction

 

 

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...