Jump to content

Help?


gazzxr

Recommended Posts

Hey , whats up , i'm new , and i'm learning Lua scripting , my 1st mission was to make object go up and down .

so i wrote this :

--DDC OMG generated script:

 function omgInit() 
   omg6537 = createObject(8546,-294.5478515625,1006.5712890625,144.27891540527,0,0,0) 
   omgMoveomg6537(1) 
  end 
   
 function omgMoveomg6537(point) 
  if point == 1 then 
   moveObject(omg6537,250,-294.5478515625,1006.5712890625,150.9789276133,0,0,0) 
   setTimer(omgMoveomg6537,250 + 1500, 1, 2) 
  elseif point == 2 then 
   moveObject(omg6537,250,-294.5478515625,1006,5712890625,144.27891540527,0,0,0) 
   setTimer(omgMoveomg6537,250 + 1500, 1, 2) 
  end 
 end 
  
   
   addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), omgInit) 
  

and all was OK , then when i started my resource ( script ) object just goes up, then after 1500ms it returns to its normal position . How do i make this loop? up&down? :?:

Link to comment
well when it is at point 2... it should go back to point 1 right?

So in the function omgMoveomg6537() replace the timer after the point == 2 with:

setTimer(omgMoveomg6537,1500,1,1) 

It should work then.

Damn , it does not work. i replaced it , now it looks like

  --DDC OMG generated script: 
 function omgInit() 
   omg6537 = createObject(8546,-294.5478515625,1006.5712890625,144.27891540527,0,0,0) 
   omgMoveomg6537(1) 
  end 
   
 function omgMoveomg6537(point) 
  if point == 1 then 
   moveObject(omg6537,250,-294.5478515625,1006.5712890625,150.9789276133,0,0,0) 
   setTimer(omgMoveomg6537,250 + 1500, 1, 2) 
  elseif point == 2 then 
   moveObject(omg6537,250,-294.5478515625,1006,5712890625,144.27891540527,0,0,0) 
   setTimer(omgMoveomg6537,1500,1,1) 
  end 
 end 
  
   
   addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), omgInit) 

ANd yes , it should go back to same point as it started from , at the same speed.

Link to comment

you didn't "wrote" this script, it was generated by my resource.

and unless you've edited it (and it looks like you did), it should work fine.

line 11(12):

   moveObject(omg6537,250,-294.5478515625,[color=#FF0000]1006,5712890625[/color],144.27891540527,0,0,0) 

1006,5712890625 > 1006.5712890625

fix this.

Link to comment
you didn't "wrote" this script, it was generated by my resource.

and unless you've edited it (and it looks like you did), it should work fine.

line 11(12):

   moveObject(omg6537,250,-294.5478515625,[color=#FF0000]1006,5712890625[/color],144.27891540527,0,0,0) 

1006,5712890625 > 1006.5712890625

fix this.

Silly me , stupid mistakes >.> , thanks man , it realy helpd , but i'm still not getting it to go up&down all the time... looping.

AND YES , its Copied from you're program (OMG) so i "Wrote" it down...

Useful dough...

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