Jump to content

Retrieving faction IDs via script


KingsGambit

Recommended Posts

Hi all, I'm working on something at the moment but am having some trouble with the scripting. Neither the wiki nor Google are proving very helpful here so I was hoping to pick some brains. I would love some advice with any of the following:

 

I'm basically having trouble with the GetCrimeGold function. My code is as follows:

 

Scriptname GetCrimeGoldScript extends ObjectReference  

Float PCCrimeGold
FormList property CrimeFaction auto
ObjectReference CurRef
int CurIndex
int ArrayLength

Event OnEquipped(Actor akActor)
   If (akActor == Game.GetPlayer())
		ArrayLength = CrimeFaction.GetSize()
	CurIndex = 0
	While CurIndex <= ArrayLength
		CurRef = (CrimeFaction.getat(CurIndex))
		PCCrimeGold = Game.GetPlayer().GetCrimeGold CurRef
		CurIndex += 1
	EndWhile
   EndIf
EndEvent

 

The formlist is set to CrimeFactionsList. It simply won't compile as it won't treat my property "CurRef" as a faction ID. I would greatly welcome any ideas, with my thanks in advance.

Link to comment
Share on other sites

Scriptname GetCrimeGoldScript extends ObjectReference  

Float PCCrimeGold
FormList property CrimeFaction auto
Faction CurRef
int CurIndex
int ArrayLength

Event OnEquipped(Actor akActor)
If (akActor == Game.GetPlayer())
	ArrayLength = CrimeFaction.GetSize()
	CurIndex = 0
	While CurIndex < ArrayLength
		CurRef = CrimeFaction.getat(CurIndex) as Faction
		PCCrimeGold = CurRef.GetCrimeGold()
		CurIndex += 1
	EndWhile
EndIf
EndEvent

Link to comment
Share on other sites

Scriptname GetCrimeGoldScript extends ObjectReference  

Float PCCrimeGold
FormList property CrimeFaction auto
Faction CurRef
int CurIndex
int ArrayLength

Event OnEquipped(Actor akActor)
If (akActor == Game.GetPlayer())
	ArrayLength = CrimeFaction.GetSize()
	CurIndex = 0
	While CurIndex < ArrayLength
		CurRef = CrimeFaction.getat(CurIndex) as Faction
		PCCrimeGold = CurRef.GetCrimeGold()
		CurIndex += 1
	EndWhile
EndIf
EndEvent

Thank you very much, fixed my issue with declaring the property and calling the function too :) Will calling CurRef.GetCrimeGold() return the player's crime gold toward the specified faction then? I had assumed I needed to reference the player there.
Link to comment
Share on other sites

  • Recently Browsing   0 members

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