Coding

 Reply to this postStart new topic

Is it possible...

Huckleberry Pie
post Aug 17 2009, 03:07 AM
Post #1


Ameteur Member

Posts: 49
Joined: 5-August 09



Is it possible to move objects, like an elevator, via script (SCM or CLEO)? Like, player goes to elevator, selects a floor, and then lifts them up to the desired level?
Go to the top of the page
 
+Quote Post
Spider-Vice
post Aug 17 2009, 01:19 PM
Post #2


In motus...

Group Icon

Posts: 361
From: Portugal
Joined: 28-May 09



Well, on my SCM knowledge I only know about Enex's. Still, I don't think that's possible. Ask Deji, he has way more experience in scm/CLEO than me.
Go to the top of the page
 
+Quote Post
Deji
post Aug 17 2009, 06:46 PM
Post #3


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Yeah, course!

First you need to create the elevator as a model (duh).

Then use this code:

CODE
:ELEVATE
03A4: name_thread 'ELEVATE'
029B: 0@ = init_object #ELEVATOR at 0.0 0.0 50.0 // Use if you want the object to be there permenantly.
0392: object 0@ toggle_in_moving_list 1 // Make the object movable.
0006: 1@ = 0 // Tell script elevator is down.
jump @ELEVATE_1

:ELEVATE_1
wait 0
if and
00E1:   player 0 pressed_key 4
0474:   actor $PLAYER_ACTOR near_object_in_cube 0@ radius 4.0 4.0 4.0 flag 0 // Adjust to ensure player is in lift.
else_jump @ELEVATE_1
if
0039:   1@ == 0
else_jump @ELEVATE_2 // If elevator is down, move up. If elevator is up, move down.
jump @ELEVATE_3

{--------------------------------------------------
Move object opcode can be used as both a command
and condition. Use in a wait 0 loop to keep object
moving smoothly! Once the object has fully moved by
250.0, the condition will be true and code will
continue :)
---------------------------------------------------}

:ELEVATE_2
wait 0
if
034E: move_object 0@ to 0.0 0.0 50.0 speed 0.0 0.0 0.2 flag 0
else_jump @ELEVATE_2
0006: 1@ = 0 // Tell the script that the elevator is down.
jump @ELEVATE_1


:ELEVATE_3
wait 0
if
034E: move_object 0@ to 0.0 0.0 250.0 speed 0.0 0.0 0.2 flag 0
else_jump @ELEVATE_3
0006: 1@ = 1 // Tell script that the elevator is up.
jump @ELEVATE_1


(change #ELEVATOR to whatever you elevators model is or the game will crash!)

Go to the middle of the map (countryside somewhere) and use a jetpack to get to the elevator. Press the Action key and your elevator will rise you up a few hundered meters tongue.gif - If you wanna change the speed, you can.

You'll have to configure the radius check to fit your elevators model and make sure the player is on the elevator before it goes up or down...


--------------------
Go to the top of the page
 
+Quote Post
Reply to this postStart new topic

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: