Jump to content

setposition howto


Recommended Posts

here is my code:

 

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
If (!akNewContainer)
Game.GetPlayer().PlaceAtMe(myitem as Form, 1, True, False, False)
setposition(5,5,5)
EndIf
EndEvent
i know im inputing something wrong/missing which is why the the setposition is not activating
help me pls ><
Edited by xBloodTigerx
Link to comment
Share on other sites

SetPosition (5,5,5) will move your object somewhere to the centre of the world map. I`m not sure what you are trying to accomplish, maybe this is exactly what you want, and I don`t know what object are you trying to move and where do you want it to move.

If you want to move something close to something else, you can use :

MyObject.MoveTo( AnotherObject, 5, 5, 5, True)

If you are trying to move the created object, then you can type something like this :

ObjectReference MyCoolObject = Game.GetPlayer().PlaceAtMe(MyItem, 1, True, False, False)
MyCoolObject.SetPosition(5,5,5)

It`s also hard to know whether your event fires or not. You need to explain what your script is supposed to do, otherwise it`s hard to help.

Edited by kitcat81
Link to comment
Share on other sites

SetPosition (5,5,5) will move your object somewhere to the centre of the world map. I`m not sure what you are trying to accomplish, maybe this is exactly what you want, and I don`t know what object are you trying to move and where do you want it to move.

If you want to move something close to something else, you can use :

 

mybad, i was not specific.

what i'm trying to do is move a spawned static object.

the static object is halfway through the floor and i want to move it up and infront of the player.

 

here is my actual script

//note that the values of the setposition is just a replacement value.

 

 

thanks for the reply

Scriptname sample extends ObjectReference Const

random Property myitem Auto Const Mandatory

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
	If (!akNewContainer)

		self.setposition(5,5,5)
                Game.GetPlayer().PlaceAtMe(myitem as Form, 1, True, False, False)
 
	EndIf
EndEvent

//moving the self.setposition above the spawn code does not work also but i'm keeping it on top since i was told it needs coordinate before spawning
//i have used MoveTo as well with the object reference, did not work
Edited by xBloodTigerx
Link to comment
Share on other sites

 

SetPosition (5,5,5) will move your object somewhere to the centre of the world map. I`m not sure what you are trying to accomplish, maybe this is exactly what you want, and I don`t know what object are you trying to move and where do you want it to move.

If you want to move something close to something else, you can use :

 

mybad, i was not specific.

what i'm trying to do is move a spawned static object.

the static object is halfway through the floor and i want to move it up and infront of the player.

 

here is my actual script

//note that the values of the setposition is just a replacement value.

 

 

thanks for the reply

Scriptname sample extends ObjectReference Const

random Property myitem Auto Const Mandatory

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
	If (!akNewContainer)

		self.setposition(5,5,5)
                Game.GetPlayer().PlaceAtMe(myitem as Form, 1, True, False, False)
 
	EndIf
EndEvent

//moving the self.setposition above the spawn code does not work also but i'm keeping it on top since i was told it needs coordinate before spawning
//i have used MoveTo as well with the object reference, did not work

If you use SetPosition on "Self", then you are trying to set position of the object that has this script. Not the spawned object.

You can`t move anything unless it already exists.

If you want to move the spawed object then need to point the game at the object , so you need to define this object:

ObjectReference MyCoolObject = Game.GetPlayer().PlaceAtMe(MyItem, 1, True, False, False)
MyCoolObject.SetPosition(5,5,5) ;or do something else with your object
Link to comment
Share on other sites

that shouldv worked. but not with what i'm trying to do. i guess editing the nif will do, but have to find other collision that matches x.x thanks alot, i learned quite a few stuff. i'll keep in mind to objectrefer
Link to comment
Share on other sites

You spawn the item and it's connect point spawns it halfway into the floor, is that correct?

 

why not go into Nifskope and change its connect point?

 

Edit: I should say Origin point.

And, really,more like you would move everything else around the origin point so that it all falls where you want it.

Edited by BlahBlahDEEBlahBlah
Link to comment
Share on other sites

You spawn the item and it's connect point spawns it halfway into the floor, is that correct?

 

why not go into Nifskope and change its connect point?

 

Edit: I should say Origin point.

And, really,more like you would move everything else around the origin point so that it all falls where you want it.

 

yes , but if you have the collision, the collision won't move with the block. ??

 

or is there another way to move everything alltogether [in nifskope]? if so, that's BIG news!

 

i'm only trying to move the whole thing because of the collision.

Edited by xBloodTigerx
Link to comment
Share on other sites

  • Recently Browsing   0 members

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