Trying to figure why GetInFaction works, while GetRelationsh

Post » Tue Jan 01, 2013 5:03 am

Basically I'm trying to revive my Hotkey mod, which actually does work with OnKeyDown and OnKeyUp events granted to us by SKSE without any serious ressource hit. IsKeyPressed was horrible to be used in this manner. For now I pretty much restored anything that the mod previously had to offer + some extras. The problem is now with the follower hotkey section, where...

Function FollowerTrade()	Actor akActor = FollowerAlias.GetActorRef() as Actor	If akActor.IsInFaction(CurrentFollowerFaction) && PlayerREF.GetDistance(akActor) == 500		akActor.OpenInventory()	EndIfEndFunction

...put on the FollowerAlias in DialogueFollower quest, does work, and...

Function FollowerTrade()	Actor akActor = FollowerAlias.GetActorRef() as Actor	;If akActor.IsInFaction(CurrentFollowerFaction) && PlayerREF.GetDistance(akActor) == 500	 If akActor.GetRelationshipRank(PlayerREF) >= 3 && PlayerREF.GetDistance(akActor) == 500		akActor.OpenInventory()	EndIfEndFunction


...put on a custom FollowerAlias in my own quest set to 'Finding matching reference near PlayerAlias', does not work. Any ideas?
User avatar
Kieren Thomson
 
Posts: 3454
Joined: Sat Jul 21, 2007 3:28 am

Post » Tue Jan 01, 2013 6:02 am

Function FollowerTrade()		Actor kActor = FollowerAlias.(GetReference() as Actor) as Actor		If kActor.IsInFaction(CurrentFollowerFaction) && PlayerREF.GetDistance(kActor) <= 500				kActor.OpenInventory()		EndIfEndFunction

Function FollowerTrade()		Actor kActor = FollowerAlias.(GetReference() as Actor) as Actor		If kActor.IsInFaction(CurrentFollowerFaction) && PlayerREF.GetDistance(kActor) <= 500		 If kActor.GetRelationshipRank(PlayerREF) >= 3 && PlayerREF.GetDistance(kActor) <= 500				kActor.OpenInventory()		EndIf	EndifEndFunction

Try this?

It might be you're comparing with == which means exactly.

I've also cleaned up your code a bit, and fixed the first if statement in the second code.
User avatar
Sammi Jones
 
Posts: 3407
Joined: Thu Nov 23, 2006 7:59 am

Post » Tue Jan 01, 2013 2:46 am

Function FollowerTrade()		Actor kActor = FollowerAlias.(GetReference() as Actor) as Actor		If kActor.IsInFaction(CurrentFollowerFaction) && PlayerREF.GetDistance(kActor) <= 500				kActor.OpenInventory()		EndIfEndFunction

Function FollowerTrade()		Actor kActor = FollowerAlias.(GetReference() as Actor) as Actor		If kActor.IsInFaction(CurrentFollowerFaction) && PlayerREF.GetDistance(kActor) <= 500		 If kActor.GetRelationshipRank(PlayerREF) >= 3 && PlayerREF.GetDistance(kActor) <= 500				kActor.OpenInventory()		EndIf	EndifEndFunction

Try this?

It might be you're comparing with == which means exactly.

I've also cleaned up your code a bit, and fixed the first if statement in the second code.

No, that's just the forums messing things up, the code is <=.
User avatar
Eoh
 
Posts: 3378
Joined: Sun Mar 18, 2007 6:03 pm

Post » Tue Jan 01, 2013 12:55 pm



No, that's just the forums messing things up, the code is <=.

You also had a semi colon before your code line, making it redundant, an would have been 1 endif too short if not.

Does my code not work?
User avatar
Mylizards Dot com
 
Posts: 3379
Joined: Fri May 04, 2007 1:59 pm

Post » Tue Jan 01, 2013 8:31 am

You also had a semi colon before your code line, making it redundant, an would have been 1 endif too short if not.

Does my code not work?

There's a semicolon because I outcommended the first code line. I either try getting this to work with IsInFaction or GetRelationshipRank, not booth.

And your code is exactly the one I'm using - the first code line.
User avatar
Alyce Argabright
 
Posts: 3403
Joined: Mon Aug 20, 2007 8:11 pm

Post » Tue Jan 01, 2013 4:16 pm

I assume you've tested this.

PlayerREF.GetRelationshipRank( kActor ) >= 3
User avatar
Gavin Roberts
 
Posts: 3335
Joined: Fri Jun 08, 2007 8:14 pm

Post » Tue Jan 01, 2013 6:34 am

I assume you've tested this.

PlayerREF.GetRelationshipRank( kActor ) >= 3

Nope, doesn't work either. I'm afraid it is related to the custom FollowerAlias in my quest. If I use GetRelationshipRank on the standard FollowerAlias of DialogueFollower Quest it is working perfectly.

The problem is, I want to get this working with Ultimate Follower Overhauls multiple follower support. I'm trying to hotkey command the follower that's closest to me. I did get it working in the past, but the code was instable and ressource consumptive. Unfortunately UFO only uses the first follower on the Vanilla CurrentFollowerFaction. I probably will have to make a patch to get it working together.

I've also tried GetFactionRank on the PotentialFollowerFaction, since all followers are set to 0 inside PotentialFollowerFaction when following the player, even in UFO. It doesn't matter though which faction I'm trying because it will always hang on the Vanilla FollowerAlias as long as I don't get my own alias filled. And I don't have the slightest clue why the closest NPC that has a relationshiprank 3 with me doesn't work? I've tried multiple configurations to no avail.

Would it be possible to create a formlist and put the followers into this form list and then call upon the FL with the relationshiprank? Anybody has experience with actors insdie formlists?
User avatar
Chelsea Head
 
Posts: 3433
Joined: Thu Mar 08, 2007 6:38 am

Post » Tue Jan 01, 2013 3:49 pm

Hah, got it working. Found some old code by JustinOther. I wasn't able to understand what he was trying to tell me a year ago...but now I do. Basically this code does what it should. I'm just using an AlliasArray and put all the single followeralliases into the array...bingo...:D

ReferenceAlias[] Property AliasArray AutoFunction DoSomethingToAliases(Int aiIndex = 44)        While (aiIndex > 0)                aiIndex -= 1 ; Starts with #43                AliasArray[aiIndex].GetActorReference().DoSomething()        EndWhileEndFunction
User avatar
des lynam
 
Posts: 3444
Joined: Thu Jul 19, 2007 4:07 pm


Return to V - Skyrim