Jump to content

Alias Values and Evaluating Statements


kxdace

Recommended Posts

Posted

So I created a quest with two aliases.

The player talks to the first NPC and asks them to join them. If the first alias has no value (default value NONE) it places the  NPC in that alias. If the 1st alias is filled it places them in the second one:

Scriptname TIF__071AA6A4 Extends TopicInfo Hidden

Function Fragment_1(ObjectReference akSpeakerRef)

       Actor akSpeaker = akSpeakerRef as Actor

       Debug.Notification("")

       akSpeaker.AddToFaction(fFaction)

       If Alias_Holder01.GetActorReference() == None

             Alias_Holder01.ForceRefTo(akSpeaker)

             Debug.Notification("Option 1")

       else

             Alias_Holder02.ForceRefTo(akSpeaker)

             Debug.Notification("Option 2")

       EndIf

       akSpeaker.SetPlayerTeammate()

EndFunction

       Faction Property fFaction  Auto 

       ReferenceAlias Property  Alias_Holder01 Auto

       ReferenceAlias Property  Alias_Holder02 Auto

 

I have no issues with this part f the code. Then comes the second part:

I make it so that if there is a value in Alias 1 but not in Alias 2  you play a 2 person sex lab animation.

(Alias_TrainHolder01 != None && Alias_TrainHolder02 != None)

The second if statement is supposed to be if both Alias have a value then sexlab will play a 3 person animation.

elseIf(Alias_TrainHolder01 != None && Alias_TrainHolder02 != None)

Whatever option is selected both quest alias's are cleared out and reset to default so I can chose new actors:

Alias_TrainHolder01.Clear()

Alias_TrainHolder02.Clear()

This works fine the first time I speak to one NPC (plays 2 person animation) and it works when I speak to two NPCS (plays 3 person animation). However when I try it again with just one NPC the elseIf statement keeps being executed dispute there being no one assigned to Alias 2 (Alias.clear() should have seen to that). Sexlab tries to play the animation with three people but fails because only the 1st NPC and the player are selected and the code is expecting 3.

Please look at the code and let me know where I fucked up.

Scriptname TIF__071AA6A9 Extends TopicInfo Hidden

Function Fragment_0(ObjectReference akSpeakerRef)

                Actor akSpeaker = akSpeakerRef as Actor

                Debug.Notification("")

                if(Alias_TrainHolder01 != None && Alias_TrainHolder02 != None)

                                actor[] sexActors = new actor[2]

                                sexActors[0] = actI

                                sexActors[1] = SexLab.PlayerRef

                                sslBaseAnimation[] anims

                                SexLab.StartSex(sexActors, anims)

                                actI.SetPlayerTeammate(false)

                                actI.RemoveFromFaction(fFaction)

                                Alias_TrainHolder01.Clear()

                                ;Alias_TrainHolder01.ForceRefTo(None) - tried this to clear out values but failed

                                ;Alias_TrainHolder02.ForceRefTo(None) - tried this to clear out values but failed

                                ;ResetQuest.reset() - tried this to clear out values but failed

 

                elseIf(Alias_TrainHolder01 != None && Alias_TrainHolder02 != None)

                                Actor actI = Alias_TrainHolder01.GetActorReference()

                                Actor actII = Alias_TrainHolder02.GetActorReference()

                                ;Debug.Notification("Option 2B")

                                actor[] sexActors = new actor[3]

                                sexActors[0] = actI

                                sexActors[1] = actII

                                sexActors[2] = SexLab.PlayerRef

                                sslBaseAnimation[] anims

                                SexLab.StartSex(sexActors, anims)

                                actI.SetPlayerTeammate(false)

                                actII.SetPlayerTeammate(false)

                                actI.RemoveFromFaction(fFaction)

                                actII.RemoveFromFaction(fFaction)

                                Alias_TrainHolder01.Clear()

                                Alias_TrainHolder02.Clear()

                                ;Alias_TrainHolder01.ForceRefTo(None)

                                ;Alias_TrainHolder02.ForceRefTo(None)

                                ; ResetQuest.reset()

                else

                                                                Debug.Notification("No valid options")

                endIf

EndFunction

 

ReferenceAlias Property Alias_TrainHolder01 Auto

ReferenceAlias Property Alias_TrainHolder02 Auto

Faction Property fFaction  Auto 

SexLabFramework property SexLab auto

SoulGem Property newSoul  Auto 

Quest Property ResetQuest  Auto 

 

 

Posted

Your conditions matched each other, so conditional checks were probably returning randomly rather than as expected.  Try this.

 

Scriptname TIF__071AA6A9 Extends TopicInfo Hidden

Function Fragment_0(ObjectReference akSpeakerRef)
	Actor akSpeaker = akSpeakerRef as Actor
	Debug.Notification("")
	If(Alias_TrainHolder01 != None && !Alias_TrainHolder02)
		Actor[] sexActors = New Actor[2]
		sexActors[0] = actI
		sexActors[1] = SexLab.PlayerRef
		sslBaseAnimation[] anims
		SexLab.StartSex(sexActors, anims)
		actI.SetPlayerTeammate(false)
		actI.RemoveFromFaction(fFaction)
		Alias_TrainHolder01.Clear()
		Alias_TrainHolder02.Clear()
		;Alias_TrainHolder01.ForceRefTo(None) - tried this to clear out values but failed
		;Alias_TrainHolder02.ForceRefTo(None) - tried this to clear out values but failed
		;ResetQuest.Reset() - tried this to clear out values but failed
	ElseIf(Alias_TrainHolder01 != None && Alias_TrainHolder02 != None)
		Actor actI = Alias_TrainHolder01.GetActorReference()
		Actor actII = Alias_TrainHolder02.GetActorReference()
		;Debug.Notification("Option 2B")
		Actor[] sexActors = New Actor[3]
		sexActors[0] = actI
		sexActors[1] = actII
		sexActors[2] = SexLab.PlayerRef
		sslBaseAnimation[] anims
		SexLab.StartSex(sexActors, anims)
		actI.SetPlayerTeammate(false)
		actII.SetPlayerTeammate(false)
		actI.RemoveFromFaction(fFaction)
		actII.RemoveFromFaction(fFaction)
		Alias_TrainHolder01.Clear()
		Alias_TrainHolder02.Clear()
		;Alias_TrainHolder01.ForceRefTo(None)
		;Alias_TrainHolder02.ForceRefTo(None)
		;ResetQuest.Reset()
	Else
		Debug.Notification("No valid options")
	EndIf
EndFunction

ReferenceAlias Property Alias_TrainHolder01 Auto
ReferenceAlias Property Alias_TrainHolder02 Auto
Faction Property fFaction Auto 
SexLabFramework property SexLab Auto
SoulGem Property newSoul Auto 
Quest Property ResetQuest Auto 
Posted

In my minds eye I was viewing:

 

if (Alias_TrainHolder01 != None && Alias_TrainHolder02 == None)

 

elseIf (Alias_TrainHolder01 != None && Alias_TrainHolder02 != None)

 

Three hours spent chasing my own fucking tail >.<

 

All I needed was another pair of eyes... such a simple mistake how stupid of me... thank you for your help.

 

 

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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