Jump to content

Scripting a weapon backfiring


adb3nj

Recommended Posts

LarannKiar is right, I had forgotten that the InstanceData structs don't contain the loaded ObjectReference of the weapon, only the form ie the base data of the weapon. They're very useful but not for what you're doing.

 

Back when I was attempting to work on a mod to make a power armor mounted turret, I was able to place it at a node that was loaded at the time on the player's skeleton(power armor skeleton). I didn't try it and don't know if it's possible but perhaps while you are holding the weapon, it counts as part of the skeleton for the purposes of weighting it to the hand bones, which SHOULD mean that you can just assume the weapon's nodes exist and are there to maybe be utilized by a PlaceAtNode call.

You'll just need the name of the weapon's barrel node presumably.

ie

Self.GetActorRef().PlaceAtNode("BarrelNode", explosionInBarrel, 1, False, False, True, True)

But again, this is theoretical.

 

Thanks! Otherwise I was looking to move it to a skeleton node, which I tried but I may not have scripted properly. If I can just place the explosion at the player's hand, that should be precise enough. PlaceAtNode is definitely promising though – it's not documented in the Creation Kit wiki, so I didn't realise it was an option! Disable --> move --> enable takes too long to *really* be viable.

Edited by adb3nj
Link to comment
Share on other sites

 

Thanks! Otherwise I was looking to move it to a skeleton node, which I tried but I may not have scripted properly. If I can just place the explosion at the player's hand, that should be precise enough. PlaceAtNode is definitely promising though – it's not documented in the Creation Kit wiki, so I didn't realise it was an option! Disable --> move --> enable takes too long to *really* be viable.

Are you sure you're on the Fallout 4 wiki and not the Skyrim one? PlaceAtNode

Link to comment
Share on other sites

 

 

Thanks! Otherwise I was looking to move it to a skeleton node, which I tried but I may not have scripted properly. If I can just place the explosion at the player's hand, that should be precise enough. PlaceAtNode is definitely promising though – it's not documented in the Creation Kit wiki, so I didn't realise it was an option! Disable --> move --> enable takes too long to *really* be viable.

Are you sure you're on the Fallout 4 wiki and not the Skyrim one? PlaceAtNode

 

 

Umm… No comment :whistling:

Link to comment
Share on other sites

Only works in 3rd-person, annoyingly, so at the moment I have:

Game.ForceThirdPerson()
PlayerRef.PlaceAtNode("WEAPON", mod_Legendary_ExplosiveProjectileExplosion)
Game.ForceFirstPerson()

There's a console command to check whether you're in 1st or 3rd person mode – IsPC1stPerson – but improbably, I can't find a scripted equivalent.

 

Edit: I was being (kind of) dumb. There's no scripted function, but it can be applied as a condition. So when IsPC1stPerson == 1, the above script fires, but if IsPC1stPerson == 0 or GetVATSMode != 0, a simpler script with just PlayerRef.PlaceAtNode fires. Not ideal but quite satisfying nonetheless!

Edited by adb3nj
Link to comment
Share on other sites

Only works in 3rd-person, annoyingly, so at the moment I have:

Game.ForceThirdPerson()
PlayerRef.PlaceAtNode("WEAPON", mod_Legendary_ExplosiveProjectileExplosion)
Game.ForceFirstPerson()

There's a console command to check whether you're in 1st or 3rd person mode – IsPC1stPerson – but improbably, I can't find a scripted equivalent.

 

F4SE has a native Game script functions for that, GetCameraState().

 

In the vanilla game it can be PlayerRef.HasDetectionLOS(PlayerRef).

Link to comment
Share on other sites

I would check the first person skeleton and the weapon nif for any first person data, the node has to be somewhere since the weapon is rendered and bullets "come out of it" properly

 

I've tried. I've also tried opening up the console and clicking around to get an object reference, but in first person, not only does the weapon not have a reference, but the the player character doesn't have one. I guess that's more the problem than the nodes per se – all first-person animation seems to be performed on a level that isn't accessible through scripting.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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