Passing akSpeaker to a script

Post » Wed Jun 20, 2012 5:40 am

Hi,


Perhaps simple, but I can't figure it out, how can I pass an akSpeaker ref to an event inside a script?
The script is also not on the quest with the akSpeaker ref...
User avatar
Hot
 
Posts: 3433
Joined: Sat Dec 01, 2007 6:22 pm

Post » Wed Jun 20, 2012 7:34 am

I tried to pass it with a function but it still doesn't work...

In the script neh_EnleverArtefactsDaedriques (on an alias of the player), I have :


Function EnleverObjets(Actor theSpeaker)
GetActorRef().UnequipAll()
Speaker = theSpeaker
EndFunction

Actor Property Speaker Auto

And in my (other) quest, the papyrus fragment call this at the end of a dialogue :


enleverartefacts.setstage(0)
neh_EnleverArtefactsDaedriques.EnleverObjets(akSpeaker)

enleverartefacts is a property which contains the quest wich have the player alias, I start it with setstage(0)

Trying to compile the fragment gives me this error :



cannot call the member function EnleverObjets alone or on a type, must call it on a variable

I am completely lost on this....
User avatar
Steven Nicholson
 
Posts: 3468
Joined: Mon Jun 18, 2007 1:24 pm

Post » Wed Jun 20, 2012 3:36 pm

I think you probably need to define the alias as a ReferenceAlias property in the Papyrus fragment. Right now the fragment can't know what "neh_EnleverArtefactsDaedriques" is. But if you define a ReferenceAlias property called something like PlayerAlias that points to it, you should then be able to do something like EDIT: (PlayerAlias as neh_EnleverArtefactsDaedriques).EnleverObjets(akSpeaker).
User avatar
Stephani Silva
 
Posts: 3372
Joined: Wed Jan 17, 2007 10:11 pm

Post » Wed Jun 20, 2012 2:47 pm

Problem is I can only point to aliases with a ReferenceAlias property and I cannot create an alias which points to a script :/

Don't know if it can help, but the WEThalmorDialogue vanilla quest use (GetOwningQuest() as WEThalmorDialogueScript).makeEnemyOfPlayer(akSpeaker), but I can't do that since my script extends Referencealias for it to works whereas the thalmor script extends quest (if I try I get an error on incompatible types)
User avatar
Mark Churchman
 
Posts: 3363
Joined: Sun Aug 05, 2007 5:58 am

Post » Wed Jun 20, 2012 11:35 am

What about, using that same method, (PlayerAlias as neh_EnleverArtefactsDaedriques).EnleverObjets(akSpeaker) -- that should tell the game which script on the alias to use to find your function.
User avatar
Bloomer
 
Posts: 3435
Joined: Sun May 27, 2007 9:23 pm

Post » Wed Jun 20, 2012 3:50 am

Like I said it doesn't work (exact error : cannot cast a quest to a neh_enleverartefactsdaedriques, types are incompatible) because my script extends Referencealias (as all scripts on alias should, see note in alias data http://www.creationkit.com/Reference_Alias :Scripts: Select scripts to run on the alias. These must extend ReferenceAlias script type in order to work properly) whereas the Thalmor one extends quest.
User avatar
Sebrina Johnstone
 
Posts: 3456
Joined: Sat Jun 24, 2006 12:58 pm

Post » Wed Jun 20, 2012 1:48 pm

Yes, but can't you add a ReferenceAlias property to the Papyrus fragement? And then set that property to the script you have on the alias?
User avatar
Timara White
 
Posts: 3464
Joined: Mon Aug 27, 2007 7:39 am

Post » Wed Jun 20, 2012 9:39 am

It works! I don't fully understand what the 'as' thing is for, but it works...it only takes a part of a 'bigger thing'?
Thanks a lot! I am finally able to continue my mod, got stuck on this for 2 days :)
User avatar
Marquis T
 
Posts: 3425
Joined: Fri Aug 31, 2007 4:39 pm

Post » Wed Jun 20, 2012 1:07 am

Great, glad it is working! Sorry my earlier post wasn't clearer. Regarding "as"--because the script on your player alias extends the ReferenceAlias data type, it creates a new extended "data type" of its own. So when you use the syntax (ReferenceAliasProperty as ReferenceAliasScriptName), you are "casting" the ReferenceAlias into that new extended data type. This lets you access the additional functions and variables you created in that new data type, which is to say, in your script. (I'm not sure if that helps, but it is hard to explain.)
User avatar
Alexandra Louise Taylor
 
Posts: 3449
Joined: Mon Aug 07, 2006 1:48 pm

Post » Wed Jun 20, 2012 8:00 am

I've got a problem similar to this, however I'm not using some alias, I'm just accessing actor values... my script goes something like this:
Scriptname accessActorValues Extends QuestFunction accessAV(Actor akSpeakerRef);Access actor valuesEndFunction

Then in the papyrus fragment at the topic info:
accesser.accessAV(akSpeaker)

I've already included "accesser" as accessActorValues in the properties of the fragment.. What am I missing?

EDIT: Nevermind, I found out what I was missing :D it now works :P
User avatar
Reven Lord
 
Posts: 3452
Joined: Mon May 21, 2007 9:56 pm


Return to V - Skyrim