Jump to content

attack hit location


angelwraith

Recommended Posts

is there a way to return the world location information of where a bullet hit?

so that that information can then be passed on in order to move a persistent marker to its location?

 

please note i am not asking about the hit location i saw in the docs unless it somehow returns more information other than only when you hit an actor.

 

to reiterate for simplicity:

 

i need the x, y, and z values of where the bullet hits when i fire a certain weapon.. and i need it to happen EVERY time you shoot no matter what is hit.

Link to comment
Share on other sites

I did exactly this, but the method I used may not be what you want. I have made a teleport gun of sorts that moves the player to the location where the bullet hits. To do it, I had to make a custom projectile that places a custom explosion at the impact location. The custom explosion uses the 'Placed Impact Object' to spawn an invisible party hat - you could use any object that can run a script. The party hat has a script on it that uses GetPos X, GetPos Y, GetPos Z to determine its location in the world. I did a bit more than this though so I could get the reference of the hat, but just to get the X, Y, Z coordinates, this should be good enough.

 

One caveat though. The position returned will often be located inside of the geometry of other objects, thus making the thing you move there clip with said geometry.

Link to comment
Share on other sites

I did exactly this, but the method I used may not be what you want. I have made a teleport gun of sorts that moves the player to the location where the bullet hits. To do it, I had to make a custom projectile that places a custom explosion at the impact location. The custom explosion uses the 'Placed Impact Object' to spawn an invisible party hat - you could use any object that can run a script. The party hat has a script on it that uses GetPos X, GetPos Y, GetPos Z to determine its location in the world. I did a bit more than this though so I could get the reference of the hat, but just to get the X, Y, Z coordinates, this should be good enough.

 

One caveat though. The position returned will often be located inside of the geometry of other objects, thus making the thing you move there clip with said geometry.

 

exactly the info i needed..

 

i attempted to find the explosion object but the whole reference thing was stumping me..

 

i will try it with the place impact object..

thank you my friend

Link to comment
Share on other sites

Here is my entire script that runs on the party hat. Since I'm still working on it, there are some left-over variables from prior testing. But this will show you how to get the reference of the spawned party hat (or whatever item you use). It uses Two main FOSE commands though. I could not figure out how to do it without FOSE. The two main features of the script are the FOSE 'Ref-Walk' - the looping code that checks every instance of a ref type in the area defined by 'Depth' (the GetFirstRef and GetNextRef functions) and the FOSE function 'GetBaseObject' (GBO) which returns the base object of the reference. I then check if the returned base object of the current ref in the ref walk is equal to my custom party hat, if it is, then I have found the reference and then can use MoveTo with that reference. I hope that makes sense. The Set Self to Apple is an extra step that seems to prevent a certain bug from popping up when performing ref walks.

 

scn UCSpawnHat2Script

Short DoOnce
Short Depth
;Float XPos
;Float YPos
;Float ZPos
Ref Self
Ref Obj

Begin GameMode
If DoOnce == 0
	Set Depth to 3 * (Player.IsInInterior == 0)
	Set Self to apple
	Set Self to GetFirstRef 24 Depth 0  ;Armors
	Label 11
	If (self)
		Set Obj to self.GBO
		If Obj == UCSpawnHat2
			player.moveto self
		EndIf
		Set self to apple
		Set Self to GetNextRef
		Goto 11
	Endif ;self	
	Set DoOnce to 1
	disable
	markfordelete
EndIf
End

Link to comment
Share on other sites

Here is my entire script that runs on the party hat. Since I'm still working on it, there are some left-over variables from prior testing. But this will show you how to get the reference of the spawned party hat (or whatever item you use). It uses Two main FOSE commands though. I could not figure out how to do it without FOSE. The two main features of the script are the FOSE 'Ref-Walk' - the looping code that checks every instance of a ref type in the area defined by 'Depth' (the GetFirstRef and GetNextRef functions) and the FOSE function 'GetBaseObject' (GBO) which returns the base object of the reference. I then check if the returned base object of the current ref in the ref walk is equal to my custom party hat, if it is, then I have found the reference and then can use MoveTo with that reference. I hope that makes sense. The Set Self to Apple is an extra step that seems to prevent a certain bug from popping up when performing ref walks.

 

scn UCSpawnHat2Script

Short DoOnce
Short Depth
;Float XPos
;Float YPos
;Float ZPos
Ref Self
Ref Obj

Begin GameMode
If DoOnce == 0
	Set Depth to 3 * (Player.IsInInterior == 0)
	Set Self to apple
	Set Self to GetFirstRef 24 Depth 0  ;Armors
	Label 11
	If (self)
		Set Obj to self.GBO
		If Obj == UCSpawnHat2
			player.moveto self
		EndIf
		Set self to apple
		Set Self to GetNextRef
		Goto 11
	Endif ;self	
	Set DoOnce to 1
	disable
	markfordelete
EndIf
End

 

this is similar to the method i udes for my thermal goggles to apply shaders to all the actors..

 

wish there was a better way.. seems to be pretty buggy.. not always finding correct ref n all

Link to comment
Share on other sites

cant seem to get the explosion to place an object through the effect script...

 

what was the script you used to actually place the hat

 

 

 

haha

 

i couldnt find it cause i was runnin geck 1.1...NOT 1.5 w/ the placed impact object addition

Link to comment
Share on other sites

this is similar to the method i udes for my thermal goggles to apply shaders to all the actors..

 

wish there was a better way.. seems to be pretty buggy.. not always finding correct ref n all

 

Ya, I made an enhanced vision helmet myself that applies shaders to refs too. I noticed the very same thing - not always finding all the refs. I put a call into the FOSE team about it with some pics and console output to prove it to them. I haven't heard back from anyone on the FOSE team though. Interstingly, when I use a ref-walk to find followers, it always works though in every test I have ever done. But with looking for all actors, some are missing. Every test I have done with my above code looking for the hat, it has worked as well. Did you use the 'Set SomeRef to apple' bit in your code by chance? Rumor has it that this helps lower the number of misses.

 

EDIT: I Just checked the FOSE thread in the Bethesda forum, and I did get a response which was this:

 

We recently fixed an unsigned arithmetic error in OBSE's version of GetFirst/NextRef which can cause the x component of a cell's coordinates to be off by one on certain inputs. The same bug has likely been ported over to FOSE; if so the same fix should apply. For the time being, I'd suggest adding 1 to the cell depth param (e.g. pass 2 instead of 1).

 

So maybe that will help with your Goggles' script.

Link to comment
Share on other sites

for some reason the script attached to the placed object will not recognize timer functions...

 

i mean it is otherwize working as planned.. i just need some way to make it pause for 8 seconds at on part of the script and it wont work and i cant figure out why its not working

 

 

SCN SUBcameraeffectplacerSCRIPT

int runonceF
float timerSJD
float xREF
float yREF
float zREF
ref placedobjectREF

BEGIN GAMEMODE

if (runonceF == 0)
	set runonceF to 1
	set timerSJD to 0

elseif (runonceF == 1)
	set xREF to player.getpos X
	set yREF to player.getpos Y
	set zREF to player.getpos Z
	set placedobjectREF to GetSelf
	player.moveto placedobjectREF

	label 1 ; timer pause
	set timerSJD to timerSJD + GetSecondsPassed
	if timerSJD < 8
		goto 1
	elseif timerSJD > 8
		set runonceF to 2
		set timerSJD to 0
	endif

elseif (runonceF == 2)
	player.setpos X xREF
	player.setpos Y yREF
	player.setpos Z zREF
	set runonceF to 3

endif
END

Link to comment
Share on other sites

Try using a script thar looks like this:

 

SCN SUBcameraeffectplacerSCRIPT

int runonceF
float timerSJD
float xREF
float yREF
float zREF
ref placedobjectREF

BEGIN GAMEMODE

If timerSJD > 0
	Set timerSJD to timer SJD - GetSecondsPassed
ElseIf (runonceF == 0)
	set runonceF to 1
	set xREF to player.getpos X
	set yREF to player.getpos Y
	set zREF to player.getpos Z
	set placedobjectREF to GetSelf
	player.moveto placedobjectREF
elseif (runonceF == 1)
	set timerSJD to 8
	Set runonceF to 2
elseif (runonceF == 2)
	player.setpos X xREF
	player.setpos Y yREF
	player.setpos Z zREF
	set runonceF to 3
endif
END

 

I think the problem you were having with your timer was that your were using a loop within the same frame. For a timer to work properly, I beleive the frames need to advance.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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