Page 1 of 1

Door/Hatch Problem

Posted: Sun Feb 22, 2004 7:23 pm
by Shifty
I'm having a problem with this triggered door im adding to my map, as you enter it rotates up straight away and then starts spinning :shock:

Any Ideas?

Heres the Script

Code: Select all

// doortest
// ARCHITECTURE: Shifty
// SCRIPTING: Shifty

main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "doortest"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" ""
		
	level waitTill prespawn

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

	exec global/door_locked.scr::lock
	level.script = doortest.scr
	exec global/ambient.scr mohdm7
	
	thread floordoor_mover
	
	level waittill spawn

end


//------------------------------------------
// floor doors
//------------------------------------------

floordoor_mover:

$floordoor time 2
$floordoor time 2

$floordoor_trigger waittill trigger
$floordoor_speaker playsound ("door_wood_open_move" + (randomint(3) + 1))
$floordoor rotateXup -90
$floordoor move
$floordoor_speaker playsound door_wood_open_stop
wait 20
$floordoor_speaker playsound ("door_wood_close_move" + (randomint(1) + 1))
$floordoor rotateXdown -90
$floordoor move
$floordoor_speaker playsound ("door_wood_close_stop" + (randomint(2) + 1))

goto floordoor_mover

end
Heres the map put in main\maps\DM

http://www.shiftysbunker.pwp.blueyonder ... ortest.zip

Posted: Sun Feb 22, 2004 8:09 pm
by crunch
Get rid of thread floordoor_mover in the main script.
That should be called by the trigger. So, in Radiant, you should have your trigger with a k/v of
setthread/floordoor_mover

Then the floordoor mover itself is a bit funky.

Try this:
floordoor_mover:

self nottriggerable
$floordoor playsound door_wood_open_move1
$floordoor time 2
$floordoor rotateXup -90
$floordoor waitmove
$floordoor playsound door_wood_open_stop

wait 20 //since you want your door to stay open for 20 seconds

$floordoor playsound door_wood_close_move1
$floordoor time 2
$floordoor rotateXdown -90
$floordoor waitmove
$floordoor playsound door_wood_close_stop1

wait .1
self triggerable
end


You don't need the floordoor_speaker, as you can have the door itself play the sound.

Posted: Sun Feb 22, 2004 10:48 pm
by Shifty
Cheers Very Much it worked great

self

Posted: Sun Feb 22, 2004 11:21 pm
by tltrude
Hmmm, how does the thread know what "self" is? I don't think the trigger's targetname is automattically sent the the thread with "setthread". It would probably work just the same with those two lines remove--now that it has "waitmove".

One way to test it would be to add these lines to the bottom of the thread.

local.name = self // or is it "self"?
iprintln "self = " (local.name)


or maybe just

iprintln self

You could also test if the trigger is triggerable by increacing the "wait .1" at the bottom. If the door opens again right after it closes (while standing in the trigger or hitting use), then the nottriggerable was never set. If that is the case, you could fix it by replacing "self" with "$floordoor_trigger" in the thread.

As you can probably tell, I hate using "self" in threads that are triggered by only one trigger. What kind of trigger is it?

Posted: Mon Feb 23, 2004 1:00 am
by Shifty
Its a trigger_use I have to switches one above the hatch and one below.

I got it workin fine in the test map i made but now that i've added it the actual map for some reason the ability to plant the bombs has dissapeared :(

And as its allmost 1:00 am here and i've been staring at this for a while now a fresh pare eyes may spot the problem

Code: Select all

// Mammut Radar - Objective Version
// ARCHITECTURE: Shifty (Ian Allen)
// SCRIPTING: Shifty

main:

	setcvar "g_obj_alliedtext1" "Destroy The Radar" 
	setcvar "g_obj_alliedtext2" "Destroy The Power"
	setcvar "g_obj_alliedtext3" "Room"
	setcvar "g_obj_axistext1" "Defend the Radar"
	setcvar "g_obj_axistext2" "Defend The Power"
	setcvar "g_obj_axistext3" "Room"
	setcvar "g_scoreboardpic" "none"
	
	level waitTill prespawn
	
	exec global/DMprecache.scr

	exec global/door_locked.scr::lock
	level.script = obj_mammutradar.scr
	exec global/ambient.scr mohdm7
	thread global/exploder.scr::main

	level waittill spawn

floordoor_mover: 

self nottriggerable 
$floordoor playsound door_wood_open_move1 
$floordoor time 2 
$floordoor rotateXup -90 
$floordoor waitmove 
$floordoor playsound door_wood_open_stop 

wait 20 //since you want your door to stay open for 20 seconds 

$floordoor playsound door_wood_close_move1 
$floordoor time 2 
$floordoor rotateXdown -90 
$floordoor waitmove 
$floordoor playsound door_wood_close_stop1 

wait .1 
self triggerable 
end 

level.defusing_team = "axis"
level.planting_team = "allies"
level.targets_to_destroy = 2
level.bomb_damage = 200


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


// level waittill roundstart // Comment out this line using '//' before it to be able to set the bomb when alone on the map ( just for testing )


$panel_bomb thread global/obj_dm.scr::bomb_thinker
$pr_bomb thread global/obj_dm.scr::bomb_thinker
thread allies_win_bomb
$panel_bomb thread axis_win_timer
$pr_bomb thread axis_win_timer
end // end of main

// Allied victory test


allies_win_bomb:
while(level.targets_destroyed < level.targets_to_destroy) 
waitframe
teamwin allies
end

// Axis victory test


axis_win_timer:
level waittill axiswin
end
Also I have another request for some reason i've managed to delete the read me i wrote and my memory is so bad I dont wanna miss thanking some one for there help - so if you've downloaded one of the pre - betas can you send me the readme please

All thats left to do now is get the script right and clean up some minor things that I've noticed and I'll be releasing the Official Beta

Thanks very much

Shifty

Posted: Mon Feb 23, 2004 1:03 am
by wacko
move the thread floordoor_mover out of the main thread (below it's 'end')

Posted: Mon Feb 23, 2004 1:10 am
by wacko

Code: Select all

// Mammut Radar - Objective Version
// ARCHITECTURE: Shifty (Ian Allen)
// SCRIPTING: Shifty
main:
setcvar "g_obj_alliedtext1" "Destroy The Radar" 
setcvar "g_obj_alliedtext2" "Destroy The Power"
setcvar "g_obj_alliedtext3" "Room"
setcvar "g_obj_axistext1" "Defend the Radar"
setcvar "g_obj_axistext2" "Defend The Power"
setcvar "g_obj_axistext3" "Room"
setcvar "g_scoreboardpic" "none"
level waitTill prespawn
exec global/DMprecache.scr
exec global/door_locked.scr::lock
level.script = obj_mammutradar.scr
exec global/ambient.scr mohdm7
thread global/exploder.scr::main
level waittill spawn
level.defusing_team = "axis"
level.planting_team = "allies"
level.targets_to_destroy = 2
level.bomb_damage = 200
level.dmrespawning = 0 // 1 or 0 (0=no respawn)
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = axis // set to axis, allies, kills, or draw
// level waittill roundstart 
$panel_bomb thread global/obj_dm.scr::bomb_thinker
$pr_bomb thread global/obj_dm.scr::bomb_thinker
thread allies_win_bomb
$panel_bomb thread axis_win_timer
$pr_bomb thread axis_win_timer
end

allies_win_bomb:
while(level.targets_destroyed < level.targets_to_destroy) 
waitframe
teamwin allies
end

axis_win_timer:
level waittill axiswin
end

floordoor_mover: 
self nottriggerable 
$floordoor playsound door_wood_open_move1 
$floordoor time 2 
$floordoor rotateXup -90 
$floordoor waitmove 
$floordoor playsound door_wood_open_stop 
wait 20 //since you want your door to stay open for 20 seconds 
$floordoor playsound door_wood_close_move1 
$floordoor time 2 
$floordoor rotateXdown -90 
$floordoor waitmove 
$floordoor playsound door_wood_close_stop1 
wait .1 
self triggerable 
end

Posted: Mon Feb 23, 2004 1:24 am
by Axion
I mailed you the read me file.

Re: self

Posted: Mon Feb 23, 2004 11:37 am
by crunch
tltrude wrote:Hmmm, how does the thread know what "self" is?
Since that trigger called the thread, that trigger is its owner, therefore it follows that "self" is in fact the trigger. At least that is my understanding. :)

Posted: Mon Feb 23, 2004 11:46 am
by Shifty
Well I placed it in the map but had to rotate it 90 degress and now instead of it opening on its origin (where x is the origin) :-

Should be rotaing up 90 degress up and to the left

X----------------------

Its rotating on the centre of the door and now it rotates towards you??


X----------------------X


But I have the origin brush in the correct place would I have to alter the script to suit this?

Posted: Mon Feb 23, 2004 12:10 pm
by wacko
Have u rotated the door+origin in the new map? If so, try rotateYup (or was it rotateZup?)

Posted: Mon Feb 23, 2004 1:13 pm
by Shifty
Yeah that makes sense wacko m8 I'll try that when i get home from work only got 4 hours to go :(

hatch

Posted: Mon Feb 23, 2004 9:47 pm
by tltrude
Make sure that the origin brush and the hatch are one object. It will probably be The Z axis, if X does not work.

Posted: Mon Feb 23, 2004 10:01 pm
by Shifty
Yup wacko that solved it cheers