Jump to content

Same function returns different values when called from different quest scripts?


Recommended Posts

Posted

I added some if conditionals to a quest script that checks if the pc has a certain perk, but it wouldnt work so i made another quest with these functions:

Spoiler

function checkperk1()
if (game.getplayer().hasperk(testperk))
debug.messagebox("yes")
else
debug.messagebox("no")
endif
EndFunction

function checkperk2()
if (playerref.hasperk(testperk))
debug.messagebox("yes")
else
debug.messagebox("no")
endif
EndFunction

they worked, correctly returned yes, however when i added and called them from the original quest they both returned false.

Posted
1 hour ago, g0hahi said:

function checkperk1()
if (game.getplayer().hasperk(testperk))
debug.messagebox("yes")
else
debug.messagebox("no")
endif
EndFunction

function checkperk2()
if (playerref.hasperk(testperk))
debug.messagebox("yes")
else
debug.messagebox("no")
endif
EndFunction

 

Where is the definition of testperk and playerref?

Have you defined the Properties?

Have you filled it in Creation Kit?

Have you take a look to your Papyrus0.log to try find yours errors?

Posted
2 hours ago, g0hahi said:

however when i added and called them from the original quest they both returned false

 

When a quest runs, it saves a version of the original script.  You may need to stop the quest, wait a second, and restart it for the new properties to be recognized.

Posted
9 hours ago, alex77r4 said:

 

Where is the definition of testperk and playerref?

Have you defined the Properties?

Have you filled it in Creation Kit?

Have you take a look to your Papyrus0.log to try find yours errors?

I've defined the properties, and filled them in ck, i just forgot to paste them, mb. The log gives me a bunch of "cannot call x function to a none object" errors

Posted
20 minutes ago, g0hahi said:

I've defined the properties, and filled them in ck, i just forgot to paste them, mb. The log gives me a bunch of "cannot call x function to a none object" errors

That mean the properties are not correctly defined or linked. Or as Seijin8 say, you have trash inside the savegame. Try cleaning the savegame or starting a New Game.

 

You can add more code to try discover what is happening:

function checkperk2()

If testperk == None

debug.messagebox("testperk is NONE and the next verifications go to fail")

endif

If playerref == None

debug.messagebox("playerref is NONE and we can't call hasperk over NONE")

endif

if (playerref.hasperk(testperk))
debug.messagebox("yes")
else
debug.messagebox("no")
endif
EndFunction

Posted
8 minutes ago, alex77r4 said:

That mean the properties are not correctly defined or linked. Or as Seijin8 say, you have trash inside the savegame. Try cleaning the savegame or starting a New Game.

 

You can add more code to try discover what is happening:

function checkperk2()

If testperk == None

debug.messagebox("testperk is NONE and the next verifications go to fail")

endif

If playerref == None

debug.messagebox("playerref is NONE and we can't call hasperk over NONE")

endif

if (playerref.hasperk(testperk))
debug.messagebox("yes")
else
debug.messagebox("no")
endif
EndFunction

thanks, i fixed it meanwhile. the quest wasnt in my plugin fml

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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