Talk:GetFactionRank

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

I just discovered that setFactionRank and/or getFactionRank (I suspect the former) are not instant. Scenario:

In my main companion script the ondeath block does:

begin onDeath setfactionrank death 1 additem token 1 end

In the token script on that added token I test for the factionrank being <> 1 (which means another event has taken place elevating the rank to 2, normally).

The first (and maybe second) pass through the token script the getFactionRank is returning 0 consistently. When I inserted two returns in two different configuration if/then blocks to slow it down, it works perfectly.

So, the presence of a token is faster than using faction (and as a result more reliable), fwiw. Faction is slightly more dynamic in practice, but build in some frame delays.

-- DanSch. 1-21-2007
Good to know, although it would probably be worth simplifying your test and getting rid of the token to make sure there really is a delay.
Either way, using a token to mark an actor is always better than using factions, because setFactionRank affects the base object. Scruggs 02:31, 21 January 2007 (EST)
Yes, but in my case that it effects the base actor doesn't matter. Companions are unique. For some things universality is important, and factions serve that better. But, yes, it's not a solution for non-unique actors.
And I'm not sure how getting rid of the token would prove anything. The main script both added the token and set the faction in the same if block (consequtive lines, and I put the set faction first). The token script executes as can be shown by breakpoints at various locations... in fact, it did a removeMe a frame later before it detected the faction change, which was my original problem. The getfaction test returns 0 until 1-2 frames pass. I fail to see how this isn't conclusive.
In any case, MY concern here is cross script communications, and this demonstrates consideration for timing is required when using faction to transfer information.

DanSch 15:09, 21 January 2007 (EST)