Jump to content

Movement problem


Al Pacino

Recommended Posts

First of all, Hello. :)

I got a small problem with one script that I tryed to create.

Well, its my first script, so probably you can see many errors. And after many desparate trys, I gave up and asked here for help.

In short words : Im a newbie. :?

function createShip ()
pirateShip = createObject ( 8493, 2458, -2718, 15, 0, 0, 273 )
setTimer ( startShip, 60000, 1 )
end
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createShip )
 
function startShip ()
moveObject ( pirateShip, 120000, 2800, -2718, 15 )
end
 
function moveShip ()
moveObject ( pirateShip, 120000, 3000, -2190, 15, 0, 0, -183 )
end

As you can see, Im trying to make a floating pirateship. Through the whole San Andreas. Of course I just posted the start, because I couldnt continue.

The problem is the following :

After starting the resource, the ship appears and remains 60 seconds at the spawnpoint.

When starting, it moves to the coordinates (startShip), but when it comes there, it just stops and wont move anymore.

I dont know what the problem is, I tryed many times to edit the script ect. But nothing helped. (Yes, I even readed the wiki, but it didnt help too.)

Hopefully you guys can help me with this.

Thanks in advance :

-AlPacino

Link to comment

First of all, Hello. :)

I got a small problem with one script that I tryed to create.

Well, its my first script, so probably you can see many errors. And after many desparate trys, I gave up and asked here for help.

In short words : Im a newbie. :?

function createShip ()	pirateShip = createObject ( 8493, 2458, -2718, 15, 0, 0, 273 )	setTimer ( startShip, 60000, 1 )endaddEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createShip ) function startShip ()	moveObject ( pirateShip, 120000, 2800, -2718, 15 )end function moveShip ()	moveObject ( pirateShip, 120000, 3000, -2190, 15, 0, 0, -183 )end

As you can see, Im trying to make a floating pirateship. Through the whole San Andreas. Of course I just posted the start, because I couldnt continue.

The problem is the following :

After starting the resource, the ship appears and remains 60 seconds at the spawnpoint.

When starting, it moves to the coordinates (startShip), but when it comes there, it just stops and wont move anymore.

I dont know what the problem is, I tryed many times to edit the script ect. But nothing helped. (Yes, I even readed the wiki, but it didnt help too.)

Hopefully you guys can help me with this.

Thanks in advance :

-AlPacino

Link to comment

the problem is probably that your second function is not used at all

function createShip ()
pirateShip = createObject ( 8493, 2458, -2718, 15, 0, 0, 273 )
setTimer ( startShip, 60000, 1 )
end
addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createShip )
 
function startShip ()
moveObject ( pirateShip, 120000, 2800, -2718, 15 )
setTimer( moveShip, 120000, 1)
end
 
function moveShip ()
moveObject ( pirateShip, 120000, 3000, -2190, 15, 0, 0, -183 )
end

like this it should work

Link to comment

the problem is probably that your second function is not used at all

function createShip ()	pirateShip = createObject ( 8493, 2458, -2718, 15, 0, 0, 273 )	setTimer ( startShip, 60000, 1 )endaddEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource () ), createShip ) function startShip ()	moveObject ( pirateShip, 120000, 2800, -2718, 15 )	setTimer( moveShip, 120000, 1)end function moveShip ()	moveObject ( pirateShip, 120000, 3000, -2190, 15, 0, 0, -183 )end

like this it should work

Link to comment

Hmm, I thought about the setTimer. I even used it, but seems like I did it wrong too. :|

Well, with the 120 seconds timer it did work. Thanks alot for your help. ^^

Edit : After watching how it goes, I noticed the ship turned on the wrong side. Now it floats backwards. >_>

Link to comment

Hmm, I thought about the setTimer. I even used it, but seems like I did it wrong too. :|

Well, with the 120 seconds timer it did work. Thanks alot for your help. ^^

Edit : After watching how it goes, I noticed the ship turned on the wrong side. Now it floats backwards. >_>

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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