TheSkoomaKing Posted December 17, 2012 Share Posted December 17, 2012 here is my script: Scriptname aaTameBeastScriptEffect01 extends Quest ;//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////;PropertiesFaction Property PlayerFaction Auto Faction Property TamedBeastFaction Auto GlobalVariable Property AlreadyTamedGlobal Auto Faction Property CreatureFaction Auto Keyword Property Creature Auto Keyword Property ActorTypeCreature Auto Faction Property FollowerFaction Auto Message Property FailMessage01 Auto Message Property failMessage02 Auto Message Property SuccessMessage01 Auto Race Property BearSnow Auto Race Property BearBlack Auto Race Property BearBrown Auto Race Property Goat Auto Race Property TrollIce Auto Race Property Deer Auto Race Property Mammoth Auto Race Property WolfRace Auto Race Property CharusRace Auto Race Property FoxRace Auto Race Property SpiderRace01 Auto Race Property SpiderRace02 Auto Race Property MudcrabRace Auto Race Property SabreCatRace Auto Race Property SabreCatSnow Auto Race Property SprigganRace Auto Race Property TamedBearBlackRace Auto Race Property TamedBearBrownRace Auto Race Property TamedBearSnowRace Auto Race Property TamedChaurusRace Auto Race Property TamedElkRace Auto Race Property TamedFoxRace Auto Race Property TamedFrostbiteSpiderRace Auto Race Property TamedFrostBiteSpiderGiant Auto Race Property TamedGoatRace Auto Race Property TamedMammothRace Auto Race Property TamedMudcrabRace Auto Race Property TamedSabreCatRace Auto Race Property TamedSabreCatSnowyRace Auto Race Property TamedSprigganRace Auto Race Property TamedTrollFrostRace Auto Race Property TamedTrollRace Auto Race Property TamedWispRace Auto Race Property TamedWolfRace Auto Race Property TamedDeerRace Auto Race Property CureRace Auto Faction Property CurrentFollowerFaction Auto Topic Property FollowMeTopic Auto Alias Property TamedBeastAlias Auto ;//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////; Begins here!! Event OnEffectStart(Actor akTarget, Actor akCaster)Actor akTarget = TamedBeastAlias.GetActorReference()AkTarget.StopCombat()SuccessMessage01.Show() AkTarget.RemoveFromFaction(CreatureFaction)AkTarget.AddToFaction(TamedBeastFaction)AkTarget.AddToFaction(playerFaction)AkTarget.AddToFaction(FollowerFaction)AlreadyTamedGlobal.SetValue(1)AkTarget.SetFactionRank(CurrentFollowerFaction, -1)SuccessMessage01.Show() akTarget.GetRace() If akTargetRace.HasKeyword(ActorTypeCreature) == 1 Debug.Notification("Target is valid for taming") CureRace = akTarget.GetRace() if (CureRace == BearSnow) akTarget.SetRace(TamedBearSnowRace) elseif (CureRace == BearBrown) akTarget.SetRace(TamedBearBrownRace) elseif (CureRace == BearBlack) akTarget.SetRace(TamedBearBlackRace) elseif (CureRace == CharusRace) akTarget.SetRace(TamedChaurusRace) elseif (CureRace == Goat) akTarget.SetRace(TamedGoatRace) elseif (CureRace == TrollIce) akTarget.SetRace(TamedTrollFrostRace) elseif (CureRace == Deer) akTarget.SetRace(TamedDeerRace) elseif (CureRace == Mammoth) akTarget.SetRace(TamedMammothRace) elseif (CureRace == WolfRace) akTarget.SetRace(TamedWolfRace) elseif (CureRace == FoxRace) akTarget.SetRace(TamedFoxRace) elseif (CureRace == SpiderRace01) akTarget.SetRace(TamedFrostbiteSpiderRace) elseif (CureRace == SpiderRace02) akTarget.SetRace(TamedFrostbiteSpiderGiant) else ;Debug.Trace("[Dark Gift][Warning] " + akTarget + " is not a known race. Defaulting to Imperial vampire.") endifendiffloat AlreadyTamed = AlreadyTamedGlobal.GetValue() if (AlreadyTamed == 1) FailMessage02.Show() Debug.Notification("Target is not valid for taming") Endif Race akTargetRace = akTarget.GetRace() If akTargetRace.HasKeyword(ActorTypeCreature) == 0 Debug.Notification("Target is not valid for taming") FailMessage01.Show() Endif Endevent ///////////////////////////////////////////////////////////////////////////////////////////////// what im trying to do is that you can cast a spell on a random Creature that is stated above in the script. And he will then turn to a same looking Race but modified so it suits a AnimalFollower. (Edited AllowPCDialog). However to make a animal follower you need a script inside the specific reference/target. And since it is randomi figured I´d set it up with an Alias. But i dont know how to make the game/script know that the "AkTarget" is the "TamedBeastAlias". When i try to Compile all it says is : Starting 1 compile threads for 1 files...Compiling "aaTameBeastScriptEffect01"...C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\aaTameBeastScriptEffect01.psc(12,0): function variable akTarget already defined in the same scopeNo output generated for aaTameBeastScriptEffect01, compilation failed. Anyone who can help me with this? Would be very appreciated! Link to comment Share on other sites More sharing options...
Eckss Posted December 17, 2012 Share Posted December 17, 2012 Hi,I have a few tips for you that might help: OnEffectStart is an Event in a MagicEffect Script, not a Quest Script. - Choose a different Event or put the Script on the Magic Effect. AkTarget is the parameter of the Event, you shouldn’t be setting it. – Perhaps you might get what you want with – If akTarget == TamedBeastAlias.GetActorReference() ;whateverEndIf You will at least stop getting that error if you stop trying to set akTarget. Good luck, and don’t be disheartened by failure; papyrus is an awful programming language and it’s very badly documented. The CK Wiki is useful, but it isn’t always all that clear.Eck. :) Link to comment Share on other sites More sharing options...
TheSkoomaKing Posted December 17, 2012 Author Share Posted December 17, 2012 (edited) Yes yes, i know Event oneffectstart is not a quest event. But the prev i tried didt work, so i was just mixing around. will try the If akTarget == TamedBeastAlias.GetActorReference() thing thou. I hope it will work. will be back with an answer soon :) EDIT: i get this:Starting 1 compile threads for 1 files...Compiling "aaTameBeastScriptEffect01"...C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\aaTameBeastScriptEffect01.psc(12,31): GetActorReference is not a function or does not existNo output generated for aaTameBeastScriptEffect01, compilation failed. when i try to compile with the If akTarget == TamedBeastAlias.GetActorReference(). Any other advice? Edited December 17, 2012 by TheSkoomaKing Link to comment Share on other sites More sharing options...
Eckss Posted December 17, 2012 Share Posted December 17, 2012 Add this before the properties:-Import ReferenceAlias The function you're using isn't a Quest function so you have to import the script type it comes from. Link to comment Share on other sites More sharing options...
TheSkoomaKing Posted December 17, 2012 Author Share Posted December 17, 2012 I tried. It still says : C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\aaTameBeastScriptEffect01.psc(16,28): GetActorReference is not a function or does not existNo output generated for aaTameBeastScriptEffect01, compilation failed. Link to comment Share on other sites More sharing options...
TheSkoomaKing Posted December 17, 2012 Author Share Posted December 17, 2012 (edited) I tried to put Import ReferenceAlias before the properties, but it still says : C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\aaTameBeastScriptEffect01.psc(16,28): GetActorReference is not a function or does not existNo output generated for aaTameBeastScriptEffect01, compilation failed. where should i put If akTarget == TamedBeastAlias.GetActorReference() then? i putted it right after the event starts, like this: Event OnEffectStart(Actor akTarget, Actor akCaster)Actor akTarget = TamedBeastAlias.GetActorReference()AkTarget.StopCombat()SuccessMessage01.Show()AkTarget.RemoveFromFaction(CreatureFaction)AkTarget.AddToFaction(TamedBeastFaction)AkTarget.AddToFaction(playerFaction)AkTarget.AddToFaction(FollowerFaction)AlreadyTamedGlobal.SetValue(1)AkTarget.SetFactionRank(CurrentFollowerFaction, -1)SuccessMessage01.Show() ( Sorry for double post btw.. lagspike ) Edited December 17, 2012 by TheSkoomaKing Link to comment Share on other sites More sharing options...
Eckss Posted December 17, 2012 Share Posted December 17, 2012 instead of GetActorReference, try casting it as an actor:- If akTarget == (TamedBeastAlias as Actor) Link to comment Share on other sites More sharing options...
TheSkoomaKing Posted December 17, 2012 Author Share Posted December 17, 2012 hehe now another error comes up: C:\Program Files (x86)\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\aaTameBeastScriptEffect01.psc(14,32): cannot cast a alias to a actor, types are incompatibleNo output generated for aaTameBeastScriptEffect01, compilation failed. Any other advice? ( btw.. thank you so much for taking your time to figure out what it is, im truly gratefull :) ) Link to comment Share on other sites More sharing options...
Ghaunadaur Posted December 17, 2012 Share Posted December 17, 2012 Change the Alias property to ReferenceAlias property, then try again. ReferenceAlias Property TamedBeastAlias Auto BTW, akTarget = TamedBeastAlias.GetActorReference()= akTarget = TamedBeastAlias.GetReference() as Actor The second one is faster. :thumbsup: Link to comment Share on other sites More sharing options...
Eckss Posted December 17, 2012 Share Posted December 17, 2012 Ghaunadaur is right, I didn't notice that you had declared the alias as Alias instead of ReferenceAlias.ChangeAlias Property TamedBeastAlias AutoToReferenceAlias Property TamedBeastAlias AutoAs Ghaunadaur pointed out and thenIf akTarget == TamedBeastAlias.GetActorReference() ;whatever EndIfWill compile (I checked) Link to comment Share on other sites More sharing options...
Recommended Posts