Jump to content

Trouble with Calling Function


tome326

Recommended Posts

Hi all,
I am fairly new to Papyrus as a language and seem to have run into an error I can't fix on my own.

I am trying to make it possible to recruit new members to the Dark Brotherhood the same way that you can for the Blades(I.E bring a follower there and tell them to join)

For the most part, the code is a copy of what Bethesda has to make it work for the blades:

ScriptName aaDBRecruitmentScript extends Quest Conditional

Int Property AssassinCount Auto Conditional
ReferenceAlias Property Assassin01 Auto 
ReferenceAlias Property Assassin02 Auto 
ReferenceAlias Property Assassin03 Auto
ReferenceAlias Property Assassin04 Auto 
Outfit Property DBArmorWithHood Auto
Faction Property PotentialFollowerFaction Auto
Faction Property DarkBrotherhoodFaction Auto
Weapon Property EbonyDagger Auto
LeveledItem Property LItemBanditWeaponMissile Auto

DialogueFollowerScript Property DialogueFollower Auto

Function RecruitAssassin (Actor RecruitREF)

	Debug.Trace("Assassin Recruited")
	If (AssassinCount == 0)
		Debug.Trace("Assassin Moving to Sanctuary")
		Assassin01.ForceRefTo(RecruitREF)
		DialogueFollower.DismissFollower(0, 0)
		AssassinCount = 1
		SetStage(20)
	ElseIf (AssassinCount == 1)
		Assassin02.ForceRefTo(RecruitREF)
		DialogueFollower.DismissFollower(0, 0)
		AssassinCount = 2
		SetStage(30)
	ElseIf (AssassinCount == 2)
		Assassin03.ForceRefTo(RecruitREF)
		DialogueFollower.DismissFollower(0, 0)
		AssassinCount = 3
		SetStage(40)
	ElseIf (AssassinCount == 3)
		Assassin04.ForceRefTo(RecruitREF)
		DialogueFollower.DismissFollower(0, 0)
		AssassinCount = 4
		SetStage(50)
	EndIf

EndFunction

Function EquipAssassin (Actor RecruitREF)

	RecruitREF.AddtoFaction(DarkBrotherhoodFaction)
	RecruitREF.SetOutfit(DBArmorWithHood)
	RecruitREF.AddItem(EbonyDagger)
	RecruitREF.EquipItem(EbonyDagger)
	RecruitREF.AddItem(LItemBanditWeaponMissile)

EndFunction

I have a line that runs when a quest stage is set:

aaRDBRecruitQuestA.RecruitAssassin(Alias_Follower.GetActorRef() as Actor)

Everything will compile, however, won't work in game. The script log gave me this error:

[11/03/2016 - 09:50:31PM] error: Cannot call RecruitAssassin() on a None object, aborting function call
stack:
[DialogueFollower (000750BA)].QF_DialogueFollower_000750BA.Fragment_17() - "QF_DialogueFollower_000750BA.psc" Line 55

I setup a trace to see what the Follower Alias is set to when it runs, as that is what is what RecruitAssassin is supposed to run on, and that came up as:

[11/03/2016 - 09:50:31PM] Stage Set, Recruit Alias set to [Actor < (000B9986)>]


I have no clue why it is saying that it is trying to run on a None, when it is in fact set to an actor ref.

Any help anyone can provide would be greatly appreciated.

Thanks

Link to comment
Share on other sites

Possible fix.

 

Change GetActorRef() as Actor to GetReference() as Actor.

 

Reason for this is that GetActorRef is just a short cut for GetReference() as Actor

 

(It's literally calling GetReference() twice and then casting to actor.)

 

You're doing something that compiler can't understand(casting an already casted to actor function to actor).

Edited by EveningTide
Link to comment
Share on other sites

I can only think of is the quest some how not running, or it stops before the function is called.

I'm going to take a guess and assume that somehow the alias is clearing itself.

You can do a check within the function to see if it's empty before filling.

 

if Assassin01.GetReference() == none

; fill

 

Edited by EveningTide
Link to comment
Share on other sites

That also didn't work :sad:

 

It appears as though I have been reading the error message wrong. :verymad:

The quest aaRDBRecruitQuestA is for, what ever reason, begin run as a none object. I set up another trace, this time to check the value of the quest property, as well as one that is set to a quest that I know is not set to none, the result being:

[11/04/2016 - 04:52:34PM] Stage Set, Recruit Alias set to [Actor < (000B9986)>]Quest Object set to None
[11/04/2016 - 04:52:34PM] Skyhaven Quest Object set to [FreeformSkyHavenTempleAScript <FreeformSkyhavenTempleA (000E38C9)>]

I have the property of the quest setup the exact same way as the skyhaven property is setup. Again, I have no idea why it is set to none.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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