Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

[REQz][SKY] Flying Object Script


DsoS
 Share

Recommended Posts

Yet another odd script request for me XD

I've tried a few different tries, but they wouldn't compile or just didn't work, so I scrapped them all.

I have 5 X Makers in a pentagon shape, I need my "MovingObjectREF" to TranslateToREF to each one, continually as long as the player is in the cell.

I would like to have the following as properties so I can change them depending on how far apart each X Marker is... I would like to use this in multiple cells.

Cell Location(Can this be done?)

Movement Speed (Can this be done? if not set the speed to 1000)

5 X Markers (this of course can be done)

1 MovingObjectREF (this of course can be done)

It's basically like my Player one, but with only with Objects and not the player, and it continually moves.

If any other information is needed, just let me know.

Thank You in Advance! :pints:

Link to comment
Share on other sites

Okay, I do have a question on this...

first, the script:

Scriptname aaDSoSFlyingObjects extends ObjectReference  

{Allows a single item per script to move around 5 markers continuously. This will only happen while the player is in the current cell, hopefully.}


Import Debug

Import Utility


ObjectReference property MyMovingObject Auto

ObjectReference property myTarget01 Auto

ObjectReference property myTarget02 Auto

ObjectReference property myTarget03 Auto

ObjectReference property myTarget04 Auto

ObjectReference property myTarget05 Auto





Event OnCellAttach()

	If (MyMovingObject.GetParentCell() == Game.GetPlayer().GetParentCell())

		MyMovingObject.TranslateToRef(myTarget01, 1000, 100)

			wait(0.5)

		MyMovingObject.TranslateToRef(myTarget02, 1000, 100)

			wait(0.5)

		MyMovingObject.TranslateToRef(myTarget03, 1000, 100)

			wait(0.5)

		MyMovingObject.TranslateToRef(myTarget04, 1000, 100)

			wait(0.5)

		MyMovingObject.TranslateToRef(myTarget05, 1000, 100)

			wait(0.5)

	EndIf

EndEvent
Second, the question: How do I get this script to repeat over and over again? Another question: Even though I'm using:
(MyMovingObject.GetParentCell() == Game.GetPlayer().GetParentCell())

how can I tell if this script is running or not? I will have up to 15 or more in this certain cell and would rather it not be effecting performance when the player is not in this cell.

I believe this is all for now.

Edited by DsoS
Link to comment
Share on other sites

OnCellAttach only runs one time.

What I have done, for want of a better way to do it, is make a quest script.

When I want the quest and script to run, in an 'OnUpdate' block, I start the quest and give it an update time.

 
LevelersHorseQuest.Start()
LevelersHorseQuest.registerForUpdate(0.20)
[/CODE] In the quest script, when I am done, I then turn the update off and stop the quest.
[CODE]
LevelersHorseQuest.UnregisterForUpdate()
LevelersHorseQuest.Stop()

Its probably not the best way, but it works for me, for now.

Link to comment
Share on other sites

I got the script to loops continuously like I needed it to...

Just had to use the "While" statement

Scriptname aaDSoSFlyingObjects extends ObjectReference  

{Allows a single item per script to move around 5 markers continuously. This will only happen while the player is in the current cell, hopefully.}


Import Debug

Import Utility


ObjectReference property MyMovingObject Auto

ObjectReference property myTarget01 Auto

ObjectReference property myTarget02 Auto

ObjectReference property myTarget03 Auto

ObjectReference property myTarget04 Auto

ObjectReference property myTarget05 Auto


int Property MySpeed Auto


Event OnCellAttach()


        While (MyMovingObject.GetParentCell() == Game.GetPlayer().GetParentCell())

            MyMovingObject.TranslateToRef(myTarget01, MySpeed, 100)

                wait(0.5)

            MyMovingObject.TranslateToRef(myTarget02, MySpeed, 100)

                wait(0.5)

            MyMovingObject.TranslateToRef(myTarget03, MySpeed, 100)

                wait(0.5)

            MyMovingObject.TranslateToRef(myTarget04, MySpeed, 100)

                wait(0.5)

            MyMovingObject.TranslateToRef(myTarget05, MySpeed, 100)

                wait(0.5)

        EndWhile

EndEvent

now just to figure out how to make sure "MyMovingObject" is at "MyTargetXX" before moving to the next "myTargetxx"

I tried what you said willie, but it had still only made one rotation.

Link to comment
Share on other sites

okay... I've been working on learning GetPOS X, Y, X and I'm getting it slowly, but I've ran into a problem that I can not seem to fix.

Scriptname aaDSoSFlyingObjects extends ObjectReference  

{Allows a single item per script to move around 5 markers continuously. This will only happen while the player is in the current cell, hopefully.}


Import Debug

Import Utility


ObjectReference property MyMovingObject Auto

ObjectReference property myTarget01 Auto

ObjectReference property myTarget02 Auto

ObjectReference property myTarget03 Auto

ObjectReference property myTarget04 Auto

ObjectReference property myTarget05 Auto


int Property MySpeed Auto


Event OnCellAttach()


		Float MyMovingObjectX = MyMovingObject.GetPositionX()

		Float MyMovingObjectY = MyMovingObject.GetPositionY()

		Float MyMovingObjectZ = MyMovingObject.getPositionZ()


		Float OBJ1PosX = myTarget01.GetPositionX()

		Float OBJ1PosY = myTarget01.GetPositionY()

		Float OBJ1PosZ = myTarget01.GetPositionZ()


		Float OBJ2PosX = myTarget02.GetPositionX()

		Float OBJ2PosY = myTarget02.GetPositionY()

		Float OBJ2PosZ = myTarget02.GetPositionZ()


		Float OBJ3PosX = myTarget03.GetPositionX()

		Float OBJ3PosY = myTarget03.GetPositionY()

		Float OBJ3PosZ = myTarget03.GetPositionZ()


		Float OBJ4PosX = myTarget04.GetPositionX()

		Float OBJ4PosY = myTarget04.GetPositionY()

		Float OBJ4PosZ = myTarget04.GetPositionZ()


		Float OBJ5PosX = myTarget05.GetPositionX()

		Float OBJ5PosY = myTarget05.GetPositionY()

		Float OBJ5PosZ = myTarget05.GetPositionZ()


		While (MyMovingObject.GetParentCell() == Game.GetPlayer().GetParentCell())


				If MyMovingObjectX == OBJ1PosX

					If MyMovingObjectY == OBJ1PosY

						If MyMovingObjectZ == OBJ1PosZ

							MyMovingObject.TranslateToRef(MyTarget01, MySpeed)

						EndIf

					EndIf

				EndIf


				If MyMovingObjectX == OBJ2PosX

					If MyMovingObjectY == OBJ2PosY

						If MyMovingObjectZ == OBJ2PosZ

							MyMovingObject.TranslateToRef(MyTarget02, MySpeed)

						EndIf

					EndIf

				EndIf


				If MyMovingObjectX == OBJ3PosX

					If MyMovingObjectY == OBJ3PosY

						If MyMovingObjectZ == OBJ3PosZ

							MyMovingObject.TranslateToRef(MyTarget03, MySpeed)

						EndIf

					EndIf

				EndIf


				If MyMovingObjectX == OBJ4PosX

					If MyMovingObjectY == OBJ4PosY

						If MyMovingObjectZ == OBJ4PosZ

							MyMovingObject.TranslateToRef(MyTarget04, MySpeed)

						EndIf

					EndIf

				EndIf


				If MyMovingObjectX == OBJ5PosX

					If MyMovingObjectY == OBJ5PosY

						If MyMovingObjectZ == OBJ5PosZ

							MyMovingObject.TranslateToRef(MyTarget05, MySpeed)

						EndIf

					EndIf

				EndIf


		wait(0.5)


		EndWhile

EndEvent

My object never moves from its initial location (off to the side of MyTarget01).

All properties are set correctly. The 5 items that I have this script on do not move.

I need help with this.

Edited by DsoS
Link to comment
Share on other sites

OnCellAttach still only executes one time.

Are you sure its even running?

You could use an 'OnUpdate' block.

And in an 'OnInit' block, set how often you want it to run.

 
[color="#a6dce9"]registerForUpdate[/color][color="#cde8b1"]([/color][color="#eadead"]0.25[/color][color="#cde8b1"])[/color]
[/CODE]

This is what I use the quest script for.

Link to comment
Share on other sites

yes, the OnCellAttach works... I've even coc'd out of the area and coc'd back and they continued to run (as long as I'm in that cell)... My previous version worked correctly but the Wait(x.x), it was messing the movement up and making the MovingObject clip into the object its moving around.

I think its something to do with the GetPos stuff.

The MyMovingObject, refuses to move at all since I added the GetPos stuff.

Edited by DsoS
Link to comment
Share on other sites

The ones you want updated need to go inside the 'while' block.

As I keep saying, 'OnCellAttach' only executes one time. But since you have a while block, that little bit keeps going until the 'while' condition is met.

Hey Willie, I got it mostly working last night, but before I could post the new script the site went down. Once I get home today I'll post the new script up.

Link to comment
Share on other sites

okay for an update... I've got it working like I envisioned it to work with the exception of the pause between each of the translation parts...

Scriptname aaDSoSFlyingObjects extends ObjectReference  

{Allows a single item per script to move around 5 markers continuously. This will only happen while the player is in the current cell, hopefully.}


Import Debug

Import Utility


ObjectReference property MyMovingObject Auto

ObjectReference property myTarget01 Auto

ObjectReference property myTarget02 Auto

ObjectReference property myTarget03 Auto

ObjectReference property myTarget04 Auto

ObjectReference property myTarget05 Auto


int Property MySpeed Auto


Event OnCellAttach()

	While (MyMovingObject.GetParentCell() == Game.GetPlayer().GetParentCell())


	Float MyMovingObjectX = MyMovingObject.GetPositionX()

	Float MyMovingObjectY = MyMovingObject.GetPositionY()

	Float MyMovingObjectZ = MyMovingObject.getPositionZ()


	Float OBJ1PosX = myTarget01.GetPositionX()

	Float OBJ1PosY = myTarget01.GetPositionY()

	Float OBJ1PosZ = myTarget01.GetPositionZ()


		If MyMovingObjectX == OBJ1PosX

			If MyMovingObjectY == OBJ1PosY

				If MyMovingObjectZ == OBJ1PosZ

					MyMovingObject.TranslateToRef(MyTarget02, MySpeed)

				EndIf

			EndIf

		EndIf


	Float OBJ2PosX = myTarget02.GetPositionX()

	Float OBJ2PosY = myTarget02.GetPositionY()

	Float OBJ2PosZ = myTarget02.GetPositionZ()


		If MyMovingObjectX == OBJ2PosX

			If MyMovingObjectY == OBJ2PosY

				If MyMovingObjectZ == OBJ2PosZ

					MyMovingObject.TranslateToRef(MyTarget03, MySpeed)

				EndIf

			EndIf

		EndIf


	Float OBJ3PosX = myTarget03.GetPositionX()

	Float OBJ3PosY = myTarget03.GetPositionY()

	Float OBJ3PosZ = myTarget03.GetPositionZ()


		If MyMovingObjectX == OBJ3PosX

			If MyMovingObjectY == OBJ3PosY

				If MyMovingObjectZ == OBJ3PosZ

					MyMovingObject.TranslateToRef(MyTarget04, MySpeed)

				EndIf

			EndIf

		EndIf


	Float OBJ4PosX = myTarget04.GetPositionX()

	Float OBJ4PosY = myTarget04.GetPositionY()

	Float OBJ4PosZ = myTarget04.GetPositionZ()


		If MyMovingObjectX == OBJ4PosX

			If MyMovingObjectY == OBJ4PosY

				If MyMovingObjectZ == OBJ4PosZ

					MyMovingObject.TranslateToRef(MyTarget05, MySpeed)

				EndIf

			EndIf

		EndIf


	Float OBJ5PosX = myTarget05.GetPositionX()

	Float OBJ5PosY = myTarget05.GetPositionY()

	Float OBJ5PosZ = myTarget05.GetPositionZ()


		If MyMovingObjectX == OBJ5PosX

			If MyMovingObjectY == OBJ5PosY

				If MyMovingObjectZ == OBJ5PosZ

					MyMovingObject.TranslateToRef(MyTarget01, MySpeed)

				EndIf

			EndIf

		EndIf


	EndWhile

EndEvent

any reason why it would be pausing for about 1/2 second like that?

Link to comment
Share on other sites

Is there a pause? I don't see any pause code.

there is a pause, once the MyMovingObject is on the X, Y, Z of MyTargetxx, it pauses for about 1/2 a second, then proceeds to the next MyTargetxx, then it does the same.

And with a float, is it possible for the script to run when the objects are 'exactly' equal to each other on the X, Y and Z positions? Probably not.

I'm not sure what you are asking. I really don't know anything about Floats, that was my first ones that I've used :shrug:

Link to comment
Share on other sites

A 'float' goes out 4 decimal places. So unless you are stopping the object at 'exactly' the same value, your IF will never be equal.


If MyMovingObjectX == OBJ3PosX
If MyMovingObjectY == OBJ3PosY
If MyMovingObjectZ == OBJ3PosZ
[/CODE] If you want it to pause, you have to code for that. Before moving to the next leg of the path.
[CODE]
If MyMovingObjectX == OBJ1PosX
If MyMovingObjectY == OBJ1PosY
If MyMovingObjectZ == OBJ1PosZ
utility.wait(10)
MyMovingObject.TranslateToRef(MyTarget02, MySpeed)

Edited by WillieSea
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...