Jump to content

Recommended Posts

Posted

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...

Posted

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.

Posted

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.

Posted

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.

Posted

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

 



Posted

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.

Posted

GetCurrentCrosshairRef is a Game function and GetLevel works on Actors so you'll want:

int targetLevel = (Game.GetCurrentCrosshairRef() as Actor).GetLevel()

But yes, you're on the right track this time.

Posted

Yes, that would work, assuming you use SKSE. I suggest making sure that the cast actor has a level >0, as a GetLevel() of 0 means that it isn't an actor.

Posted

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.

  • Recently Browsing   0 members

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