Page 1 of 1
want to simplify scripting...help please
Posted: Thu Feb 10, 2005 3:53 am
by G3mInI
I have several doors made out of script object. they contain two parts, an upper half and lower half. When triggered I want the door to open with the uppoer half moving up and the lower half moving down. I was thinking I could set up one large trigger to cover both sides of the door so when a player stands in the trigger it will activate the door in front of him. I am trying to do this for about 12 doors and did not want to make seperate targetnames for each trigger, lower half of door, and upper half of door. Something like:
for (local.i=1;local.i<=$lowerhalf.size;local.i++)
something like that to where i can use the same targetname for all triggers. Same targetname for all lower half door parts, and upper half door parts.
I am making a custom map, this is not a serverside script. I cant seem to figure out how to target each door part to move accordingly and how to make the trigger work so that the doors will operate correctly, without continually moving up or down. I know how to make things move and set variables for open and closed. I just cant figure out how to put it all together.
Any help most appreciated.
G3mInI
Posted: Thu Feb 10, 2005 4:20 am
by Elgan
why not have (i think this si what u mean.
2 doors. Up and down parts named up and down for this example . script objects
$up and $down
1 trigger over both sides. $trigger_door
Code: Select all
open:
$trigger_door nottriggerable
$up moveup 500
$up move
$down movedown 500
$down waitmove
while(parm.other istouching self){ waitframe} //wait while person is at door so dont close on them.
wait 1 //wait delay
//close the doors again
$trigger_door nottriggerable
$up movedown 500
$up move
$down moveup 500
$down waitmove
$trigger_door triggerable
Posted: Thu Feb 10, 2005 4:20 am
by lizardkid
i'm no sure, but can you declare 2-dimensional arrays in MoH? i know some variables use it but are they coded right in?
Code: Select all
local.thing[1] ....
local.thing[2] ....
Posted: Thu Feb 10, 2005 5:40 am
by G3mInI
Code: Select all
open:
$trigger_door nottriggerable
$up moveup 500
$up move
$down movedown 500
$down waitmove
while(parm.other istouching self){ waitframe} //wait while person is at door so dont close on them.
wait 1 //wait delay
//close the doors again
$trigger_door nottriggerable
$up movedown 500
$up move
$down moveup 500
$down waitmove
$trigger_door triggerable
open:
$trigger_door nottriggerable
$up moveup 500
$up move
$down movedown 500
$down waitmove
while(parm.other istouching self){ waitframe} //wait while person is at door so dont close on them.
wait 1 //wait delay
//close the doors again
$trigger_door nottriggerable
$up movedown 500
$up move
$down moveup 500
$down waitmove
$trigger_door triggerable
ok this makes sense to me. However how do I set it up for 12 doors that do the same in different places on the map? Or do I have to have each set of door parts and triggers have seperate targetnames?
G3m
Posted: Thu Feb 10, 2005 7:14 am
by jv_map
lizardkid wrote:i'm no sure, but can you declare 2-dimensional arrays in MoH? i know some variables use it but are they coded right in?
Code: Select all
local.thing[1] ....
local.thing[2] ....
Yes you can put arrays into arrays so that basically makes a multidimensional array... you could also use makeArray

Posted: Thu Feb 10, 2005 9:04 am
by lizardkid
actually i coded that wrong anyway
local.thing[1, 2]
think of it as a chessboard with 4x4 squares. 4 up, 4 sideways. this should make it easier, i've heard multidimensional arrays are easier on a systems memory than 1-d ones. but i doubt it makes too much difference.
either way probably works, it's just how you look at it

Posted: Thu Feb 10, 2005 12:04 pm
by jv_map
local.thing[1][2] would be the proper way.
Posted: Thu Feb 10, 2005 12:30 pm
by bdbodger
Why not just use a func_door
"angle" ( Float newAngle ) set the angles of the entity using just one value.
Sets the yaw of the entity or an up and down direction
if newAngle is [0-359] or -1 or -2
If you open the entity window you can just use the U or D key in the middle of the angle keys . If you use lip you can decide how much of a lip is showing when the door is open .
Posted: Thu Feb 10, 2005 2:54 pm
by G3mInI
bdbodger wrote:Why not just use a func_door
LOL you know its been so long since I made a custom map! This is exactly what I wanted! So very simple indeed! The whole time I was just overthinking this and trying to do it from script.
Thanks.
G3m