Page 1 of 1

Trigger question

Posted: Sun Dec 05, 2004 7:44 pm
by Runt
Hey all,

What i want to do is make this thing:
Image
going up or down when you stand in one trigger. And when both triggers are activated it must go up and down.. Is that possible ?

Thanks

Posted: Sun Dec 05, 2004 7:57 pm
by Splaetos
its is very possible with just a couple trigger_multiples and probably an origin. Im not sure what the ride would be like. The trigger on the ground end should always be nottriggerable while the one in the air is triggerable when someone touches the active one, a waitthread should rotate it. There are other threads here about rotating from a point of origin. As soon as the trigger in air is touched, make it nottriggerable, and after the movement is done, make the other one triggerable.

I really dont know what will happen to the people on it, but it will probably be a bumpy ride.

Posted: Sun Dec 05, 2004 8:43 pm
by Green Beret
yea,make the speed real fast,and watch them leave holding there butts. :lol:

names

Posted: Mon Dec 06, 2004 5:28 am
by tltrude
What is the targetnames of the board and the two triggers? Can you post the script? Is it 30 degrees rotation?

It is ok if there is no origin textured brush as part of the script_object--it will rotate at the center by default. The scripting could be a bit tricky because it has to go to different positions when one or both players jump off.

I have an object like that in my explodingdoor tutorial map. It is the strength meter over on the right. Click on my logo to get the map.

Image

Re: names

Posted: Mon Dec 06, 2004 12:41 pm
by Phil {sfx}
tltrude wrote:Click on my logo to get the map.
While you are there you might as well D/L all of toms maps, hes done some 8-) stuff in them and they are a great example to learn from. :)

Posted: Mon Dec 06, 2004 3:17 pm
by Runt
Well.. First of all I dont have a script :oops: The picture was just to get my idea..

Image

Maybe this is more clear :oops:


I downloaded Toms map, but i don't know how to use this script in my case:

Code: Select all

//-----------------------------------------------------------> 
// Strength Meter
//----------------------------------------------------------->


he_man_hit:

	$he_man_puck speed 694
	level.puckhit = (randomint 256 + 128)
	$he_man_trigger waittill trigger
	$he_man_hammer rotateZdown 80
	$he_man_hammer playsound m3l2_radio_pickup
	$he_man_hammer waitmove
	$he_man_hammer playsound m3l2_radio_pickup
	$he_man_lever rotateZup 5
	$he_man_lever move
	$he_man_puck playsound pistol_whip1
	$he_man_puck moveUp (level.puckhit)
	wait .1
	$he_man_lever rotateZdown 5
	$he_man_hammer rotateZup 80
	$he_man_hammer move
	$he_man_lever move
	$he_man_puck waitmove
	iprintlnbold_noloc "You hit: " (level.puckhit)
	if (level.puckhit >= 345)
	{
		$bell_speaker playsound snd_ping
	}
	$he_man_puck speed 173
	$he_man_puck movedown (level.puckhit)
	$he_man_puck waitmove
	$he_man_puck speed 87
	wait .01
	$he_man_puck playsound colt45_snd_noammo
	$he_man_puck moveUp 16
	$he_man_puck waitmove
	$he_man_puck moveDown 16
	$he_man_puck waitmove
	$he_man_puck playsound colt45_snd_noammo

	goto he_man_hit

end


I thought something like this:

Code: Select all

If trigger 1 == 1 (touched)
rotateX 40 ( if trigger 1 is down )
move

If trigger 2 == 1 (touched)
rotateX -40 (if trigger 1 is up)

If trigger 2 and 1 == 1 (touched)
rotateX 40
move
rotateX -40
move
(loop this)
I know this doesn't work but maybe you guys get the idea :roll:

Thanks

map

Posted: Tue Dec 07, 2004 12:11 pm
by tltrude
The object still needs a name or the script wont know what to rotate. To give your board a targetname, first turn it into a "script_object", then hit key N and add this.

Key: targetname
Value: t_toter (or whatever)

Add two trigger textured brushes to both ends and turn them into trigger_multiple entities (key N) one at a time. Then give them targetnames too (trigger_1 and trigger_2 will work).

After you finish doing that, we will work on your script.

Posted: Tue Dec 07, 2004 1:27 pm
by Runt
Thanks for keep helping me :D
I've done what you said.
I only changed the name "t_toter" to "board"

Posted: Thu Dec 09, 2004 3:32 pm
by Runt
After you finish doing that, we will work on your script.
well, could you please help me out ? :)

script

Posted: Fri Dec 10, 2004 5:37 am
by tltrude
This script works, but you will have to change a few things to use it as it is. The board has to be level in the map--the script will rotate it to the start position. Also, the .bsp and .scr should be named "teeter_totter_test".

looking at it in the 2D window of radiant, "trigger_1" should be on the left. The board should be able to rotate down 30 degrees from level and up 60 degrees from down. there should be a small brush at either end to stop players from silding off.

It works if one player moves back and forth between the two triggers. But, I don't know if it will work with two players. It may crash, or do nothing until one or the other player moves off his trigger.

Code: Select all


// TEETER TOTTER TEST
// ARCHITECTURE: RUNT
// SCRIPTING: RUNT

main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "Teeter Totter Test"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" ""

// cache sounds that normally only work in singleplayer

local.master = spawn ScriptMaster
local.master aliascache wood_creak1 sound/characters/fs_woodcreak_01.wav soundparms 0.9 0.2 0.9 0.2 160 1600 auto loaded maps "m dm moh obj "
local.master aliascache wood_creak2 sound/characters/fs_woodcreak_04.wav soundparms 0.9 0.2 0.9 0.2 160 1600 auto loaded maps "m dm moh obj "

	// call additional stuff for playing this map round based is needed
	if(level.roundbased)
		thread roundbasedthread

	level waittill prespawn

	//*** Precache Dm Stuff
	exec global/DMprecache.scr

	//exec global/door_locked.scr::lock
	level.script = maps/dm/teeter_totter_test.scr
	exec global/ambient.scr mohdm7
	
	level waittill spawn

	thread totter_prep

end

//-----------------------------------------------------------------------------

roundbasedthread:

	// Can specify different scoreboard messages for round based here. 


	level waitTill prespawn

	level waittill spawn

	// set the parameters for this round based match
	level.dmrespawning = 0 // 1 or 0
	level.dmroundlimit = 5 // round time limit in minutes
	level.clockside = kills // set to axis, allies, kills, or draw

	level waittill roundstart

end

//----------------------------->
//  Teeter Totter Threads
//----------------------------->

totter_prep:

	$trigger_1 bind $board
	$trigger_2 bind $board
	$board rotateXup 30 // rotate board to start pos. If X is not right, try Z axis
	$board waitmove
	level.boardup = 1
	$board time 1 // set travel time in seconds
	thread trigger1_action
	thread trigger2_action

end

trigger1_action:

	$trigger_1 waittill trigger
	$trigger_1 nottriggerable
	iprintln "trigger1 action"

	while (level.boardup == 1)
	{
		waitthread board_move_down
		waitframe
	}

	$trigger_1 triggerable
	goto trigger1_action
end

trigger2_action:

	$trigger_2 waittill trigger
	$trigger_2 nottriggerable
	iprintln "trigger2 action"

	while (level.boardup == 0)
	{
		waitthread board_move_up
		waitframe
	}

	$trigger_2 triggerable
	goto trigger2_action

end

board_move_down:

	$board rotateXdown 60 // if X is not right, try Z axis
	$board playsound wood_creak
	$board waitmove
	level.boardup = 0

end

board_move_up:

	$board rotateXdown -60 // if X is not right, try Z axis
	$board playsound wood_creak 
	$board waitmove
	level.boardup = 1

end

Hope that helps.

wow!

Posted: Fri Dec 10, 2004 4:10 pm
by Runt
WoW :shock: didn't know it was so complicated :) Anyway, I'm gonna try this and report when it works.

--Edit--

It works ! Thanks :lol: