Moving Objects with Scripts and Flipeffects
by
Wayne Scales
With TRNG we now have the power to move statics and
moveables with scripts and flipeffects to create some really cool
gameplay situations using the PARAMETERS= command. Let's get started.
First i will show you the general PARAMETER= syntax
Parameter Syntax
Parameters= Type of
parameters (PARAM_...), IdParameterList, parameter array which
goes in the level section of the NG Scripter.
Description of
syntax
Type of parameters (PARAM_...) field=
In this field you type a PARAM_ constant to describe whivh trigger is
the Parameters command. You can see the list of PARAM_ constants in the
Reference panel of NG Center program, in MNEMONIC CONSTANTS section.
IdParameterList field= This number identifies the PARAMETERS=
command in the trigger window of ngle. So, for your first Parameter
command you will type 1, for the second type 2 and so on...
Remark: you
can use same IdParameterList when you use two Parameters command with
different PARAM_ constant. It's necessary to set different ID only for
Parameters with same PARAM_ constant
Parameter
array fields=
From this (third) parameter starts the parameters
used by trigger. The number and meaning of these parameters change in
according with PARAM_ type. You can have information about different
syntax by referencing the description of specific PARAM_ constant in
Reference panel.
Here are some possible fields for Type of
parameters (PARAM_...)
PARAM_COLOR_ITEM
PARAM_MOVE_ITEM which
we will be using for this tutorial.
PARAM_PRINT_TEXT
PARAM_ROTATE_ITEM
PARAM_SET_CAMERA
Here is the
syntax we will be using to move a static or moveable:
Syntax: Paramaters=PARAM_MOVE_ITEM, IdParamList,
Flags (FMOV_...), IndexItem, Direction (DIR_...), Distance, Speed,
MovingSound, FinalSound
Field Descriptions
IdParamList field
This is a progressive number to identify
this "Parameters=PARAM_MOVE_ITEM" command script in trigger window of
ngle. You'll type 1 for your first PARAM_MOVE_ITEM command, 2 for second
etc.
Flags (FMOV_...) field
You can set one or more
FMOV_ values linked with + (plus) sign. See description in Reference
panel to get description of different FMOV_ flags.
Remark: you
can type IGNORE in this field if you don't wish use any flag. For
example, FMOV_HEAVY_AT_END, this could be used if you want to move a
static onto a death tile and make it explode using a flipeffect.
IndexItem field
This is the index you can read in yellow
frame when you click over an object in NGLE program.
Remark: you can use static or moveable anyway but you have to use the correct flipeffect in accordance with the static or moveable nature of the item.
About statics, remember statics are owned within the room they are placed and for this reason you should avoid moving statics outwith the bounds of the room.
Direction (DIR_...) field
You have to
choose one DIR_ constant to set the direction of moving. See the DIR_
list in reference panel of NGCenter program, you find it in _MNEMONIC
CONSTANTS section. Eg. DIR_SOUTH
Distance field
In this
field you set the distance of moving. The used units have as reference 1
sector = 1024, hence, 512 is half-sector, 256 is a click etc. I suggest
you always use a multiple of 256 (one click) to avoid trouble. The max
value you can type for distance is 64512, corresponding to 63 sectors.
Speed field
The speed value is the number of units that
will be added to the current position to move the item. The used units
are the same as Distance field: 1 click = 256 units. Remember that to
this speed will be added 30 times for each second, so it's better to not
exaggerate big values as speed. A reasonable speed is enclosed in the
range from 8 to 64.
Remark: It's
advisable to set as speed a value that is a perfect multiple of
distance, otherwise there will be a bit error in computing the final
distance.
Moving sound field
Optional. If you
wish to play a sound effect in looped mode while the item is moving type
a number of a sound effect here. You will find the list of sound effects
in reference panel of NG Center, in the section named "SOUND SFX indices
list".
Remark: if
you don't wish any sound type IGNORE in this field.
Final sound field
Optional. If you wish to play a sound effect
when the item reaches the final position, type a number of a sound
effect here. You will find the list of sound effects in reference panel
of NG Center, in the section named "SOUND SFX indices list".
Remark: if
you don't wish any sound type IGNORE in this field.
Study
the fields and get familar with what each one achieves. Here is a script
command that I have used to move a knight. You can also see it in the
pic above.
Parameters=PARAM_MOVE_ITEM, 1 ,FMOV_HEAVY_AT_END,
1206, DIR_NORTH, 1024, 16, 71, 143;Knight 1
Remark: If
you type ; at
the end of a script entry, the NG Center will allow you to type anything
you want after that. As you can see I have ; Knight 1, it's just handy
to keep track of things if your script get's realy long!
If you were to use this command, you would have to change the "1206" as
that is the object ID of my knight. All you have to do is replace this
with the id of the object that you want to move.
Now build your
script and it's time to open ngle. Because my object is a static I use
this flipeffect to move it:
If you want to move a moveable you would use this flipeffect:
While you're at it you can take a look at other flipeffects to see what can be achieved through the parameter command.
That's it! Trigger your flipeffect and check out the results. Have fun experimenting with all the different fields for this command.