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...

(Greenhorn Scripter) Moving ships in distance.


satchboogie
 Share

Recommended Posts

I'm intending to create a small immersion mod that has ships moving through the sea of ghosts along preset routes. They would be enabled when the player comes within a reasonable distance, then start on their journey.
ventually I'd look into having light sources on these ships during the night, as well as having ships with rolled down sails.
he mod that gave me ''the courage'' to start trying this is Transportato by Trainwiz, but what that mod does is actually beyond what I want to achieve.
 
I am a complete beginner when it comes to Papyrus(learned quite a bit the past week or so.) Mostly by looking carefully at other scripts(Transportato's mostly) have I been able to come to the current concept.

I've placed 6 waypoints in the map, along with a ship(set to initially disabled) that has this script attached to it:
Scriptname ShipScript extends ObjectReference  
{This ship will enable when the player comes close enough, sail its route, then disable.}

ObjectReference Property waypoint01  Auto  
ObjectReference Property waypoint02  Auto  
ObjectReference Property waypoint03  Auto  
ObjectReference Property waypoint04  Auto  
ObjectReference Property waypoint05  Auto  
ObjectReference Property waypoint06  Auto 
int currentwaypoint = 0
Int Property waypointnumbers  Auto  
GlobalVariable Property hasbeenspawned  Auto  

Event OnInit() 
	RegisterForSingleUpdate(0.5)
EndEvent

Event OnUpdate()
	if(Game.GetPlayer().GetDistance(self) < 6000)
		if(hasbeenspawned.getValue() == 0)
			currentwaypoint = 1
			hasbeenspawned.setValue(1)
			enable(true)
			MoveToMyEditorLocation()
		endif
	endif
if((hasbeenspawned.GetValue())== 1)
	if(waypointnumbers >= 1)
		if(currentwaypoint == 1)
			TranslateToRef(waypoint01, 150.0, 50.0)
		endif
	endif
	if(waypointnumbers >= 2)
		if(currentwaypoint == 2)
			TranslateToRef(waypoint02, 150.0, 50.0)
		endif
	endif
	if(waypointnumbers >= 3)
		if(currentwaypoint == 3)
			TranslateToRef(waypoint03, 150.0, 50.0)
		endif
	endif
	if(waypointnumbers >= 4)
		if(currentwaypoint == 4)
			TranslateToRef(waypoint04, 150.0, 50.0)
		endif
	endif
	if(waypointnumbers >= 5)
		if(currentwaypoint == 5)
			TranslateToRef(waypoint05, 150.0, 50.0)
		endif
	endif
	if(waypointnumbers >= 6)
		if(currentwaypoint == 6)
			TranslateToRef(waypoint06, 150.0, 50.0)
		endif
	endif
endif
RegisterForSingleUpdate(0.5)
EndEvent

Event OnTranslationComplete()
	currentwaypoint += 1
EndEvent

Event OnUnload()
if((hasbeenspawned.GetValue())== 1)
	MoveToMyEditorLocation()
	hasbeenspawned.setValue(2)
	currentwaypoint = 0
	Disable(true)
endif
EndEvent

 

If anyone knows how to help me get this to actually DO anything in-game, I'd be forever in their debt. The ship doesnt spawn at all when I come near its spawn position. 
Eventually I'd want to be able to add a random aspect to this, that randomizes when the boats spawn (after 3-4-5 in-game hours for example.) This, however, I can't figure out either with my current level of skill. I'd have a few routes, some longer than the other, which would make it seem that theres a random element to each ship passing(some might overtake eachother etc.)
 
Again, any and all help appreciated enormously!
 
 
Edited by satchboogie
Link to comment
Share on other sites

Alright, so I got my ship to spawn in-game. 

The creation kit wiki has a category called Complete Example Scripts where I found this:

 
Move an Object to a Specific Location Without Fade
 
You can use this script to make an activator or actor move without fading out in any way (moveTo and setPosition cause fading to occur). Use this to make objects fly around or make the player move continuously to a destination without fade.
This example moves the player, for your entertainment.
To move something other than player, add a property of type ObjectReference and set it to the actor or activator that you want to move (I have not succeeded in moving statics, only activators and actors)
Use different Events freely, this event is used for simplicity and easy demonstration.
ScriptName MoveObjExample extends ObjectReference  
 
ScriptName MoveObjExample extends ObjectReference  
 
Actor Property PlayerREF Auto
ObjectReference Property kDest Auto
 
Event OnTriggerEnter(ObjectReference akActionRef)
	If akActionRef == PlayerREF
		akActionRef.TranslateToRef(kDest, 500.0) ; 500 is the speed value, it's pretty fast
	EndIf
EndEvent
To Make This Script Work
Make an XMarkerHeading object (search *All with "xmarker" filter), place it where you want the player to be moved to.
Click on an object in your cell and select the Trigger Volume button, the T with a box around it
Move the orange box to where you want the player to start their controlled movement to the XMarkerHeading destination.
Add this script above to the orange box/trigger volume that you created.
SET THE PROPERTY of the script instance, dest, to be your XMarkerHeading that you just made.
This example will not work if you do not set the property as I mention just above, this is an easy thing to forget in this new and wonderful language. Get used to these basics and you will find Papyrus much more powerful than prior scripting languages.
 
 
Now, the line ''I have not succeeded in moving statics, only activators and actors'' has motivated me to create an Activator with the Base of a Ship, so that it looks like one. But still, the ship does not move! I have edited the first posts code with the changes I've made recently. 

Can someone tell me why my ship won't move? :D
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...