gfxgfx
 
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
gfx gfx
gfx
572363 Posts in 510035 Topics by 8218 Members - Latest Member: zaq003 March 19, 2019, 12:36:19 am
*
gfx*HomeHelpSearchCalendarLoginRegistergfx
gfxgfx
0 Members and 1 Guest are viewing this topic.       « previous next »
Pages: [1] Print
Author Topic: Scripting: How to Make things Move!  (Read 10038 times)
RogueTeddyBear
1337+
******

E-Cock: 226
Offline Offline

Posts: 2891


Plastic Sealed


WWW
« on: August 12, 2006, 12:19:46 am »

This is a guide involving Mover Objects that are used to move a SpikeBlock around the map!

Included in this guide is an attatched download of a starter map and a finished product map. Please download those before continuing this guide in order to keep you from being confused.

--Before starting you may view Movers.map in nox to see the finished product

{Edit}
Quote
MoversS.map is the starting map that you work with. The scripts wont work there until you make them work.

Movers.map is the finished map that has the working script.
{edit}




1.) Getting to know Mover Objects



This is a Mover object as viewed by right clicking on it in ym finished product map.

Important Parts are highlighted (well, the ones that i know)

-Green: This is the speed at which the object will travel
-Red: This is related to connecting waypoints to create a Path. This is not used in this tut and is actualy very complicated to me. Whatever number will do for now, so i leave it 01 00 00 00
-Blue: This is the EXTENT number of the OBJECT TO BE MOVED in HEX. In our case, the spikeblock's extent number is 2, so that is 02 in hex; Hence 02 00 00 00

If the extent number of the spikeblock was 10, in hex that is 0A. So i suggest you find a converter (winhack works).

2.) Adding that modifier

Now that you know what that modifier means, we'll copy and paste it into your mover.
-Open the Starter Map "MoversS.map" in your editor.
-make a mover object anywhere in your starter map
-copy and paste this into the modifier box: 23 00 00 00 01 00 00 00 02 00 00 00 03 02 00 00 00 01 00 00 00 00 00 0c 41 00 00 0c 41
That is the same modifier in the picture above, it is correct as long as the spikblock's extent number is 2 (you can check to make sure).

Now you have a working modifier that is coded to act on the SpikeBlock

3.) Script Names

-Find the SpikeBlock, it is under a waypoint in the lower part of the walled room.
-open its properties by selecting and right clicking on it.
-check the "extra bytes" box
-A text input area should light up labeled "Script Name"
-In that box type in "MoversS:SpikeBlock"
** I have you write "MoversS" because the map name is MoversS. This is a good habit to do with Objects and i find it works more than not.

You should have this now:



4.) The Waypoints

If you havn't noticed already there are two pre-made waypoints called "goto1" and "goto2"

The spikeblock is sitting atop waypoint "goto2." There are also random blinkable waypoints outside the room (i dunno...).

5.) Starting the scripting

Open up the Scripts dialogue box by going to Map > Scripts
click the "+" next to Functions and you will notice 4 things:
  • 2 Global Functions (you always need them)
  • a useless function called StartUp that was there when i started this, dont delete it, it causes problems if you do
  • a MapInitialize function, also always needed

-Double click on the second Global function. You will see that the top has:

var0[1]
var1[1]
var2[1]
var3[1]
var4[1]
var5[1]
var6[1]

This is important because you can only have as many Global variables as there are initialized in this area (currently 7 max).
HOWEVER: var0,1,2 and 3 are SYSTEM use.. meaning you cant "define" them to anything else, else risk crashing. If you dont know what the first 4 are you can ask.

We will only be using var4, var5 and var6

-close the global fuction and double click on MapInitialize
-you will need to declare your obejcts and waypoints in this area so that the game knows where to look for them.
-copy and paste this into the bottom of the function:

Gvar4 = Object("SpikeBlock")
Gvar5 = Waypoint("goto1")
Gvar6 = Waypoint("goto2")
return

You should know see this:



6.) Making the Move Functions

-Close the MapInitialize window and right click on "Functions" > "add" (do this two times to add 2 new functions)
-Rename the first new function: "MoveTo1" and the second "MoveTo2"
-double click on MoveTo1 and in the bottom paste this:

Move(Gvar4,Gvar5)
return

You should see this:



-double click on MoveTo2 and paste this in the bottom:

Move(Gvar4,Gvar6)
return

7.) Calling the functions

Now everythings set up. All you need to do is "call" or "activate" the functions.

The easiest way to do this is to make a timer in the MapInitialize function that activates MoveTo1 and add a timer in there to activate MoveTo2 and then add a third timer in there to loop back to MoveTo1.

However, i made a lever that would activate both depending on when you pull the lever.

-Make an object called "FloorLever2", set its property from Normal to Interact, and paste this into the modifier box:

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 07 00 00 00 4d 6f 76 65 54 6f 31 00 00 00 00 01 00 07 00 00 00 4d 6f 76 65 54 6f 32 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

If you want to know what all that is about just ask and il add a little extra section. I would just assume that anyone interested would already know how to work levers/switches (but not always).

-Now test the map! If you have any problems or i made some kind of mistake, please tell me!!! (not a pm, in this topic plz).



Again Thanks to zoa/dooder/burner/blah blah blah blah whom without i could not help others in need.
« Last Edit: March 18, 2007, 06:44:24 am by RogueTeddyBear » Logged

I am teddy, ama
FF&Invisible Point
Nox Scripting Guru
Master
*

E-Cock: 16
Offline Offline

Posts: 452


If I don't die by that, what will kill me ?


WWW
« Reply #1 on: March 18, 2007, 10:46:57 am »

I also wrote something on Movers :
That's here
Logged


(by Killerz)

Nicknames :

FF and Invisible Point -- Wiz
The FonFister Daemon -- Con
The Harpooner -- War



Help us !
gfx
Pages: [1] Print 
gfx
Jump to:  
gfx
Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Page created in 0.046 seconds with 23 queries.
Helios Multi design by Bloc
gfx
Powered by MySQL Powered by PHP Valid XHTML 1.0! Valid CSS!