Jump to content

Come laugh at the noob trying to script :)


nate12357

Recommended Posts

I"m trying to make a ring that alerts the player if the dungeon they are in is higher level than them. This is the script attached to the ring:

 

...code begins...

Scriptname NCDangerRingScript extends ObjectReference

Actor property PlayerRef auto
EncounterZone myZone = (PlayerRef.GetEncounterZone())

Event OnEquipped(Actor akActor)

if myzone.getleveledencounterzonevalue (PlayerRef.getlevel) > PlayerRef.getlevel
Debug.MessageBox("Danger!")
endif

EndEvent

---end code...

 

Won't compile at all. How many places did I completely mess up? This is my first creation kit script...

Link to comment
Share on other sites

You cannot define your EncounterZone variable myZone like that. You'll need to use a function or an event to define that variable. GetLevel() is a function and to call it, it needs the () after it. Otherwise Papyrus will think it is a variable instead. GetLeveledEncounterZoneValue does not exist as far as I can tell. Where did you get that from?

 

Those are just guesses. If you want more sure answers, you'll need to post the actual error messages from the compiler.

Link to comment
Share on other sites

You can't call functions outside of event or function definition blocks, so that "EncounterZone myZone ..." line would have to be moved inside the OnEquipped block.

 

But the real problem is that you're trying to use Fallout 4 functions in Skyrim. There are no functions dealing with encounter zones in Skyrim. Those are new for Fallout 4.

 

So unfortunately what you're trying to do isn't going to work. At least not that way.

Link to comment
Share on other sites

You would find a nearby random actor and then compare its level to the player. Or better yet have a quest that you can start which will fill an alias with the boss (highest level) actor then compare against that if one is found or a random actor if there is no boss.

Link to comment
Share on other sites

Thanks for your reply

 

I found GetLeveledEncounterZoneValue by using the skyrim console and typing "Help encounter" I noticed that it works in game. Is there another way to do this? I'm trying to find the min lvl for the dungeon a player is in. Also, here is my compile error:

 

 

Starting 1 compile threads for 1 files...
Compiling "NCDangerRingScript"...
C:\Games\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\NCDangerRingScript.psc(5,23): no viable alternative at input '('
C:\Games\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\NCDangerRingScript.psc(5,33): required (...)+ loop did not match anything at input '.'
C:\Games\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\NCDangerRingScript.psc(5,14): Unknown user flag PlayerRef
No output generated for NCDangerRingScript, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on NCDangerRingScript

 



Link to comment
Share on other sites

To get past those errors, remove the space between GetLeveledEncounterZoneValue and (. Also add () after GetLevel. You will probably find new compiler errors after taking care of those.

 

GetLeveledEncounterZoneValue may be a console command but there is no Papyrus equivalent in Skyrim.

Link to comment
Share on other sites

Would PlayerRef.GetCurrentCrosshairRef().GetLevel() produce a lvl for an enemy? I'm trying to move away from anything involving encounter zones as Skyrim doesn't do this apparently.

 

Source of function GetCurrentCrosshairRef: http://www.creationkit.com/index.php?title=GetCurrentCrosshairRef

 

 

Again, thanks to everyone that has responded :)

Link to comment
Share on other sites

Couldn't he do a ref walking script?

I don't even know if SKSE has the necessary functions to refwalk in skyrim but you would need to get the number of enemies within a certain distance. You could fill a formlist dynamically with these npc refs including their levels. then you could sort the formlist by distance from the player. alternatively you could apply some basic statistical inference, add up the levels of all the npc's and divide by the number of npcs. if player.getlevel() < (AverageNPCLevel-2) ring the bell.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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