Jump to content

Some papyrus Script usage related questions


coldloc

Recommended Posts

Posted

I have got some script questions , posted here if anyone can help. 

 

1.  on Game's Collison  toggle 

the Debug script got a toggleCollision native function to turn tcl on and off 

debug.ToggleCollisions()

is there a way to identify if current game collision is on or off ?

 

 

2. on Game's Camera manipulation

the Game  script 

ForceFirstPerson()
Forces the player camera into 1st-person.

ForceThirdPerson()
Forces the player camera into 3rd-person.

has two camera related native functions,  however it only affects on the player actor .   I would like to search api to bring the ForceFirstPerson effect on NPC Actors other than Player . 

but can not find any reference.  

 

I looked over and over,  and find  there is one FirstPerson View mod named FirstPersonCamera  had some comments written in its FirstPersonPlugin.txt file mentioning attach Camera 

[AttachIFPV]
; Attach camera to crosshair target so you can see through their eyes, you don't gain control of them
+AttachCamera

Howerver ,  with little info provided,  I do not know what apis the mod DLL file FirstPersonPlugin.dll  provides   that can be called  in papyrus script that can attach camera (First Person View on target Actor NPC). 

 

 

does anyone have any ideas on this ?

 

 

3. The varies methods and their distance on success of object selection  (cursor related)

I  aware that many behaviors are using the crosshairRef  cursor to aim the target, 

such as

1. Repositioner mod ,  use crosshairRef on target  

2.  projectile style like relaase the arrow after aiming by crosshairRef 

3.  open ~ skyrim console,  and use mouse cursor click to  select object.      

 

I would like to know their distance on sucessful selection of object instead of grab a "None" value,   and can some of these distance be altered in game ? 

 

 

 

Posted
1 hour ago, coldloc said:

I have got some script questions , posted here if anyone can help. 

 

1.  on Game's Collison  toggle 

the Debug script got a toggleCollision native function to turn tcl on and off 


debug.ToggleCollisions()

is there a way to identify if current game collision is on or off ?

Doubtful, since Skyrim never disables collisions as part of its gameplay, there would be no reason to expose the game's collision state to Papyrus.

 

1 hour ago, coldloc said:

 

2. on Game's Camera manipulation

I would like to search api to bring the ForceFirstPerson effect on NPC Actors other than Player . 

but can not find any reference.  

 

I looked over and over,  and find  there is one FirstPerson View mod named FirstPersonCamera  had some comments written in its FirstPersonPlugin.txt file mentioning attach Camera 


[AttachIFPV]
; Attach camera to crosshair target so you can see through their eyes, you don't gain control of them
+AttachCamera

Howerver ,  with little info provided,  I do not know what apis the mod DLL file FirstPersonPlugin.dll  provides   that can be called  in papyrus script that can attach camera (First Person View on target Actor NPC). 

 

does anyone have any ideas on this ?

The comments in IFPV.psc have this little tidbit which sounds like it could be what you're looking for.  You'd have to try it out to see what it does.

For example SetIntValue("iObjectRefFormId", 0x1B131) will set camera
; on Ulfric, this only works if he is loaded and IFPV is active.

1 hour ago, coldloc said:

 

3. The varies methods and their distance on success of object selection  (cursor related)

I  aware that many behaviors are using the crosshairRef  cursor to aim the target, 

such as

1. Repositioner mod ,  use crosshairRef on target  

2.  projectile style like relaase the arrow after aiming by crosshairRef 

3.  open ~ skyrim console,  and use mouse cursor click to  select object.      

 

I would like to know their distance on sucessful selection of object instead of grab a "None" value,   and can some of these distance be altered in game ? 

Not sure I understand what you're asking for here.  If you can access the object in your script, you can use ObjectReference.GetDistance() to get the distance.  If you want to change the distance the CrosshairRef functionality can 'see', I'm not sure if that's possible.  If it is possible, I think it would be the kind of thing you'd have to set in the INI or Skyrim's global settings in the CK.

Posted
54 minutes ago, Holzfrau said:

 Not sure I understand what you're asking for here.  If you can access the object in your script, you can use ObjectReference.GetDistance() to get the distance.  If you want to change the distance the CrosshairRef functionality can 'see', I'm not sure if that's possible.  If it is possible, I think it would be the kind of thing you'd have to set in the INI or Skyrim's global settings in the CK.

first of all, thank you very much for replying,  and sorry for my poor description In the 3rd question posted, to explain it in a better way, 

I was trying to mention the ways to grab an object in game is pretty much depend on the distance that target object is away from player or camera ... (no idea if that's accurate)

 

like below user stories I've encountered in game :

1. open your skyrim console by ~ ,  try to mouse click on an game object within view,  it seems like you are more likely to grab something successfully near your camera , and quite hard or impossible to get something far away. (hard to tell blocked by something invisible or just limitations sometimes )

2. if you don't open console, just using the game's crosshair cursor, by printing 

If( Game.GetCurrentCrosshairRef() != None )
	ObjectReference Target = Game.GetCurrentCrosshairRef()
	Debug.trace( Target )
EndIf

same as above there is certain limitations when the aiming object is beyond certain distance you can't get its reference.  

as comparison,  function in MiscUtil that allows user to pass distance as search parameter to get object within precise range, so it's very reliable than  GetCurrentCrosshairRef ... 

; Scans the current cell of the given CenterOn for an object of the given form type ID within radius and returns an array for all that
; and (optionally) also has the given keyword if changed from default none. Setting radius to 0.0 will return all matches in cell.
; NOTE: This function is fairly untested beyond simply checking if it works as expected. 
ObjectReference[] function ScanCellObjects(int formType, ObjectReference CenterOn, float radius = 5000.0, Keyword HasKeyword = none) global native

3.  I noticed some missile style magic (or if it's called projectile) will also use the crosshair  to aim the target, but distance would be changeable in CK and much further ....  i am not sure if there is a limitation of it within view distance in gameplay .  a use case of such behavior is in mod "void walker" 

Spoiler

 

 

 

 

 

Posted

image.png.192286887897d89740554666f779fd45.png

AND I observed that the crosshairref curor would turn into red , when target is unreachable 

but no matter how i change this value

image.png.b197163bf94c4cfd5dcd73249b1d6e6d.png 

 

it seems the distance limitation will not alter in game.  

  • 2 weeks later...
Posted

just an Update: 

 

I sort of resolved the Game's Camera manipulation issue 

via the usage of the IFPV api provided that Holzfrau suggested  .  it seems works well by default. able to switch First Person View between Player and another Form Object with skeleton node defined ( I only tried with human actor, so is the node name defined in skeleton.xml so far )

 

other questions no progress yet so far.

 

BTW, I feel not able to recompile IFPV skse source using latest skse1.7.3 depandancies , kind of stucked here ,  welcome to share your tips if you have resolved similar issues .  ?

image.png.3dc11765643bbbac5e2d5879e87b2693.png

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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