A request for scripting aid :(

Post » Thu Jun 21, 2012 2:42 am

hi everybody, thanks for taking the time to read this. I shall endeavour to be as relevant and concise as possible.

i am trying to create a script to change the PC race to a race i am creating, much like vampires and werewolves do. so...a breton for example will become bretonvampire.

Currently i am using a consumable item (its an ingredient) and the plan is upon consumption of this, the race is changed. simples.

however, i'm having troubles that i cant overcome due to my idiocy and lack of aptitude. I am hoping that one or more of you lovely geniuses (cuz flattery will get you everywhere :tongue:) can help me get this working and as such...actually finish my mod.

so...here is that script

Spoiler

Scriptname z0wendigomakerscr extends ObjectReference Hidden ConditionalRace Property ArgonianRace  Auto  Race Property ArgonianRaceWendigo  Auto  Race Property BretonRace  Auto  Race Property BretonRaceWendigo  Auto  Race Property DarkElfRace  Auto  Race Property DarkElfRaceWendigo  Auto  Race Property HighElfRace  Auto  Race Property HighElfRaceWendigo  Auto  Race Property ImperialRace  Auto  Race Property ImperialRaceWendigo  Auto  Race Property KhajiitRace  Auto  Race Property KhajiitRaceWendigo  Auto  Race Property NordRace  Auto  Race Property NordRaceWendigo  Auto  Race Property OrcRace  Auto  Race Property OrcRaceWendigo Auto  Race Property RedguardRace  Auto  Race Property RedguardRaceWendigo  Auto  Race Property WoodElfRace  Auto  Race Property WoodElfRaceWendigo  Auto  Race Property CureRace Autofunction wendigochange (actor target)Game.DisablePlayerControls()	 if (Target.GetActorBase().GetRace() == ArgonianRace)				CureRace = ArgonianRace				Target.SetRace(ArgonianRaceWendigo)		elseif (Target.GetActorBase().GetRace() == BretonRace)				CureRace = BretonRace				Target.SetRace(BretonRaceWendigo)		elseif (Target.GetActorBase().GetRace() == DarkElfRace)				CureRace = DarkElfRace				Target.SetRace(DarkElfRaceWendigo)		elseif (Target.GetActorBase().GetRace() == HighELfRace)				CureRace = HighELfRace				Target.SetRace(HighELfRaceWendigo)		elseif (Target.GetActorBase().GetRace() == ImperialRace)				CureRace = ImperialRace				Target.SetRace(ImperialRaceWendigo)		elseif (Target.GetActorBase().GetRace() == KhajiitRace)				CureRace = KhajiitRace				Target.SetRace(KhajiitRaceWendigo)		elseif (Target.GetActorBase().GetRace() == NordRace)				CureRace = NordRace				Target.SetRace(NordRaceWendigo)		elseif (Target.GetActorBase().GetRace() == OrcRace)				CureRace = OrcRace				Target.SetRace(OrcRaceWendigo)		elseif (Target.GetActorBase().GetRace() == RedguardRace)				CureRace = RedguardRace				Target.SetRace(RedguardRaceWendigo)		elseif (Target.GetActorBase().GetRace() == WoodElfRace)				CureRace = WoodElfRace				Target.SetRace(WoodElfRaceWendigo)		endif		Utility.Wait(1)Game.EnablePlayerControls()	endFunctionevent onactivate(objectreference aktarget)aktarget = game.getplayer()wendigochange()endevent

this does not compile for reasons i dont fully understand.
the error i am getting is "argument target is not specified and has no default value"

i literally have no idea. and i'm sorry to pester y'all.

i am trying to use the code in a magical effect with a script effect archetype.

many thanks :smile:
cab
User avatar
RAww DInsaww
 
Posts: 3439
Joined: Sun Feb 25, 2007 5:47 pm

Post » Thu Jun 21, 2012 1:38 pm

For what I am seeing, you forgot to pass the argument in you call of wendigochange()

event onactivate(objectreference aktarget)aktarget = game.getplayer()wendigochange(aktarget)endevent

note that you may want to check if aktarget == player

event onactivate(objectreference aktarget)if aktarget == game.getplayer()wendigochange(aktarget )endifendevent
User avatar
Alexis Acevedo
 
Posts: 3330
Joined: Sat Oct 27, 2007 8:58 pm

Post » Thu Jun 21, 2012 1:44 am

Don't be so hard on yourself. You're not incompetent, you're new. No one is a "born coder" except for that really cool little kid in Heroes that should have been the main character.
User avatar
James Baldwin
 
Posts: 3366
Joined: Tue Jun 05, 2007 11:11 am

Post » Thu Jun 21, 2012 5:20 am

:) thanks for your responses :)

with your assistance the script now compiles (although i had to remove the "extends objectreference hidden conditional" from the top)

but this still doesnt work in game, have i missed something vitally important?
User avatar
MR.BIGG
 
Posts: 3373
Joined: Sat Sep 08, 2007 7:51 am

Post » Thu Jun 21, 2012 11:05 am

Is the script firing? If it is firing, is it detecting a valid existing race?

Put
debug.messagebox("My Current Race is: " + CureRace)

After "Game.EnablePlayerControls()" line

Then, in game, you should get a messagebox displayed that will tell you whether the Ifs are picking up (if there is NO RACE in the messagebox text, then they aren't firing)

Worth testing that before you dig any deeper :)
User avatar
brandon frier
 
Posts: 3422
Joined: Wed Oct 17, 2007 8:47 pm

Post » Thu Jun 21, 2012 4:45 am

I have copy/pasted the above line in the correct place in the script. upon eating my ingredient no message box appeared at all.

which means...its not loading the script at all...right?

is onactivate the right event to use?

thanks again for your helpings :D
User avatar
Dan Scott
 
Posts: 3373
Joined: Sun Nov 11, 2007 3:45 am

Post » Thu Jun 21, 2012 1:45 pm

Try...
ScriptName z0wendigomakerscr extends ObjectReferenceFormList Property PlayableRaceFLST AutoFormList Property WendigoRaceFLST AutoEvent OnActivate(ObjectReference akActivator)	If akActivator == Game.GetPlayer()		WendigoChange(Game.GetPlayer())	EndIfEndEventFunction WendigoChange(Actor akTarget = None, Int aiIndex = 0)	Game.DisablePlayerControls()	If PlayableRaceFLST.HasForm(akTarget.GetActorBase().GetRace())		While akTarget.GetRace() != PlayableRaceFLST.GetAt(aiIndex)			aiIndex += 1		EndWhile		akTarget.SetRace(WendigoRaceFLST.GetAt(aiIndex) As Race)	ElseIf WendigoRaceFLST.HasForm(akTarget.GetActorBase().GetRace())		While akTarget.GetRace() != WendigoRaceFLST.GetAt(aiIndex)			aiIndex += 1		EndWhile		akTarget.SetRace(PlayableRaceFLST.GetAt(aiIndex) As Race)	EndIf         	Utility.Wait(1)	Game.EnablePlayerControls()EndFunction
...and put all the normal races and Wendingo races in the two form lists such that their indices match. You'll not need as many properties or a CureRace var as the function should work both ways.
User avatar
Amysaurusrex
 
Posts: 3432
Joined: Wed Aug 09, 2006 2:45 pm

Post » Thu Jun 21, 2012 12:05 pm

hai hai, thanks for the script justin, and for formlists...i feel they may make life easier in the future :)

however this still isnt working, it cant still be the script...

this is the item
Spoiler

[img]http://imageshack.us/photo/my-images/151/itemqn.jpg/[/img]


the magic effect
Spoiler

[img]http://imageshack.us/photo/my-images/546/magiceff.jpg/[/img]

am i missing something?

i really really appreciate the help, its been about two months of trial and error, mostly error lol
User avatar
StunnaLiike FiiFii
 
Posts: 3373
Joined: Tue Oct 31, 2006 2:30 am

Post » Thu Jun 21, 2012 11:01 am

The OnActivate event only runs when the object is in the game world (ie not in inventory) and you activate it. Trying to activate it in inventory actually sends an equip event. Depending on how you are using it, you may want to change the script to use http://www.creationkit.com/OnEquipped_-_ObjectReference instead.
User avatar
Dark Mogul
 
Posts: 3438
Joined: Tue Feb 20, 2007 11:51 am

Post » Thu Jun 21, 2012 2:09 pm

that was it...that was actually actually it...YATTA!!!

thank you all so very very much, i would personally deliver you a cookie but...that would be a bit wierd...turning up at your house n all :D

/hug

i love you guys :D

and i shall credit you in the mod...for whatever thats worth...probably nowt :D
User avatar
Camden Unglesbee
 
Posts: 3467
Joined: Wed Aug 15, 2007 8:30 am


Return to V - Skyrim