Jump to content

CANT get my script to work


SirBeasty

Recommended Posts

I am trying to write a script for a perk mod that I am creating for werewolves. I am trying to make it so that based on who the player feeds on, certain perks will open up for them to choose.


When I compile this scrpt, I get the error: SirBeastInnocentorImmoralScript.psc(29,11): type mismatch on parameter 1 (did you forget a cast?)


As well as user flag hidden errors.


My script is below.


Scriptname SirBeastInnocentorImmoralScript extends Quest


;IDS


Float Property SirBeastFeedImmoral Auto

Float Property SirBeastFeedInnocents Auto


Quest Property SirBeastFeedingInnocentORImmoralQuest Auto

Quest Property CompanionsTrackingQuest auto


Faction Property CrimeFactionEastmarch Auto

Faction Property CrimeFactionFalkreath Auto

Faction Property CrimeFactionHaafinger Auto

Faction Property CrimeFactionHjaalmarch Auto

Faction Property CrimeFactionImperial Auto

Faction Property CrimeFactionKhajiitCaravans Auto

Faction Property CrimeFactionOrcs Auto

Faction Property CrimeFactionPale Auto

Faction Property CrimeFactionReach Auto

Faction Property CrimeFactionRift Auto

Faction Property CrimeFactionSons Auto

Faction Property CrimeFactionWhiterun Auto

Faction Property CrimeFactionWinterhold Auto


;Code


Function Feed(Actor victim)


If victim.IsInFaction(CrimeFactionEastmarch || CrimeFactionFalkreath || CrimeFactionHaafinger || CrimeFactionHjaalmarch || CrimeFactionKhajiitCaravans || CrimeFactionOrcs || CrimeFactionPale || CrimeFactionReach || CrimeFactionRift || CrimeFactionSons || CrimeFactionWhiterun || CrimeFactionWinterhold)

SirBeastFeedImmoral = SirBeastFeedImmoral + 1

Else

SirBeastFeedInnocents = SirBeastFeedInnocents + 1

EndIf


EndFunction

Link to comment
Share on other sites

That error is telling you that you have set up the first parameter for the function call IsInFaction on line number 29 incorrectly.

 

What you've done wrong is that you've used the function call once and tried setting up a series of ORs for the different factions. Unfortunately that is not how it works. You'll need to repeat the function call for each faction. I.E.

If victim.IsInFaction(CrimeFactionEastmarch) || victim.IsInFaction(CrimeFactionFalkreath) || victim.IsInFaction(CrimeFactionHaafinger) || victim.IsInFaction(CrimeFactionHjaalmarch) || victim.IsInFaction(CrimeFactionKhajiitCaravans) || victim.IsInFaction(CrimeFactionOrcs) || victim.IsInFaction(CrimeFactionPale) || victim.IsInFaction(CrimeFactionReach) || victim.IsInFaction(CrimeFactionRift) || victim.IsInFaction(CrimeFactionSons) || victim.IsInFaction(CrimeFactionWhiterun) || victim.IsInFaction(CrimeFactionWinterhold)

However, that makes for a long single line that wraps like crazy. You can make it a bit more readable by using \ . Basically it tells Papyrus to treat the next line as part of the current line. I.E.

If victim.IsInFaction(CrimeFactionEastmarch) \
	|| victim.IsInFaction(CrimeFactionFalkreath) \
	|| victim.IsInFaction(CrimeFactionHaafinger) \
	|| victim.IsInFaction(CrimeFactionHjaalmarch) \
	|| victim.IsInFaction(CrimeFactionKhajiitCaravans) \
	|| victim.IsInFaction(CrimeFactionOrcs) \
	|| victim.IsInFaction(CrimeFactionPale) \
	|| victim.IsInFaction(CrimeFactionReach) \
	|| victim.IsInFaction(CrimeFactionRift) \
	|| victim.IsInFaction(CrimeFactionSons) \
	|| victim.IsInFaction(CrimeFactionWhiterun) \
	|| victim.IsInFaction(CrimeFactionWinterhold)

Furthermore,

SirBeastFeedImmoral = SirBeastFeedImmoral + 1

can be shortened to

SirBeastFeedImmoral += 1
Link to comment
Share on other sites

  • 2 weeks later...
  • Recently Browsing   0 members

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