script_mover activated by a certain team?


(denizsi) #1

Like team doors… I’m sure this was asked at some point but I just couldn’t find it. Seriously these forums need a better stronger, more detailed search engine. Anyway, back to the question:

Since the tanks in goldrush and fueldump can only be activated by allied team by means of touching, I thought maybe it could be possible to make a script_mover “usable” by only one team as well. I want to make a team door with a script_mover if possible. Don’t ask why, don’t tell me to use func_door_rotating with allowteams, there’s a reason I need a team script_mover door type thing. Just tell me if it’s possible :wink:


(Ifurita) #2

trigger_multiple is what you want to search for


(Loffy) #3

Ifurita is right. Make a trigger_multiple. Select it and hit “N” to bring up a small window. In that window, mark “Allies only” (or Axis only").


(denizsi) #4

Thanks

Searching, I’ve only found answers to area triggers, which trigger the script_mover when a player steps into it. But I need to manually “activate” the thing. So, replacing func_invisibler_user with a trigger_multiple so that it opens and closes continiously in a loop, is not what I’m looking for.

should I add a seperate multiple_trigger and have it target have func_invisible_user, or vice versa? or something totally else?


(Loffy) #5

Is this what you want:
There is a door. An allied player (or axis) sees it, and walks up to it. He cannot open the door. (Axis players cannot open it.)
Near the door there is a lever (or a button or something similar). As he approaches the lever, he sees the “use” symbol on his screen. (A hand.) He presses his use key (“F”), and the lever moves. The door opens.
And only Allies can do that. If an Axis player walks up to the level, he sees no “use” symbol. (no hand.)
Right?
//Loffy


(denizsi) #6

Yes, but I don’t want a lever or a button or whatever to open the door. Just the door itself.

So actually, if I could do just what you said, I would simply make the button itself big enough to be a door.

So, how? :slight_smile:


(EB) #7

…is this life or death here ?

One way, Script a trigger_multiple to activate the func_invis_user(scripting this leaves many options open). The trigger_multiple would go around the func_invis_user, but not extend to the ground(as a body in limbo may leave the switch activatable).


(Loffy) #8

You are on the right track.
There are some different ways to solve this. This idea of yours might work “I would simply make the button itself big enough to be a door.” Try it! One mapper that I know (Drakir) really likes buttons. He uses them all the time for different things in maps.
This is what I would do:

  1. Make a door. Turn it into a script mover. Give it the scriptname and targetname “sm_allidoor”. Dont forget that all script movers must have an origin brush.
    Write a script for that script mover. The script will have a section called “trigger rotate”. That section will call the script mover and make it rotate and wait, then rotate back (i.e. open and let people in and out, and then close).
  2. Surround the door with an trigger_multiple. Select it and hit “N”. Give it the scriptname and targetname “tm_whatever”. Make it “Allies only” (or “Axis only”). Give it the key/value “wait”/“5” (which means the players can only use it every 5th second).
  3. Then make a target_script_trigger. Write a script for that target_script_trigger (see below). Select it and hit “N”. Give it the scriptname and targetname “tst_allidoor”, and give it the key/value “target”/“open”. What this means is that the target_script_trigger will fire the code section “trigger open” (see below) inside the script for the target_script_trigger.
    Phew :slight_smile:

The trigger_multiple (“tm_whatever”) must target the target_script_trigger (“tst_allidoor”) for this to work.

In sum: The player steps into the trigger multiple. That will automatically fire the target_script_trigger. That will in turn execute the section “trigger open”, which will in turn activate the section “trigger rotate” for the script mover “sm_allidoor”.

About “setrotation”: It sets the rotational velocity of an entity. You can control the x y and z rotation (pitchspeed, yawspeed, rollspeed). The command to stop the rotation is: stoprotation (Stops the rotational velocity of an entity).


sm_allidoor // The Allied door (a script_mover).
{
	spawn
	{
	wait 50
	}

	trigger rotate
	{
	setrotation 0 0 100 // Open door
	wait 500
	stoprotation
	wait 2500 // Give people time to go in/out.
	setrotation 0 0 -100 // Close door 
	wait 500
	stoprotation 
	}
}

tst_allidoor // The target_script_trigger for the Allied door.
{
	spawn
	{
	wait 50
	}

	trigger open
	{
	trigger sm_allidoor rotate
	}
}

The script mover will rotate around the centre of the origin brush.
//Loffy

EDIT: I’ve added a script, with wait commands and stuff.


(denizsi) #9

Surround the door with an trigger_multiple. Make it “Allies only” (or “Axis only”). Make a target_script_trigger. The trigger_multiple must target the target_script_trigger.
Write a script for that target_script_trigger.

ahh finally, thanks! that’s the answer I’ve been looking for. I’ve already had the door itself, I just couldn’t figure out where to put trigger_multiple among all these.

btw, I’m using faceangles instead of setrotation. I don’t know if there’s any disadvantage to that over the other. but I know ‘wait’ won’t work for faceangles. does it work for setrotation?


(Loffy) #10

You can also add a speaker, name it “s_allidoor” and make it play a cool sound.
Then just add “alertentity s_allidoor” to the script for the target_script_trigger (below):


tst_allidoor // The target_script_trigger for the Allied door. 
{ 
   spawn 
   { 
   wait 50 
   } 

   trigger open 
   { 
   trigger sm_allidoor rotate 
   alertentity s_allidoor // Cool sound, when the door is used.
   } 
} 


(denizsi) #11

well… it won’t work. I tried it in my map. Then I made a new map doing everything just like you said, just in case I screwed up with names somewhere, but that didn’t work either. Here’s the map. Using the script you posted.

// entity 0
{
"mapcoordsmaxs" "-256 256"
"mapcoordsmins" "256 -256"
"classname" "worldspawn"
// brush 0
{
( 144 128 -64 ) ( -112 128 -64 ) ( -112 -128 -64 ) chateau/walltest_c07a 0 0 0 0.500000 0.500000 0 0 0
( -128 -128 64 ) ( 128 -128 64 ) ( 128 -128 48 ) chateau/walltest_c07a 0 0 0 0.500000 0.500000 0 0 0
( 128 -128 64 ) ( 128 128 64 ) ( 128 128 48 ) chateau/walltest_c07a 0 0 0 0.500000 0.500000 0 0 0
( 128 128 64 ) ( -128 128 64 ) ( -128 128 48 ) chateau/walltest_c07a 0 0 0 0.500000 0.500000 0 0 0
( -128 128 64 ) ( -128 -128 64 ) ( -128 -128 48 ) chateau/walltest_c07a 0 0 0 0.500000 0.500000 0 0 0
( -112 128 -48 ) ( 144 128 -48 ) ( -112 -128 -48 ) chateau/walltest_c07a 0 0 0 0.500000 0.500000 0 0 0
}
// brush 1
{
( -128 -128 128 ) ( -128 128 128 ) ( 128 128 128 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( -128 -128 64 ) ( 128 -128 64 ) ( 128 -128 48 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( 128 -128 64 ) ( 128 128 64 ) ( 128 128 48 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( 128 128 64 ) ( -128 128 64 ) ( -128 128 48 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( -128 128 64 ) ( -128 -128 64 ) ( -128 -128 48 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( -128 128 112 ) ( -128 -128 112 ) ( 128 128 112 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
}
// brush 2
{
( 144 128 -64 ) ( -112 128 -64 ) ( -112 -128 -64 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( -128 -128 128 ) ( -128 128 128 ) ( 128 128 128 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( -128 -128 64 ) ( 128 -128 64 ) ( 128 -128 48 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( 128 -128 64 ) ( 128 128 64 ) ( 128 128 48 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( -128 128 64 ) ( -128 -128 64 ) ( -128 -128 48 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( 128 -112 64 ) ( -128 -112 64 ) ( 128 -112 48 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
}
// brush 3
{
( 144 128 -64 ) ( -112 128 -64 ) ( -112 -128 -64 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( -128 -128 128 ) ( -128 128 128 ) ( 128 128 128 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( -128 -128 64 ) ( 128 -128 64 ) ( 128 -128 48 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( 128 -128 64 ) ( 128 128 64 ) ( 128 128 48 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( 128 128 64 ) ( -128 128 64 ) ( -128 128 48 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( 112 128 64 ) ( 112 -128 64 ) ( 112 128 48 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
}
// brush 4
{
( 144 128 -64 ) ( -112 128 -64 ) ( -112 -128 -64 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( -128 -128 128 ) ( -128 128 128 ) ( 128 128 128 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( 128 -128 64 ) ( 128 128 64 ) ( 128 128 48 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( 128 128 64 ) ( -128 128 64 ) ( -128 128 48 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( -128 128 64 ) ( -128 -128 64 ) ( -128 -128 48 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( -128 112 64 ) ( 128 112 64 ) ( -128 112 48 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
}
// brush 5
{
( 144 128 -64 ) ( -112 128 -64 ) ( -112 -128 -64 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( -128 -128 128 ) ( -128 128 128 ) ( 128 128 128 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( -128 -128 64 ) ( 128 -128 64 ) ( 128 -128 48 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( 128 128 64 ) ( -128 128 64 ) ( -128 128 48 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( -128 128 64 ) ( -128 -128 64 ) ( -128 -128 48 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
( -112 -128 64 ) ( -112 128 64 ) ( -112 -128 48 ) skies/sd_batterysky 0 0 0 0.500000 0.500000 0 0 0
}
// brush 6
{
( 72 40 -48 ) ( 56 40 -48 ) ( 56 28 -48 ) metal_misc/ametal_m04a -72 0 0 0.500000 0.500000 134217728 0 0
( 56 28 48 ) ( 56 40 48 ) ( 72 40 48 ) metal_misc/ametal_m04a -72 0 0 0.500000 0.500000 134217728 0 0
( 56 28 48 ) ( 72 28 48 ) ( 72 28 -48 ) metal_misc/ametal_m04a -72 0 0 0.500000 0.500000 134217728 0 0
( 72 28 48 ) ( 72 40 48 ) ( 72 40 -48 ) metal_misc/ametal_m04a 0 0 0 0.500000 0.500000 134217728 0 0
( 72 44 48 ) ( 56 44 48 ) ( 56 44 -48 ) metal_misc/ametal_m04a -72 0 0 0.500000 0.500000 134217728 0 0
( 56 40 48 ) ( 56 28 48 ) ( 56 28 -48 ) metal_misc/ametal_m04a 0 0 0 0.500000 0.500000 134217728 0 0
}
// brush 7
{
( 56 -32 48 ) ( 56 -44 48 ) ( 56 -44 -48 ) metal_misc/ametal_m04a 0 0 0 0.500000 0.500000 134217728 0 0
( 72 -28 48 ) ( 56 -28 48 ) ( 56 -28 -48 ) metal_misc/ametal_m04a -72 0 0 0.500000 0.500000 134217728 0 0
( 72 -44 48 ) ( 72 -32 48 ) ( 72 -32 -48 ) metal_misc/ametal_m04a 0 0 0 0.500000 0.500000 134217728 0 0
( 56 -44 48 ) ( 72 -44 48 ) ( 72 -44 -48 ) metal_misc/ametal_m04a -72 0 0 0.500000 0.500000 134217728 0 0
( 56 -44 48 ) ( 56 -32 48 ) ( 72 -32 48 ) metal_misc/ametal_m04a -72 0 0 0.500000 0.500000 134217728 0 0
( 72 -32 -48 ) ( 56 -32 -48 ) ( 56 -44 -48 ) metal_misc/ametal_m04a -72 0 0 0.500000 0.500000 134217728 0 0
}
// brush 8
{
( 76 44 48 ) ( 56 44 48 ) ( 56 28 48 ) metal_misc/ametal_m04a -72 0 0 0.500000 0.500000 134217728 0 0
( 56 32 60 ) ( 56 48 60 ) ( 76 48 60 ) metal_misc/ametal_m04a -72 0 0 0.500000 0.500000 134217728 0 0
( 56 -48 60 ) ( 76 -48 60 ) ( 76 -48 48 ) metal_misc/ametal_m04a -72 0 0 0.500000 0.500000 134217728 0 0
( 76 28 60 ) ( 76 44 60 ) ( 76 44 48 ) metal_misc/ametal_m04a 0 0 0 0.500000 0.500000 134217728 0 0
( 76 48 60 ) ( 56 48 60 ) ( 56 48 48 ) metal_misc/ametal_m04a -72 0 0 0.500000 0.500000 134217728 0 0
( 52 44 60 ) ( 52 28 60 ) ( 52 28 48 ) metal_misc/ametal_m04a 0 0 0 0.500000 0.500000 134217728 0 0
}
}
// entity 1
{
"origin" "-84 36 -20"
"classname" "team_CTF_bluespawn"
}
// entity 2
{
"origin" "-88 -16 -20"
"classname" "team_CTF_redspawn"
}
// entity 3
{
"origin" "-84 -60 -20"
"classname" "info_player_deathmatch"
}
// entity 4
{
"origin" "-40 -12 -8"
"classname" "team_WOLF_objective"
}
// entity 5
{
"scriptname" "sm_allidoor"
"targetname" "sm_allidoor"
"spawnflags" "2"
"classname" "script_mover"
// brush 0
{
( 76 -20 -48 ) ( 56 -20 -48 ) ( 56 -36 -48 ) common/origin 0 0 0 0.500000 0.500000 0 15 0
( 56 -36 48 ) ( 56 -20 48 ) ( 76 -20 48 ) common/origin 0 0 0 0.500000 0.500000 0 15 0
( 56 -30 48 ) ( 76 -30 48 ) ( 76 -30 -48 ) common/origin 0 0 0 0.500000 0.500000 0 15 0
( 68 -36 48 ) ( 68 -20 48 ) ( 68 -20 -48 ) common/origin 0 0 0 0.500000 0.500000 0 15 0
( 76 -22 48 ) ( 56 -22 48 ) ( 56 -22 -48 ) common/origin 0 0 0 0.500000 0.500000 0 15 0
( 60 -20 48 ) ( 60 -36 48 ) ( 60 -36 -48 ) common/origin 0 0 0 0.500000 0.500000 0 15 0
}
// brush 1
{
( 62 36 128 ) ( 62 -60 128 ) ( 62 -60 -64 ) doors/door_m01asml_axis 64 128 0 -0.437500 0.375000 0 0 0
( 76 28 128 ) ( 60 28 128 ) ( 60 28 -64 ) doors/door_m01asml_axis -64 128 0 -0.062500 0.375000 0 0 0
( 66 -60 128 ) ( 66 36 128 ) ( 66 36 -64 ) doors/door_m01asml_axis 64 128 0 -0.437500 0.375000 0 0 0
( 60 -28 112 ) ( 76 -28 112 ) ( 76 -28 -80 ) doors/door_m01asml_axis -64 128 0 -0.062500 0.375000 0 0 0
( 60 -60 48 ) ( 60 36 48 ) ( 76 36 48 ) doors/door_m01asml_axis -64 128 0 -0.062500 0.218750 0 0 0
( 76 36 -48 ) ( 60 36 -48 ) ( 60 -60 -48 ) doors/door_m01asml_axis -64 128 0 -0.062500 0.218750 0 0 0
}
}
// entity 6
{
"targetname" "tst_allidoor"
"scriptname" "tst_allidoor"
"origin" "36 0 0"
"classname" "target_script_trigger"
}
// entity 7
{
"target" "tst_allidoor"
"spawnflags" "2"
"classname" "trigger_multiple"
// brush 0
{
( -8 56 128 ) ( -8 -40 128 ) ( -8 -40 -64 ) common/trigger 0 0 0 0.500000 0.500000 0 7 0
( 76 44 128 ) ( 60 44 128 ) ( 60 44 -64 ) common/trigger 0 0 0 0.500000 0.500000 0 7 0
( 144 -60 128 ) ( 144 36 128 ) ( 144 36 -64 ) common/trigger 0 0 0 0.500000 0.500000 0 7 0
( 62 -44 112 ) ( 78 -44 112 ) ( 78 -44 -80 ) common/trigger 0 0 0 0.500000 0.500000 0 7 0
( 60 -60 48 ) ( 60 36 48 ) ( 76 36 48 ) common/trigger 0 0 0 0.500000 0.500000 0 7 0
( 76 36 -48 ) ( 60 36 -48 ) ( 60 -60 -48 ) common/trigger 0 0 0 0.500000 0.500000 0 7 0
}
}

(EB) #12

If you had script_mover switches, then I could understand all of this work, but considering it is a regular door as a script_mover ?!!

I still see no difference to a func_door or rotating_door with tweaked settings and the road you’re on.
I just went and loaded that map to see what you’re doing and it seems to be the hard way to a very easy door. Am I just brain dead ?..I am glad you’re on the case Loffy :bump:.


(Loffy) #13

It might be easier to have a trigger multiple target a rotating door. Don’t forget to enter wait/5 for the trigger multiple (door can only be opened every 5th second). The door also needs an origin brush.
//Loffy


(denizsi) #14

well, what I’m trying to do is this:
this script_mover’s gotta function as a team door and here’s why:

when a player opens this door, that will prevent another script from being run. Which means, if a player opens the door, something else will not be able to be triggered until the door is closed. And once that other thing is triggered, this door will not be able to be opened.

Surely, I could make this door disappear and another thing which won’t function as a door appear instead when that other thing is triggered, but that won’t do it for me.

For you to understand totally, the exact thing I’m trying to do is this:

A big gate, with a door on it. You know, like those gates in a fire station. The gate is controlled by a switch, but the door should be a team door. So when you open the gate, this door can not be opened until the gate is closed again. And when the gate is completely closed, and if you open the door, you can’t not hit the switch until the door is closed again.

At the moment, I have a pretty simple but kind of ugly working solution to this. Here it goes:

The gate consists of 2 seperate script_movers. First is the gate itself with a hole on it where the door should be. The 2nd one is the door which fills that hole.

When the gate is sealed closed, that 2nd script_mover door is invisible and there’s a func_door_rotating instead of it. Whenever you hit the switch, the func_door_rotating is setstate invisible and the script_mover door is default, so the gate and the door opens as one. But this could look ugly when someone opens the door and someone else hits the switch right after that. The rotating door will suddenly be shut

If I can not have a script_mover team door, what I achieved above will do it, but why stop there if I can do better?


(denizsi) #15

well, my script_mover door in test map I posted above does have its origin brush with it. And why use trigger_multiple with a rotating_door while we have allowteams keys?
Anyway, I explained what I’m trying to achieve above, if it’s doable, then I have to do it


(Loffy) #16

I see. That sounds like a cool idea.
You need to use globalaccums. When the game starts, the globalaccum is set to 0. When the gate is in use, it is set to 1, and when the gate is back in its original place the globalaccum is set back to 0. When the door is is used, it is set to 2 - when door is back the globalaccum is set to 0 again.
Then script it like this: Gate cannot be used if globalaccum is 2. Door cannot be used if globalaccum is 1.
Keep on mapping!
//L.


(denizsi) #17

Yeah I know, thanks, but first I need to have a working script_mover as a team door don’t I :wink:

I wonder if anyone has ever done that, team door script_mover.

Any workaround suggestions?
Like, is it possible to trigger something else when I simply open the usual func_door_rotating? That would do it too, but I doubt it’s possible.

//EDIT//

Oh wait, you mean I could pull this off by using a simple func_door_rotating with globalaccums?


(Loffy) #18

I mean that this problem “…when someone opens the door and someone else hits the switch right after that. The rotating door will suddenly be shut” can be solved using globalaccums. Script it so that it is not possible to hit the switch when the door is opened and vice versa.
//Loffy


(denizsi) #19

But I can not use globalaccums with a func_door_rotating, right? I mean, in scripting is there a way to make the engine check if and when such an entity is in use? since there’s no telling what command a func_door_rotating triggers when a player opens a door…

If I were using a script_mover, sure that would work with global accums. but as far as I know, using a func_door_rotating won’t do it. wrong?


(Loffy) #20

I would code it so that the gate cannot be used in 5 seconds when the func_door_rotating is used.
When the func_door_rotating is used, the globalaccum value is changed into something that the gate script will not accept. After 5 seconds, the value is changed back to (to a value that the gate will accept).
func_door_rotating > target_script_trigger > globalaccum is changed > wait 5000 > globalaccum is changed back.
Note: this is based on the assumption that the func_door_rotating will open and close within 5 seconds.