Jump to content

Need some help making a simple headshot script


trashgarbage666

Recommended Posts

GetSelf seemed to be functioning fine without assigning it to a reference. In fact, I've seen lots of scripts use various Get____ commands in a similar way. But I gave your suggestion a shot, just in case it ended up being the missing piece to all this, and it didn't turn out so well. Which is pretty confusing, honestly. At the very least, I thought it would just be a different method leading to get to the same result.

 

I was getting experience, but the kills weren't actually being assigned to me. Then I changed "Player.GetCombatTarget != rOwner" to "Player.GetCombatTarget == rOwner", and I was getting credited for the kills. However, when I spawned in 15 NCR troopers to fight 15 Legionaries and pointed my gun a Legionary just as they died, I got credit for all subsequent Legion deaths until the fight ended. This happened consistently every fight. With the GetSelf method, I was only getting wrongfully credited for the murder of the person I was pointing my gun at, and nobody else.

 

EDIT: Sometimes I use "IsKiller Player" on corpses in-game to double check if the player is getting correctly credited for kills. Is there a way to manually set the player to be someone's killer? If so, that might be easier to have headshots do 999 damage to the target, and then tell the game it's the player's fault.

Edited by punchbattle
Link to comment
Share on other sites

  • Replies 59
  • Created
  • Last Reply

Top Posters In This Topic

Well I guess I was just thinking that having a Get command to return something ... then comparing it with another get command , would not be stable enough. But now that I'm thinking about it ... possibly getself is returning the projectile instead of what it hit. So not the same as the implication of self within the CastImmediateOnSelf ???

 

Try a PrintToConsole with what GetSelf returns.

 

But maybe instead of setting the variable to GetSelf , how about use Player.GetCombatTarget ?

And possibly "OnMagicEffectHit" for the block ... not sure cuz I don't see any explanations on its use.

 

Ref rOwner

 

Begin OnMagicEffectHit HeadShotSpell

 

Set rOwner to Player.GetCombatTarget

If rOwner.IsSpellTarget HeadShotSpell

rOwner.CIOS HeadShotSpell2

 

endif

End

 

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

 

Then the script block for HeadshotSpell2 base effect script.

 

Begin OnScriptEffectStart

 

KillActor Player

 

End

~~~~~~~

 

And the other one use DamageAV 999 ... might work and only award xp once ... hopefully ?

Sorry I guess my brain is starting to get a little twisted on it too. But I'm having fun :smile:

Edited by Mktavish
Link to comment
Share on other sites

 

Well I guess I was just thinking that having a Get command to return something ... then comparing it with another get command , would not be stable enough. But now that I'm thinking about it ... possibly getself is returning the projectile instead of what it hit. So not the same as the implication of self within the CastImmediateOnSelf ???

 

Try a PrintToConsole with what GetSelf returns.

 

I think you might be on to something with that, because I tried swapping GetSelf with something really simple...

Ref rTarget

BEGIN GameMode

	Set rTarget to GetSelf

	If (GetHitLocation == 1 || GetHitLocation == 2)
		If Player.GetCombatTarget != rTarget
			CastImmediateOnSelf HeadshotSpell2
		Else
			CastImmediateOnSelf HeadshotSpell
		EndIf
	EndIf
END

...and it straight up crashes the game. So I tried printing what GetSelf has been returning all this time, and holy s***, the GECK wiki page for NVSE's Print could not be any less helpful. It's written for people who already know what it is and how to use it. You wouldn't happen to know how to use it, would you? It seems like a really helpful tool for testing things!

 

 

But maybe instead of setting the variable to GetSelf , how about use Player.GetCombatTarget ?

And possibly "OnMagicEffectHit" for the block ... not sure cuz I don't see any explanations on its use.

 

Ref rOwner

 

Begin OnMagicEffectHit HeadShotSpell

 

Set rOwner to Player.GetCombatTarget

If rOwner.IsSpellTarget HeadShotSpell

rOwner.CIOS HeadShotSpell2

 

endif

End

 

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

 

Then the script block for HeadshotSpell2 base effect script.

 

Begin OnScriptEffectStart

 

KillActor Player

 

End

~~~~~~~

 

And the other one use DamageAV 999 ... might work and only award xp once ... hopefully ?

 

I'm having trouble getting this to save, but I'm gonna keep moving parts of it around until GECK decides to be less stubborn.

 

Sorry I guess my brain is starting to get a little twisted on it too. But I'm having fun :smile:

 

My brain has been fried for weeks, ahaha. But same! Hammering this out has been really fun!

Edited by punchbattle
Link to comment
Share on other sites

Seems to be a little late to bring this up, but was only just reminded of it by migck's update today of "Ammo Effect Fixes", where he says:

Ammo scripts trigger from any of the actor's attacks while having the ammo loaded, not just from the weapon, so they trigger together with mines and the like. Also, effects applied from an ammo script, like incendiary ammo, just use the CIOS command which means that the game considers that the actor affected is damaging himself.

 

 

That mod is intended to overcome such issues (by script and some recent JIP LN NVSE functions). You might want to look at how he handles things like this. (He is a very experienced script writer going back to Oblivion days.)

 

-Dubious-

Edited by dubiousintent
Link to comment
Share on other sites

Seems to be a little late to bring this up, but was only just reminded of it by migck's update today of "Ammo Effect Fixes", where he says:

Ammo scripts trigger from any of the actor's attacks while having the ammo loaded, not just from the weapon, so they trigger together with mines and the like. Also, effects applied from an ammo script, like incendiary ammo, just use the CIOS command which means that the game considers that the actor affected is damaging himself.

 

 

That mod is intended to overcome such issues (by script and some recent JIP LN NVSE functions). You might want to look at how he handles things like this. (He is a very experienced script writer going back to Oblivion days.)

 

-Dubious-

 

No not to late at all ... That is probably the root of the problem here with what punchbattle wants to accomplish.

 

So , is it just a matter of installing that .esp then ? with its 3 required files also ?

 

https://www.nexusmods.com/newvegas/mods/63997/?

Edited by Mktavish
Link to comment
Share on other sites

  • 2 weeks later...

So I may have found the solution. But, of course, it doesn't work. Because that would be too easy. Maybe you guys can spot the problem.

 

Until now, I've only been using NVSE. I've never tried JIP LN NVSE, but decided to install it after I found this:

https://geckwiki.com/index.php/GetHitAttacker

 

Using this function, I could get headshots up and running with a single script. No other bells or whistles required. However, using any JIP NVSE-only functions make the script refuse to save, and I have no idea why. I installed JIP NVSE using the NVSE package manager. I'm pretty sure I did it right. Did I skip a step during setup, or am I just missing something ...?

ScriptName AmmoSCRIPT

BEGIN ScriptEffectStart

	Ref rTarget
	Ref rShooter

	Set rTarget to GetOwnerLastTarget
	Set rShooter to rTarget.GetHitAttacker

END

Here's the script so far. As you can see, even though it doesn't do anything yet, GECK refuses to save it because it contains a JIP NVSE function.

Edited by punchbattle
Link to comment
Share on other sites

I've been leery to jump in on this because I saw this thread late and would probably be suggesting things already said, but at least here, I can tell you (probably remind you, more like) that you can't declare variables in a Begin block, and they need to be put before that (or outside of, technically, but before is standard). Oops.

 

Though yes, it will not save with GetHitAttacker, either.

Edited by EPDGaffney
Link to comment
Share on other sites

No you can declare variables anywhere ... just must be declared before they are set/used .

 

Standardly for readability ... they are put before any begin blocks.

Edited by Mktavish
Link to comment
Share on other sites

Here's the script so far. As you can see, even though it doesn't do anything yet, GECK refuses to save it because it contains a JIP NVSE function.

 

Do you need to get your GeckPowerUp working with JIP ?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...