Jump to content

Need Help with Script to increase NPC Relationship Rank


Recommended Posts

I am having trouble getting this script to compile. It should be a simple script. I want this script to run once the player enters a triggerbox and in doing so, it increases the NPC rank to ally.

 

Here's what I have:

--------------------------------------------------------------------------------------------------

Actor Property Elkman Auto

 

Actor Property Player Auto

 

Int Property aiRank Auto

 

Event OnTriggerEnter(ObjectReference Player)

Debug.Trace(Player + " entered trigger!")

EndEvent

Function SetRelationshipRank(Actor Elkman, int aiRank) native

Elkman.SetRelationshipRank(Game.GetPlayer(), 3)

 

EndFunction

 

---------------------------------------------------------------------------------------------------------

 

I get this result instead of a successful compile.

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\zxzxzxzxelkmanscript.psc(13,6): no viable alternative at input '.'

No output generated for zxzxzxzxelkmanscript, compilation failed.

 

 

 

If there's any scripters out there who knows how to fix this problem, please respond. Thanks

Link to comment
Share on other sites

The debug output contains line numbers, so always supply the full script. I accounted for the missing header and it looked like the failure was after defining a new Function. You don't need to define the function, but just call it on an Actor like is done below on Elkman.

 

The Events are called by the engine and will set the parameters for you. In this case it assigns akActionRef to whatever entered the trigger.

It's a good idea to use the same variable names for the events as supplied. You don't need to create additional properties for them.

 

ScriptName zxzxzxzxelkmanscript extends ObjectReference

Actor Property Elkman Auto ; Set this in the CK

Int Property aiRank = 3 AutoReadOnly ; A constant we use later in the script. 3 == Allies

Event OnTriggerEnter(ObjectReference akActionRef)

 if (akActionRef != Game.GetPlayer())
   Return ; Ignore all actors except the player
 EndIf

 Debug.Trace("Player entered trigger!")
 Elkman.SetRelationshipRank(akActionRef As Actor, aiRank)

EndEvent

Link to comment
Share on other sites

Ah, Thank you! The script you provided worked like a charm. This is the second time you have come to my rescue tunaisafish! I Already gave kudos the last time. I'd give it again if I could.

 

Cheers

Link to comment
Share on other sites

  • Recently Browsing   0 members

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