Jump to content

Get player detection level?


PrincessBridget

Recommended Posts

The variables are all stuck at 0 at all times it seems...I'm testing by being hidden at first, then running up to an enemy. I tried unchecking all other mods just in case it was that, but no difference. Well here's the code. I guess I'll upload the file too...

 

http://www.mediafire.com/download.php?kks1hysr8xmedar

 

scn aaMyDetectionScript


Short Depth
Short DLevel
Short MaxDLevel
Ref rCurRef


Begin GameMode
       Set MaxDLevel to 0                                      ;reset the maximum detection level to 0
       Set Depth to 2 * (player.IsInInterior ==0)              ;Assign Cell Depth
       set rCurRef to GetFirstRef 200 Depth 0                  ;Search for all Actors
       Label 10                                                ;Loop Start
       if rCurRef                                              ;Is it a valid reference?
		printc "DLevel = %.0f MaxDLevel = %.0f rCurRef = %.0f" DLevel MaxDLevel rCurRef
               Set DLevel to rCurRef.GetDetectionLevel Player  ;Determine DLevel for this ref to the player
               If DLevel > MaxDLevel                           ;Is it the highest DLevel found so far
                       Set MaxDLevel to DLevel                 ;Yes, set the new max DLevel
               Endif
               Set rCurRef to Apple                            ;Prevent the "Apple" bug
               Set rCurRef to GetNextRef                       ;Cycle to the next reference
               Goto 10                                         ;Goto Label to cycle the code again
       Endif                                                   ;Loop will end when no more references are found
       If MaxDLevel == 3
              ;Playsound aaDetectSound3 ;Player is Seen: Flashing Danger
       ElseIf MaxDlevel == 2
              ;Playsound aaDetectSound3 ;Player is Noticed: Danger
       ElseIf MaxDLevel == 1
               ;Player is Unseen: Caution
       Else 
               ;Player is Lost: Unseen
       Endif

End

Link to comment
Share on other sites

Good news / Bad news

 

Good News:

You would need to place the printc command after all the DLevel and MaxDLevel calculations to get any valid results. When passing ref variables, %.0f won't work. That is for float/short variables and the number in front of the 'f' indicates how many decimal places to show. So the "0" tells it to display no decimal values or another words, display whole numbers. To get a ref variable to show up, you need to use "%i" to display the ID of the ref or "%n" to display the name of the ref. I used this:

 

printc "DLevel = %.3f MaxDLevel = %.3f rCurRef = %n %i" DLevel MaxDLevel rCurRef rCurRef

 

I placed this directly above the "Set rCurRef to Apple" statement. I also changed the DLevel and MaxDLevel variables from Short to Float, just to be sure - which is why the formatting code changed from %.0f to %.3f.

 

Bad News:

The GetDetectionLevel command appears to be broken. I found a couple of old threads that mention this and it sure looks broken to me in testing. I apologize for not knowing this ahead of time, but I had never used that command before. I have asked around to see if anybody knows how to achieve what you're after another way though. Give me a day or two and I'll report back what, if anything, I find.

Link to comment
Share on other sites

Unfortunately, None of my friends have any ideas either on how to accomplish what you want outside of the broken GetDetectionLevel command. About all we could come up with is an all or nothing sort of thing - detected or not detected, but no levels. I don't have any other solutions for you at this point. I am sorry.
Link to comment
Share on other sites

Aww, well thanks for trying! I definitely learned a few things, and maybe I'll still be able to use the ref-walk for other stuff. Hmm, I guess the next best idea is showing the [HIDDEN] etc at all times, instead of only when sneaking. I made a thread about it before I had this detection level idea, but welll it didn't really seem to get an answer.

 

By the way, is it possible to edit a mod while the game's open? I guess you missed that question up there in my half-rant.

 

And here's the thread: http://www.thenexusforums.com/index.php?app=forums&module=forums&section=findpost&pid=1955394

Link to comment
Share on other sites

I don't edit my mods while the game is open. Certainly if you make a change to the mod while its being used by the game, something could go wrong. But I have never tried that. You can keep the Geck open while you play the game though. I'll check out you link now and see if I can help you out there.

 

Edit: No, I don't know the answer to your sneaking question. There may be something that could be done about it by tweaking the menu / Hud code. But I do not even know what language that stuff is written in.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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