Jump to content

[LE] PathToReference


Elias555

Recommended Posts

Trying to pass an activator and a potion through PathToReference but I'm not sure how to do it. To clear things up:

Potion Property Stew Auto  

Event OnEffectStart(Actor akTarget, Actor akCaster)
	
	ObjectReference MyStew = akCaster.Placeatme(Stew)
	MyStew.MoveTo(akCaster, 120.0 * Math.Sin(akCaster.GetAngleZ()), 120.0 * Math.Cos(akCaster.GetAngleZ()), akCaster.GetHeight() + 335.0) 
	akCaster.PathToReference(MyStew, 0.5);akCaster needs to be replaced with an activator
	
EndEvent

Right now the stew is created above the caster and then plummits down by gravity. I want to be able to control the descent.

Link to comment
Share on other sites

I think PathToReference() is only for actors not objects. Try TranslateToRef().

 

Here is a small clip out of one of my scripts. It lowers water slowly till it reaches a xmarker then stops.

The water is at 2560.0,2560.0,-800.0 when it starts.

 

 

MarkerREF.SetPosition(2560.0,2560.0,-1024.0) <- SetPosition don't move anything (needed for TranslateToRef)
WaterREF.TranslateToRef(MarkerREF, 10.0)
While(WaterREF.GetPositionZ() !=(-1024.0))
Utility.Wait(2.0)
EndWhile
WaterREF.SetPosition(2560.0,2560.0,-1024.0) ; <- you need to state this at the end even though it's already there.
The TranslateToRef() is super picky so you need to use SetPosition(). At Least I did with what I was working with at the time.
For you, you could put a XMarker where you wish the stew to end up and leave it there, Get the Z value and use that in the while loop.
I found SetPosition() was needed for the TranslateToRef() to work right from me (that may have been from what I was doing at the moment).
If you use a 1.0 for the speed it will move so slow you can hardly even tell.
Edited by NexusComa
Link to comment
Share on other sites

I couldn't get it to the position I want using setposition so I used moveto.

Activator Property MyActivator Auto  
Activator Property xMarkerActivator Auto  
Potion Property Stew Auto  

Event OnEffectStart(Actor akTarget, Actor akCaster)


	ObjectReference MyStew = akCaster.Placeatme(Stew)
	ObjectReference EndPoint = akCaster.Placeatme(xMarkerActivator)
	MyStew.MoveTo(akCaster, 120.0 * Math.Sin(akCaster.GetAngleZ()), 120.0 * Math.Cos(akCaster.GetAngleZ()), akCaster.GetHeight() + 335.0) 
	EndPoint.MoveTo(akCaster, 120.0 * Math.Sin(akCaster.GetAngleZ()), 120.0 * Math.Cos(akCaster.GetAngleZ()), akCaster.GetHeight() + 20.0) 
	MyStew.TranslateToRef(EndPoint, 5)
	While(MyStew.GetPositionZ() !=(akCaster.GetHeight() + 20.0))    
		Utility.Wait(2.0)   
	EndWhile 
	EndPoint.MoveTo(akCaster, 120.0 * Math.Sin(akCaster.GetAngleZ()), 120.0 * Math.Cos(akCaster.GetAngleZ()), akCaster.GetHeight() + 20.0) 
EndEvent

Same thing happens, the stew is moved to the position and then plummets down. Does it have something to do with the nif?

 

Edit:I just did a test with an item that doesn't have havok and it seems to work. I'll have to make a fake stew and test it out to know if it works with 100% certainty.

Looks like the test nif did have havok checked in the nif but still floats when added into the game. I unchecked the stew nif and used the same activator but now it just floats in the air and doesn't move like with the test nif.

Edited by Elias555
Link to comment
Share on other sites

Well then you got it ... make a new static stew and use that as the one you see falling then pop in a real one and disable the static one.

If this is something you can do over and over you could Move() the disabled static stew back in start position use that SetPositon() and be setup to do it again.

 

Do you know how to make anything a static object ?

Edited by NexusComa
Link to comment
Share on other sites

I tried checking the BSXflags to mimic the nif that worked but all that did was make it freeze in place. I trimmed my code down to this. I didn't understand why that while loop was needed and it turns out it works without it.

Activator Property MyActivator Auto  
Activator Property xMarkerActivator Auto  
Potion Property Stew Auto  

Event OnEffectStart(Actor akTarget, Actor akCaster)


	ObjectReference MyStew = akCaster.Placeatme(MyActivator)
	ObjectReference EndPoint = akCaster.Placeatme(xMarkerActivator)
	MyStew.MoveTo(akCaster, 120.0 * Math.Sin(akCaster.GetAngleZ()), 120.0 * Math.Cos(akCaster.GetAngleZ()), akCaster.GetHeight() + 335.0) 
	EndPoint.MoveTo(akCaster, 120.0 * Math.Sin(akCaster.GetAngleZ()), 120.0 * Math.Cos(akCaster.GetAngleZ()), akCaster.GetHeight() - 50.0) 
	MyStew.TranslateToRef(EndPoint, 45)

EndEvent

How do I make it static correctly?

Link to comment
Share on other sites

SetPositon() will not move anything. It seems to be something the game needs when using TranslateToRef(). As the game

doesn't seem to auto update the objects new position after moving with TranslateToRef() even though you can see it in game as moved.

The next TranslateToRef() you do on the object will not know where the object is correctly without a SetPositon().

That's what happen in my case however with this water.

Edited by NexusComa
Link to comment
Share on other sites

What ... it's easy to make something a static without touching the .nif

Grap something this already static. Go copy from the base the path to the .nif you want.

Place that in the static you just set up by a new name and hit yes make a new object.

You will need to make a .bsa after that. the game will auto include you new object in the .bsa.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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