want to simplify scripting...help please

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
G3mInI
First Lieutenant
Posts: 187
Joined: Sat Jun 29, 2002 3:49 am

want to simplify scripting...help please

Post 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
*Area51*G3mInI****Gen

http://www.area51moh.com
Elgan
Site Admin
Posts: 890
Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:

Post 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

lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post 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] ....
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
User avatar
G3mInI
First Lieutenant
Posts: 187
Joined: Sat Jun 29, 2002 3:49 am

Post 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
*Area51*G3mInI****Gen

http://www.area51moh.com
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post 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 :)
Last edited by jv_map on Thu Feb 10, 2005 12:03 pm, edited 1 time in total.
Image
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

actually i coded that wrong anyway :oops:

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 ;)
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

local.thing[1][2] would be the proper way.
Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post 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 .
Image
User avatar
G3mInI
First Lieutenant
Posts: 187
Joined: Sat Jun 29, 2002 3:49 am

Post 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
*Area51*G3mInI****Gen

http://www.area51moh.com
Post Reply