Jump to content

PlaceAtMe problem


silverflasher

Recommended Posts

hi all, this is my first post here..

i'm italian, so im sorry for my bad english. :)

 

i've a big and strange problem..i want to place a fireplace on a item (firewood01) when i drop it to the ground-when i click on it with torch in my hand-.

all works, but at the "placeatme" script, the new object "fly" over the ground.. the z axis is not the same of the firewood..some help?

there is a way to get the actual xyz pos of my firewood?

because if I grab and drag the firewood, the xyz pos remain the old..

 

tnx in advance..t.t

Link to comment
Share on other sites

hi all, this is my first post here..

i'm italian, so im sorry for my bad english. :)

 

i've a big and strange problem..i want to place a fireplace on a item (firewood01) when i drop it to the ground-when i click on it with torch in my hand-.

all works, but at the "placeatme" script, the new object "fly" over the ground.. the z axis is not the same of the firewood..some help?

there is a way to get the actual xyz pos of my firewood?

because if I grab and drag the firewood, the xyz pos remain the old..

 

tnx in advance..t.t

I don't really know what your talking about but try looking straight forward on level ground when you do it and see if that works. If your talking about just dropping a campfire using a bat file or console than yes it has to be level ground and you must look forward.

Link to comment
Share on other sites

i'm sorry, its all by papyrus.

this is the script on the firewood01:

Scriptname AE_legnaAction extends ObjectReference  
import utility
Message property ae_legnaMessage auto
objectreference  Property AE_fuocoSemplice  Auto  
ObjectReference Property faloSpento  Auto  
ObjectReference Property faloMedio  Auto  
ObjectReference Property luce  Auto  


ObjectReference Property luceFuoco Auto Hidden 
ObjectReference Property legna  Auto Hidden 
ObjectReference Property fuoco Auto Hidden 
ObjectReference Property fuocomedio Auto Hidden 
ObjectReference Property fuocospento Auto Hidden 

event oninit()
BlockActivation()
endevent

Event OnContainerChanged(ObjectReference NewContainer, ObjectReference OldContainer)
If oldContainer == game.getplayer()
	self.BlockActivation()
endif

endevent

event onActivate(objectreference akActivator)
if(akActivator == game.getplayer())
	if (game.getplayer().GetEquippedItemType(0) == 11);have torch(11)
		messaggio()				
	else
		raccogli()
	endif
endif
endevent

function messaggio()
Int iButton = ae_legnaMessage.show()
if(iButton == 0)
	raccogli()
elseif(iButton == 1)
	accendi()
else
	;niente
endif
endfunction

function raccogli()
;debug.Notification("prendo la legna..")
self.BlockActivation(false)
game.getplayer().additem(self)
endfunction

function accendi()
fuoco = self.placeatme(AE_fuocoSemplice.GetBaseObject(),abInitiallyDisabled = true)
fuoco.setangle(0 , 0,  0)

fuoco.enable()

lucefuoco = fuoco.placeatme(luce.getbaseobject())

;debug.Notification("ref: "+fuoco)
delete()

;inizia il countdown per spegnersi
;Debug.Notification("Starting countdown")

RegisterForUpdateGameTime(0.10)

endfunction

Int step = 0
Event OnUpdateGameTime()
step +=1
;Debug.Notification("countdown: "+step)
if (step == 4)
	fuocomedio = fuoco.placeatme(faloMedio.GetBaseObject())
	lucefuoco.moveto(lucefuoco,afZOffset = 0)
	utility.wait(1)
	fuoco.disable(true)
	utility.wait(1.5)
	fuoco.delete()
elseif (step == 8)
	fuocospento = fuocomedio.placeatme(faloSpento.GetBaseObject())
	lucefuoco.moveto(lucefuoco,afZOffset = -5)
	utility.wait(1)
	fuocomedio.disable(true)
	utility.wait(1.5)
	fuocomedio.delete()
elseif(step == 12)
	fuocospento.disable(true)
	lucefuoco.delete()
	utility.wait(1.5)
	fuocospento.delete()
	step = 0
	UnregisterForUpdateGameTime()
endif
EndEvent


 

when the "fuoco" is placed, the zaxis is not the same of firewood01..

i hope that u understand :D

here: fuoco = self.placeatme(AE_fuocoSemplice.GetBaseObject(),abInitiallyDisabled = true)

Edited by silverflasher
Link to comment
Share on other sites

there is some "update x-y-z-position" function,or a way to do that?

 

I believe you're on to something:

fuoco.setangle(0 , 0,  0)

Link to comment
Share on other sites

there is some "update x-y-z-position" function,or a way to do that?

 

I believe you're on to something:

fuoco.setangle(0 , 0,  0)

that "set" the angle rotation..so is not "upside down" or rotated in a strange psition.

i need to "get" the current x-y-z position of my firewood01 (self) .

something to call, a registerupdate func for the position, or some event that detect any object shift, by drag and drop..

Link to comment
Share on other sites

http://www.creationkit.com/ApplyHavokImpulse_-_ObjectReference

says:

"GetPosition and GetAngle will return the old position. If you need those informations, a workaround is to have a dummy, invisible, object and use MoveToNode to move it to one of your real object's nodes, then get the position of your dummy object."

i do not really understand..

Link to comment
Share on other sites

Hmm... try this:

 

 

Scriptname AE_legnaAction extends ObjectReference  
import utility
Message property ae_legnaMessage auto
objectreference  Property AE_fuocoSemplice  Auto  
ObjectReference Property faloSpento  Auto  
ObjectReference Property faloMedio  Auto  
ObjectReference Property luce  Auto  


ObjectReference Property luceFuoco Auto Hidden 
ObjectReference Property legna  Auto Hidden 
ObjectReference Property fuoco Auto Hidden 
ObjectReference Property fuocomedio Auto Hidden 
ObjectReference Property fuocospento Auto Hidden 

event oninit()
       BlockActivation()
endevent

Event OnContainerChanged(ObjectReference NewContainer, ObjectReference OldContainer)
       If oldContainer == game.getplayer()
               self.BlockActivation()
       endif
       
endevent

event onActivate(objectreference akActivator)
       if(akActivator == game.getplayer())
               if (game.getplayer().GetEquippedItemType(0) == 11);have torch(11)
                       messaggio()                             
               else
                       raccogli()
               endif
       endif
endevent

function messaggio()
       Int iButton = ae_legnaMessage.show()
       if(iButton == 0)
               raccogli()
       elseif(iButton == 1)
               accendi()
       else
               ;niente
       endif
endfunction

function raccogli()
       ;debug.Notification("prendo la legna..")
       self.BlockActivation(false)
       game.getplayer().additem(self)
endfunction

function accendi()
       fuoco = self.placeatme(AE_fuocoSemplice.GetBaseObject(),abInitiallyDisabled = true)
fuoco.SetPosition(X, Y, Z)	; sets the fire to the exact coordinates of the firewood
       fuoco.setangle(GetAngleX(), GetAngleY(), GetAngleZ())	; sets the fire to the exact angle of the firewood

       fuoco.enable()
       
       lucefuoco = fuoco.placeatme(luce.getbaseobject())
       
       ;debug.Notification("ref: "+fuoco)
       delete()

       ;inizia il countdown per spegnersi
       ;Debug.Notification("Starting countdown")

       RegisterForUpdateGameTime(0.10)
       
endfunction

Int step = 0
Event OnUpdateGameTime()
       step +=1
       ;Debug.Notification("countdown: "+step)
       if (step == 4)
               fuocomedio = fuoco.placeatme(faloMedio.GetBaseObject())
               lucefuoco.moveto(lucefuoco,afZOffset = 0)
               utility.wait(1)
               fuoco.disable(true)
               utility.wait(1.5)
               fuoco.delete()
       elseif (step == 8)
               fuocospento = fuocomedio.placeatme(faloSpento.GetBaseObject())
               lucefuoco.moveto(lucefuoco,afZOffset = -5)
               utility.wait(1)
               fuocomedio.disable(true)
               utility.wait(1.5)
               fuocomedio.delete()
       elseif(step == 12)
               fuocospento.disable(true)
               lucefuoco.delete()
               utility.wait(1.5)
               fuocospento.delete()
               step = 0
               UnregisterForUpdateGameTime()
       endif
EndEvent

 

 

possibly, if the fire still floats above the firewood, try changing this line:

 

	fuoco.SetPosition(X, Y, Z)	; sets the fire to the exact coordinates of the firewood

 

to something like:

 

	fuoco.SetPosition(X, Y, Z - 20)

 

.... and adjust the number (20) as necessary until the fire is positioned correctly on the ground.

Edited by steve40
Link to comment
Share on other sites

  • Recently Browsing   0 members

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