Korodic Posted February 21, 2012 Share Posted February 21, 2012 I am making a script that adds a person to a faction when a door is opened to prevent hostility from happening too early. However Papyrus likes to make everything difficult and tell me that functions do not exist. I think this deals with the type of event I used... regardless, what do I need to do to get the same results in the simplest way possible? Scriptname NTJailBreak extends ObjectReference {If door is open and prisoner is not already in bandit faction, add him/her to bandit faction to make them hostile.} Event OnActivate(ObjectReference akActionRef) Debug.Trace("Activated by " + akActionRef) int openState = self.GetOpenState() if (openState == 1 || openState == 2 || self.GetLinkedRef() ) ; Open or opening Debug.Trace("Door is open!") if self.GetLinkedRef().IsInFaction(BanditFaction) Debug.Trace("Prisoner is in Bandit Faction... do nothing...") else self.GetLinkedRef().SetFactionRank(BanditFaction, 0) endif endIf EndEvent Faction Property BanditFaction Auto EDIT: By the way, the linked ref is a prisoner in a cell. The "self" is a door. Link to comment Share on other sites More sharing options...
PaladinRider Posted February 21, 2012 Share Posted February 21, 2012 What does the compiler say, or what function 'doesn't exist'? Link to comment Share on other sites More sharing options...
Korodic Posted February 21, 2012 Author Share Posted February 21, 2012 Starting 1 compile threads for 1 files...Compiling "NTJailBreak"...c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\NTJailBreak.psc(10,25): IsInFaction is not a function or does not existc:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\NTJailBreak.psc(13,22): SetFactionRank is not a function or does not existNo output generated for NTJailBreak, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on NTJailBreak Link to comment Share on other sites More sharing options...
PaladinRider Posted February 21, 2012 Share Posted February 21, 2012 (edited) Hmm. I can't see a problem right off. Why don't you try making an object reference for the linked ref and use that instead? And I'm not sure if it matters, but place Faction Property BanditFaction Auto before the event block (double check make sure it is still assigned, sometimes this clears it) edit: I'm almost positive you will have to make a property for the linked ref. The compiler claims the function will not exist if there's an issue with the reference that its calling. Edited February 21, 2012 by PaladinRider Link to comment Share on other sites More sharing options...
Korodic Posted February 21, 2012 Author Share Posted February 21, 2012 Yeah I thought about that! But then forgot about it on my walk back to my room (lol) I'll be sure to try that.EDIT: Same errors as before, I tried moving the declarations and used the object REF instead of the self.getlinkedref() Link to comment Share on other sites More sharing options...
ChrisT1981 Posted February 21, 2012 Share Posted February 21, 2012 Hmm I'm no expert but it seems like whatever GetLinkedRef() returns is not an actor. IsInFaction and SetFactionRank both only exist for actors so you need to make sure to call them on an actor type object. Try to call self.GetLinkedRef().GetActorRef().IsInFaction(BanditFaction). Link to comment Share on other sites More sharing options...
Korodic Posted February 21, 2012 Author Share Posted February 21, 2012 Even though the prisoners object ref's I suppose that might work... testing now, I'll edit this post in a minute once I've played around with it for a little. EDIT: So now it says GetActorRef() is not a function lol. -.- the CK needs a more specific compiler... Link to comment Share on other sites More sharing options...
PaladinRider Posted February 21, 2012 Share Posted February 21, 2012 What Chris says makes sense. just to verify and just to ask the obvious, but are the properties assigned? Link to comment Share on other sites More sharing options...
Korodic Posted February 21, 2012 Author Share Posted February 21, 2012 What Chris says makes sense. just to verify and just to ask the obvious, but are the properties assigned? Yes... the following properties are assigned (as of now):Type: faction --- BanditFaction (points to BanditFaction)Type: Actor --- Prisoner1 (points to NTPrisonerREF1)Type: Object Reference --- NTPrisonerREF1 (points to NTPrisonerREF1) Link to comment Share on other sites More sharing options...
Korodic Posted February 21, 2012 Author Share Posted February 21, 2012 I think I got it... I cant use any references such as self.getlinkedref. This sucks, because i dont want to make 2 separate scripts to do what should be 1 scripts job. My code is as follows Scriptname NTJailBreak extends ObjectReference {If door is open and prisoner is not already in bandit faction, add him/her to bandit faction to make them hostile.} Event OnActivate(ObjectReference akActionRef) Debug.Trace("Activated by " + akActionRef) int openState = self.GetOpenState() if (openState == 1 || openState == 2 || self.GetLinkedRef() ) ; Open or opening Debug.Trace("Door is open!") if Prisoner1.IsInFaction(BanditFaction) Debug.Trace("Prisoner is in Bandit Faction... do nothing...") else Prisoner1.SetFactionRank(BanditFaction, 0) endif endIf EndEvent Faction Property BanditFaction Auto ObjectReference Property NTPrisonerREF1 Auto Actor Property Prisoner1 Auto Link to comment Share on other sites More sharing options...
Recommended Posts