Hatch

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
Zip
Major
Posts: 323
Joined: Wed Apr 09, 2003 6:47 pm
Location: Belgium

Hatch

Post by Zip »

I'm trying to make a floor hatch that opens upwards. It's supposed to be a secret hatch on a wooden floor that leads down to some tunnels. I think there's one like it in Malta (Spearhead)

I figured it would be the same as a rotating door, but on its side, so I used an origin and made my hatch brush too, but it opens like a normal door and looks silly :oops:

I've tried using different angles and 'U' (i assume 'U' means 'Up'??) , but I've had no success :cry: Am I going about this the right way? If I am doing it right, maybe MOHRadiant is playing silly buggers with me again!

Thanks
Zip :?
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Nope

Post by tltrude »

You have to script hatches. Make it a script_object with a trigger.
Here's a tutorial map/script with a hatch:

http://pages.sbcglobal.net/tltrude/Temp/door2.zip
Tom Trude,

Image
User avatar
Zip
Major
Posts: 323
Joined: Wed Apr 09, 2003 6:47 pm
Location: Belgium

Post by Zip »

Thanks tltrude :D

I don't know much about triggers and scripts but this is how I think i should make it (please be gentle :oops: )

The Hatch:

1. Make my hatch brush and put an origin brush on the end I want the hinge to be.
2. Select the hatch brush and origin and make it a script_object.
3. Press 'n' and enter 'targetname = trap_door'
4. Deselect everything.

The Trigger:

1. Make a brush the size of my hatch out of the 'trigger' texture (does it have to be thicker than my hatch brush or can it be the same size?)
2. Make the trigger brush a trigger_use.
3. Press 'n' and enter 'targetname = trap_door_trigger'
4. Deselect everything.

The Script:

1. Open up 'Notepad'
2. Enter the following:
trap_door_mover:

$trap_door_trigger waittill trigger
$trap_door time 2
$trap_door playsound ("door_wood_open_move" + (randomint(3) + 1))
$trap_door rotateXup 90
$trap_door waitmove
$trap_door playsound door_wood_open_stop
wait 20
$trap_door playsound ("door_wood_close_move" + (randomint(1) + 1))
$trap_door rotateXdown 90
$trap_door waitmove
$trap_door playsound ("door_wood_close_stop" + (randomint(2) + 1))

goto trap_door_mover

end
3. Save it as trap_door.scr ???
4. Put it in 'Mainta' ---> 'Scripts'

That's it (Gulp!)

I am going to make quite a few of these hatchs, do I need to give each hatch a different name in 'The Hatch: No. 3' and 'The Trigger: No.3' above?

For example:

The Hatch:

3. targetname = trap_door1

The Trigger:

3. targetname = trap_door1_trigger

I don't need to change the script though???
Zip :?
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Script

Post by tltrude »

The trap door threads go in the main script for your map--the script with the same name as your bsp file.

There is no "=" sign when giving an entity its targetname. Just do:

key: targetname
Value: trap_door //or whatever name you used

As long as the targetnames in the map are the same in the script, you can make as many as you like. But, don't forget the lines at the top of the script that turn on your threads.

thread trap_door_mover
thread trap_door2_mover

Also, if your hatch is to open another direction, you may have to change these lines to the Y or Z axis:

rotateXup
rotateXdown

Good luck.

Btw, if you highlight the hatch parts and trigger in my map then open yours, it will copy it over. The trigger must be 128 units or less from the player.
Tom Trude,

Image
User avatar
Zip
Major
Posts: 323
Joined: Wed Apr 09, 2003 6:47 pm
Location: Belgium

Post by Zip »

There is no "=" sign when giving an entity its targetname
Hehe, I know, I was just writing it out in short hand :)
The trap door threads go in the main script for your map--the script with the same name as your bsp file.
I don't have a script for my map, I don't know how to do them yet :oops: ! I suppose these hatches are the first part of it!

So to make sure I get this all correct, lets assume I have 2 hatches in my map. One targetname = trap_door1 and the other targetname = trap_door2. So they'll have targetname = trap_door1_trigger and targetname = trap_door2_trigger for the triggers.

The script will look like this:
thread trap_door1_mover
thread trap_door2_mover

level waittill spawn

end

trap_door1_mover:

$trap_door1_trigger waittill trigger
$trap_door1 time 2
$trap_door1 playsound ("door_wood_open_move" + (randomint(3) + 1))
$trap_door1 rotateXup 90
$trap_door1 waitmove
$trap_door1 playsound door_wood_open_stop
wait 20
$trap_door1 playsound ("door_wood_close_move" + (randomint(1) + 1))
$trap_door1 rotateXdown 90
$trap_door1 waitmove
$trap_door1 playsound ("door_wood_close_stop" + (randomint(2) + 1))

goto trap_door1_mover

end

trap_door2_mover:

$trap_door2_trigger waittill trigger
$trap_door2 time 2
$trap_door2 playsound ("door_wood_open_move" + (randomint(3) + 1))
$trap_door2 rotateXup 90
$trap_door2 waitmove
$trap_door2 playsound door_wood_open_stop
wait 20
$trap_door2 playsound ("door_wood_close_move" + (randomint(1) + 1))
$trap_door2 rotateXdown 90
$trap_door2 waitmove
$trap_door2 playsound ("door_wood_close_stop" + (randomint(2) + 1))

goto trap_door2_mover

end
Oh, by the way it will be an objective multiplayer map for spearhead (incase that changes anything!)

Thanks a lot tltrude :D
Zip :?
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

script

Post by tltrude »

Yes, that's fine. Just add these two lines to the top of the text and you have a script!

Main:

level waittill prespawn

Name the file "yourmapname.scr" and put it in the same folder with the "yourmapname.bsp" file. Anytime you want to add more to it, just remane it "yourmapname.txt" again.

I don't know what all you need to make it into a spearhead objective script, and I don't want to learn--that game sux, ha ha. Study the scripts in mainta\pak3.pk3\maps\obj if you really want to know. But this one will work for now.
Last edited by tltrude on Wed Jun 04, 2003 10:24 am, edited 1 time in total.
Tom Trude,

Image
User avatar
Zip
Major
Posts: 323
Joined: Wed Apr 09, 2003 6:47 pm
Location: Belgium

Post by Zip »

Thanks m8 :D I'll give it a whirl.

You don't play Spearhead in multiplayer!! OMG! There are so many cool maps made for it and you can play AA maps too! Argh, ermm, baffled, eek! lol :lol: Well, everyone is different i guess, that's what makes us humans so interesting!

Thanks again tltrude :)
Zip :?
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Spearhead

Post by tltrude »

I don't like their weapons changes, and the stock maps lag.
Tom Trude,

Image
User avatar
Zip
Major
Posts: 323
Joined: Wed Apr 09, 2003 6:47 pm
Location: Belgium

Post by Zip »

I got a weapon mod for the server i play on, it's much better then. I know what you mean about the lagging, I only experience it on 'Ardennes', but that map isn't on the server rotation, so all is well. Check out www.vs-uk.net for thier server details, they use custom modded and scripted maps, you should like them :)
Zip :?
Post Reply