Problem with Aliases?

Post » Sun Jun 24, 2012 5:10 pm

So I have a quest with 10 aliases for tracking actors.
These aliases are set to fill Type: "Unique Actor" [None] (I want them to initialize to none...not entirely sure of the best way to do it)

I then have a scripted spell for the purposes of forcing these aliases.

The Script:
Spoiler
ReferenceAlias property ZombieAlias1 autoReferenceAlias property ZombieAlias2 autoReferenceAlias property ZombieAlias3 autoReferenceAlias property ZombieAlias4 autoReferenceAlias property ZombieAlias5 autoReferenceAlias property ZombieAlias6 autoReferenceAlias property ZombieAlias7 autoReferenceAlias property ZombieAlias8 autoReferenceAlias property ZombieAlias9 autoReferenceAlias property ZombieAlias10 autoSpell property csdconjReanimateSingle autoGlobalVariable property csdDecayLimit autoFaction property csdconjDecayFaction autoBool ZombieOpenEvent OnEffectStart(Actor akTarget, Actor akCaster)    if akTarget.GetFactionRank(csdconjDecayFaction) >= (csdDecayLimit.GetValue() as int)            Debug.Notification("That corpse is too decayed to be of use.")        Return            endif    if ZombieAlias1 == none || ZombieAlias2 == none || ZombieAlias3 == none || ZombieAlias4 == none || ZombieAlias5 == none || ZombieAlias6 == none || ZombieAlias7 == none || ZombieAlias8 == none || ZombieAlias9 == none || ZombieAlias10 == none            ZombieOpen = True            endif        if ZombieOpen                csdconjReanimateSingle.Cast(akCaster, akTarget)                else                Debug.Notification("You are unable to control any more zombies.")        endif    EndEvent

The Problem: ZombieOpen is never true. The quest is started, I can check its stage. Why aren't any of my aliases == none?
User avatar
Katie Louise Ingram
 
Posts: 3437
Joined: Sat Nov 18, 2006 2:10 am

Post » Sun Jun 24, 2012 12:36 pm

You may want to try ZombieAlias1.GetRef() or perhaps ZombieAlias1.GetActorRef() ...and so forth for the other aliases.

I suspect what you're doing now is testing whether the aliases exist, while the above will test whether they are filled.
User avatar
Reven Lord
 
Posts: 3452
Joined: Mon May 21, 2007 9:56 pm

Post » Sun Jun 24, 2012 7:13 am

Is the "Optional" flag ticked? If so, you can Alias.Clear() 'em and you'll get NONE.

Edit: Nevermind about 'Return'. Not sure where I'd seen it happen, but I seem to recall subsequent code running at one time or another with it used in an event. Might have had a lysdexic moment though.
User avatar
Heather Dawson
 
Posts: 3348
Joined: Sun Oct 15, 2006 4:14 pm

Post » Sun Jun 24, 2012 4:52 pm

As DreamKing said, here's a code snippet I use with GetActorRef():

If Follower     actor myFollower =  Follower.GetActorRef()     If myFollower && myFollower.GetActorValue("WaitingForPlayer") == 0    AddPassenger(myFollower,driverObject, cartOjbect, 2)	   EndIfEndIf

As you see from my code, I am using it as a boolean, I'm not comparing it to none. Otherwise, if you are still having problems, where is the code that is filling the aliases? (Just a thought, and not a solution, but have you considered just tracking the number of zombies being controlled? You'd still have to find an open alias, but at least that check would only happen once. The way you are using the faction rank to allow older bodies to be used it cool. Having a variable tracking the zombies in control would make increasing the limit easier as the player advances, plus it would make the comparisions more effecient, but at the trade-off of having to keep that variable in synch.)
User avatar
David Chambers
 
Posts: 3333
Joined: Fri May 18, 2007 4:30 am

Post » Sun Jun 24, 2012 10:43 am

Is the "Optional" flag ticked? If so, you can Alias.Clear() 'em and you'll get NONE.

JustinOther, if I understood it correctly (and I may certainly not ;)), I think his problem is that they are NEVER none, they are all comparing as filled.
User avatar
matt
 
Posts: 3267
Joined: Wed May 30, 2007 10:17 am

Post » Sun Jun 24, 2012 6:37 pm

Make the aliases the "Specific Reference" archetype with the "Optional" flag ticked and all should work out.

GlobalVariable Property csdDecayLimit AutoFaction Property csdconjDecayFaction AutoReferenceAlias[] Property ZombieAliasArray Auto ; Add ten NONE elementsSpell Property csdconjReanimateSingle AutoEvent OnEffectStart(Actor akTarget, Actor akCaster)	If akTarget.GetFactionRank(csdconjDecayFaction) >= (csdDecayLimit.GetValue() as int)		Debug.Notification("That corpse is too decayed to be of use.")	ElseIf bZombieOpen()		csdconjReanimateSingle.Cast(akCaster, akTarget)		Else		Debug.Notification("You are unable to control any more zombies.")	EndIfEndEventBool Function bZombieOpen(Int aiIndex = 0, ReferenceAlias arZombie  = None)	aiIndex = ZombieAliasArray.Length	While aiIndex > 0		aiIndex -= 1		If !ZombieAliasArray[aiIndex]			Return True		EndIf	EndWhile	Return FalseEndFunction
Also, just a thought, but you could use a ReferenceAlias array.
User avatar
Chloe Mayo
 
Posts: 3404
Joined: Wed Jun 21, 2006 11:59 pm

Post » Sun Jun 24, 2012 3:30 am

Also, just a thought, but you could use a ReferenceAlias array.

That's a great suggestion!!
User avatar
megan gleeson
 
Posts: 3493
Joined: Wed Feb 07, 2007 2:01 pm

Post » Sun Jun 24, 2012 4:06 am

That's a great suggestion!!
Thanks :) There's something satisfying about using reference aliases in an array property and churning 'em through a while loop with a custom function. Yay, Papyrus!

Oh: A FormList might be preferable as they'll not accept NONE. Then the zombies could be grabbed directly and the ZombieOpen could be taken care of with 'If ZombieFLST.GetSize() < 10'. FormLists won't accept ReferenceAliases, IIRC, only their actual references.
User avatar
Lisha Boo
 
Posts: 3378
Joined: Fri Aug 18, 2006 2:56 pm

Post » Sun Jun 24, 2012 7:59 am

Thanks :smile: There's something satisfying about using reference aliases in an array property and churning 'em through a while loop with a custom function. Yay, Papyrus!

Oh: A FormList might be preferable as they'll not accept NONE.
I agree! It's something I almost don't even associate with Papyrus (but I'm sure that's cuz I'm used to programming languages rather than scripts, which is unfair to Papyrus.) I did some work with the LinkedRefs and was quite pleased at what Papyrus could do.

I thought yourexample looked very functional. The one thing I was thinking though, if I were using it myself, is I would have your bZombieOpen return the alias index instead of a bool, so he could then fill the alias without having to do another search. (and then change the comparision.) In his example, he's not filling the alias, but I'm guessing the code was simplieifed, because he has to fill it somewhere.
User avatar
Taylor Bakos
 
Posts: 3408
Joined: Mon Jan 15, 2007 12:05 am

Post » Sun Jun 24, 2012 10:26 am

I figured the spell was doing the alias filling?
User avatar
RAww DInsaww
 
Posts: 3439
Joined: Sun Feb 25, 2007 5:47 pm

Post » Sun Jun 24, 2012 11:10 am

As DreamKing said, here's a code snippet I use with GetActorRef():

If Follower    actor myFollower =  Follower.GetActorRef()    If myFollower && myFollower.GetActorValue("WaitingForPlayer") == 0	AddPassenger(myFollower,driverObject, cartOjbect, 2)	  EndIfEndIf

As you see from my code, I am using it as a boolean, I'm not comparing it to none.

I had originally tried that. I was doing
if !ZombieAlias1 || !ZombieAlias2 || etc. ;! because I need at least 1 empty alias to force into
that gave the same results as comparing to none

(Just a thought, and not a solution, but have you considered just tracking the number of zombies being controlled? You'd still have to find an open alias, but at least that check would only happen once. The way you are using the faction rank to allow older bodies to be used it cool. Having a variable tracking the zombies in control would make increasing the limit easier as the player advances, plus it would make the comparisions more effecient, but at the trade-off of having to keep that variable in synch.)

before I knew how useful aliases were, I had this whole thing set up using Actor and Global variables in a quest script. Half of it worked like crap but it still worked. Then, I did some digging around about aliases and decided to rebuild the mod. Assuming I can get this ironed out, it will be far more elegant (even if its less efficient in some aspects).

JustinOther, if I understood it correctly (and I may certainly not :wink:), I think his problem is that they are NEVER none, they are all comparing as filled.
^^^ yes
they're either claiming to be filled or just not existing at all some how. On every cast I get the bottom debug message

Make the aliases the "Specific Reference" archetype with the "Optional" flag ticked and all should work out.

I'll give that a try

You may want to try ZombieAlias1.GetRef() or perhaps ZombieAlias1.GetActorRef() ...and so forth for the other aliases. I suspect what you're doing now is testing whether the aliases exist, while the above will test whether they are filled.

also sounds like something I should try

I figured the spell was doing the alias filling?

Yeah, looks like I missed the top line of my script in the copy/paste...this is on a scripted spell that fires a second scripted spell (if there are open aliases...). The second spell does the filling. This setup is the only way what I'm trying to do will work because the Reanimate archetype is trash.
User avatar
Beat freak
 
Posts: 3403
Joined: Thu Dec 14, 2006 6:04 am

Post » Sun Jun 24, 2012 4:41 am

You may want to try ZombieAlias1.GetRef() or perhaps ZombieAlias1.GetActorRef() ...and so forth for the other aliases. I suspect what you're doing now is testing whether the aliases exist, while the above will test whether they are filled.

Huzzah! This was the solution. Just had to copy/paste a bunch of .GetActorReference() into a few scripts and bingo!

Also, just a thought, but you could use a ReferenceAlias array.
Baby steps, man, baby steps XD
User avatar
Anna Watts
 
Posts: 3476
Joined: Sat Jun 17, 2006 8:31 pm

Post » Sun Jun 24, 2012 10:27 am

Huzzah! This was the solution. Just had to copy/paste a bunch of .GetActorReference() into a few scripts and bingo!


Baby steps, man, baby steps XD

Glad you got it working!

I really suggest you give JustinOther's code a try - he did all the work there with his example. And the really nice thing is, by using the array, it is much easier to expand it!

So where I made the comment about adding more zombies as the player levels up, it would be very easy just by increasing the array limit!

And if you don't know, just a quick explanation: instead of typing ZombieAlias1, you would use it as ZombieAlias[0] (0 being the first element). If you want more of an explanation, just ask.
User avatar
liz barnes
 
Posts: 3387
Joined: Tue Oct 31, 2006 4:10 am

Post » Sun Jun 24, 2012 4:26 am

looking through the wiki page now

they do sound terribly useful for things and stuff but I don't want to have to go back through all my scripts and set all those properties again :( as setting up an array property sounds like it takes about as much work as setting up all those individual properties took. Had this been suggested before I set up all my properties...

will make a mental note though: Arrays - need to use in future scripts
User avatar
Samantha Pattison
 
Posts: 3407
Joined: Sat Oct 28, 2006 8:19 pm


Return to V - Skyrim