Jump to content

How to use event handlers for hotkey scripting?


FiftyTifty

Recommended Posts

I've used SetRigidBodyMass on weapons, well, on a hunting rifle when testing, it seemed to work fine.

There's also GetRigidBodyMass, if you want to restore its proper value later.

 

An important note though, don't use a "done" variable to set the handler just once in your quest script. Event handlers last for the duration of the game session or until removed, so they have to be set again every time you start the game if you want to keep using them. Instead, use a GetGameRestarted check.

"Player" is pretty much always compiled as the player reference (formID 14) in scripts, though there can be issues using it with some commands in some rare cases I can't recall right now. If you want to be sure, always use "PlayerRef" instead. To get the player base object (formID 7), use "PlayerRef.GBO"

Link to comment
Share on other sites

Ya setrigidbodymass doesn't say it has limitations. Plus all those items pretty much are moveable statics I thought , atleast their 3D data being something that can be grabbed or knocked around?

On a closer inspection of your script. I think it is that the items have not been set to be owned by the player. Which looks to be how you are determining what to pass the function on that is stored in the array ? You are just telling it to include taken refs , which I don't think that would set ownership , nor is a taken ref the same as a grabbed one.

 

So what if you use this function "http://geck.bethsoft.com/index.php?title=GetPlayerGrabbedRef"

Like this ...

 

Ref rItem

 

Begin GameMode ; as a block in a quest script maybe ?

 

Set rItem to GetPlayerGrabbedRef

rItem.SetOwnership

End

 

~~~~~~~~~~~~~

 

And this quest script is only active during a decorating mode you turned on some how ?

Link to comment
Share on other sites

I've used SetRigidBodyMass on weapons, well, on a hunting rifle when testing, it seemed to work fine.

There's also GetRigidBodyMass, if you want to restore its proper value later.

 

An important note though, don't use a "done" variable to set the handler just once in your quest script. Event handlers last for the duration of the game session or until removed, so they have to be set again every time you start the game if you want to keep using them. Instead, use a GetGameRestarted check.

"Player" is pretty much always compiled as the player reference (formID 14) in scripts, though there can be issues using it with some commands in some rare cases I can't recall right now. If you want to be sure, always use "PlayerRef" instead. To get the player base object (formID 7), use "PlayerRef.GBO"

 

You might be right about weapons actually, don't think I tested them. But for the other types of items, SetRigidBodyMass doesn't do anything.

 

 

Ya setrigidbodymass doesn't say it has limitations. Plus all those items pretty much are moveable statics I thought , atleast their 3D data being something that can be grabbed or knocked around?

On a closer inspection of your script. I think it is that the items have not been set to be owned by the player. Which looks to be how you are determining what to pass the function on that is stored in the array ? You are just telling it to include taken refs , which I don't think that would set ownership , nor is a taken ref the same as a grabbed one.

 

So what if you use this function "http://geck.bethsoft.com/index.php?title=GetPlayerGrabbedRef"

Like this ...

 

Ref rItem

 

Begin GameMode ; as a block in a quest script maybe ?

 

Set rItem to GetPlayerGrabbedRef

rItem.SetOwnership

End

 

~~~~~~~~~~~~~

 

And this quest script is only active during a decorating mode you turned on some how ?

 

I can assure you that it does. You can test it directly via the console. Select an aid item, type in SetRigidBodyMass 100, and the item will be unaffected.

 

I'm not checking for player ownership, as I found IsOwner and GetOwner == PlayerRef to not return true when called on items dropped by the player. Instead, I check the FormID of the items. If they have a FormID larger than FF000000, they are objects created at runtime, which includes items dropped by the player with few exceptions.

 

The quest script is active at all times at the moment.

Link to comment
Share on other sites

But checking for dropped items is not the same as checking for grabbed items.

 

Presently grabbed items (holding) ... Dropped is always a past tense check .

 

And Dropped is not == to OnRelease

Link to comment
Share on other sites

Question ? So consumables , having a world model , will not be subject to setting them as rigid / non pushable ? that might explain why they have static models.

 

Consumables aren't static. They can be pushed around and picked up, which is why I thought SetRigidBodyMass would work on them. But it doesn't.

Link to comment
Share on other sites

Err I said that backwards ... that explains why they don't have static models. But I noticed all the armor doesn't have them either. So ^shrug^ But could be the category they show up in "Effects" ???

 

However ... maybe this JIP function would do it for ya. http://geck.bethsoft.com/index.php?title=ToggleObjectCollision

 

Sorry for the outdated wiki link ... but couldn't find the new wiki for it ... at least not with google.

 

Of course you could always just track down how that Fallout 3 mod "Feng Shui" does it.

It's a mod so you can easily place stuff , and I believe make it stay in place ???

There is probably an NV version too.

Link to comment
Share on other sites

Err I said that backwards ... that explains why they don't have static models. But I noticed all the armor doesn't have them either. So ^shrug^ But could be the category they show up in "Effects" ???

 

However ... maybe this JIP function would do it for ya. http://geck.bethsoft.com/index.php?title=ToggleObjectCollision

 

Sorry for the outdated wiki link ... but couldn't find the new wiki for it ... at least not with google.

 

Of course you could always just track down how that Fallout 3 mod "Feng Shui" does it.

It's a mod so you can easily place stuff , and I believe make it stay in place ???

There is probably an NV version too.

 

Unfortunately, that function has a massive caveat; it affects all objects that use the same model: This function will affect ANY other objects in the game using the same world model as the calling reference.

 

Took a look at Feng Shui, and from what I could tell, it locks the objects in place by running a per-frame script that stores the initial xyz position and rotation values for each item, then repeatedly applying them to the reference. It sounds absolutely awful for performance.

Link to comment
Share on other sites

Holy crap , I see what you mean. 5-6 scripts .

 

But I think it is just locking one item at a time , by swapping in a static for where the consumable was placed.

 

~~~~~~~~~~~~~~~~~~~~~~~

 

ref rOriginalItem ; GetPlayerGrabbedRef set to rItemToLock
ref rClonedItem ; OnRelease ... PlaceAtme rColonedItem
ref rItemToLock ; X,Y,Z Pos & Angle stored here
ref rSelf ; The subject of the script
float xPos
float yPos
float zPos
float xAngle
float yAngle
float zAngle
Begin OnRelease
rOriginalItem PlaceAtMe.rClonedItem
rItemToLock.SetPos z zPos
rItemToLock.SetPos x xPos
rItemToLock.SetPos y yPos
rItemToLock.SetAngle x xAngle
rItemToLock.SetAngle y yAngle
rItemToLock.SetAngle z zAngle
rOriginalItem.Disable
rClonedItem.Enable
rOriginalItem.MarkForDelete
END
~~~~~~~~~~~~~~~~
Err something like that as a thought experiment ... sorry still trying to sort out the logic. I'm still kinda clueless as to how all the scripts work together. And the A to B to C path ... being the held item to swapped item to locked item.
But basically you have to unpack the archives ... https://www.nexusmods.com/fallout3/mods/34
Which this works for FNV also.
"Meshes /Clutter / Chems"
"Meshes /Clutter / Food"
"Meshes /Clutter / Health"
"Meshes /Clutter / Junk"
Then place them in loose folders , and navigate in geck to the "World Objects / Static" And start making new ID's based on all the objects from the consumables ... probably quite a few.
But you might be able to do some model switcheroo with them being in the same folder structure ^shrug^
And then these static items will be as immobile as any others. But yes you will have to figure out some how to re-enable them for picking up again. Maybe an OnActivate entry point for secondary mouse over If statics can be filtered ?
Or ...
Hope that helps ???
Link to comment
Share on other sites

  • Recently Browsing   0 members

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