Locking a door with a script


(zakeh) #1

Hi everyone,

I’m a beginner at mapping and scripting, but I’m interested in learning, so I’ve fellowed several tutorials about this.

I want to use a script to be able to lock a door in a map.

The door is a func_door, with a targetname and a scriptname (door1)

So i wrote in the map script :

door1
{
spawn
{
wait 200
halt
}
}

But those commands don’t work.

Anyone for help or hints ?

Thanks.


(Destroy666) #2

halt? What’s this?
You need to use target_lock entity and ‘alertentity’ it in script.


(zakeh) #3

halt is used to stop movement of the current entity.

Thx for the advice, will try this right away.


(zakeh) #4

Well, I guess I’m not coding right, because these commands don’t work either.

Besides, target_lock entity is not recognized by the editor i’m using (ETscript).

Any help is welcome !

Thanks.

Here’s the code i’ve wrote :

door1
{
spawn
{
wait 200
alertentity door1
target_lock door1
}
}


(ailmanki) #5

A entitiy you place normally with the editor , such a entity can have a scriptname - thast scriptname you can use in the mapscript.

http://games.chruker.dk/enemy_territory/scripting_reference.php
http://games.chruker.dk/enemy_territory/entities.php?action=show_entity&entity_name=target_lock
http://www.planetwolfenstein.com/4newbies/Map_Scripting_4_Newbies.pdf


(Destroy666) #6

You understood me wrong.
Create target_lock entity (in Radiant). Connect it to the door you want to lock/unlock. Give it key ‘key’ value ‘0’ (unlock) or ‘-1’ (lock till unlock). Then you’ll have few possiblities. One of them - alertentity it in script (‘alertentity targetnameoftarget_lock’), for example:

blabla
{
    spawn
    {
       wait 200
    }
    
   trigger xxxx
   {
       alertentity lockdoor
   }
}