Jump to content

Help for Scripting


Serrieth

Recommended Posts

MOVEMENT falling objects

 

 

This is a script that I will show to other people who have trouble with moving objects, this script is to make an object fall.

 

(Just an example)

******************************************************************

Begin MoveRockDown

 

if (MenuMode == 1)

return

endif

 

; you must have at least two shorts to start

 

short (currenttime)

short (move)

short done

float zpos ; Moves the rock or item

float xpos

float ypos

 

if (done = 1 )

return

else

endif

 

if ( "Anything to start the script or move the rock")

set currenttime to Getsecondspassed

set move to 1

else

return

endif

 

if (currenttime != Getsecondspassed)

set move to move + 1

set currenttime to Getsecondspassed

endif

 

if ( Move > (number you want) )

; this is where the script stops the timer and you can do anything here,

set move to 1

set zpos to (GetPos, Z)

set xpos to (Getpos, X) ; this is where the movement comes in

set ypos to (GetPos, Y)

 

 

set xpos to xpos + "makes the object spin"

set zpos to zpos + "How much you want to move the item or object up or down"

Position (Item or object ID), xpos, ypos, zpos

 

endif

 

if ( GetPos, Z < "Point were the object must stop, Ground")

set done to 1

set move to 0

endif

 

End

*****************************************************************

 

Functions, each function (Move and currenttime) determine the speed of the moving item.

 

Matching (Not a scripting)

 

IF

Move = 1 and zpos = 1 THEN movement will be realistic and the speed will be slow

IF

Move = 2 and zpos = 1 THEN movement will be somewhat realistic but fast moving

IF

Move = 3 and zpos = 1 THEN movement will be somewhat realistic but very fast

But the higher the Move value is then the fast the item will fall and if the zpos is lower then the realistic of the item will show, I do not know what the values must be but that is up to you to decide how fast an item should fall

 

if you have any suggestions of improvements to add to this code, or if there are any errors, please reply!

Link to comment
Share on other sites

Begin MoveRockDown

 

if (MenuMode == 1)

return

endif

 

; you must have at least two shorts to start

 

short (currenttime)

short (move)

short done

float zpos ; Moves the rock or item

float xpos

float ypos

 

if (done = 1 )

return

else

endif

 

if ( "Anything to start the script or move the rock")

set currenttime to Getsecondspassed

 

; This makes no sense -- first, you're setting a short variable equal to a float

; global, and secondly, this can't be used for much other than a framecounter,

; and an unreliable one at that because there could be two frames that take the

; exact same time to show up. I believe you're confused with the usage of

; GetSecondsPassed. This variable records how much time has passed since the

; last frame, not how many seconds have passed since CharGen.

 

set move to 1

else

return

endif

 

if (currenttime != Getsecondspassed)

set move to move + 1

set currenttime to Getsecondspassed

; Another float-to-short operation

endif

 

if ( Move > (number you want) )

; this is where the script stops the timer and you can do anything here,

set move to 1

set zpos to (GetPos, Z)

set xpos to (Getpos, X) ; this is where the movement comes in

set ypos to (GetPos, Y)

set xpos to xpos + "makes the object spin"

set zpos to zpos + "How much you want to move the item or object up or down"

Position (Item or object ID), xpos, ypos, zpos

; I believe that the only commands that take variables as arguments at this point

; are position ops that begin with "My"

endif

 

if ( GetPos, Z < "Point were the object must stop, Ground")

; Neat trick to use here -- Tribunal's new collision detection commands. Using

; them will make the movement much more realistic and will allow you to use

; virtually random spin values

 

set done to 1

set move to 0

endif

 

End

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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