Whats the error?

Post your scripting questions / solutions here

Moderator: Moderators

Daniel Radcliffe
Second Lieutenant
Posts: 168
Joined: Fri May 30, 2003 9:49 am

Whats the error?

Post by Daniel Radcliffe »

OK, can someone please help me to correct this.

This is the whole script:
// Comms Bunker
// ARCHITECTURE: billandben
// SCRIPTING: billandben
setcvar "g_obj_alliedtext1" "We need to distrupt"
setcvar "g_obj_alliedtext2" "their communications"
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" "Protect the dish"
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" ""

level waittill prespawn
exec global/DMprecache.scr
level.script = maps/obj/obj_lol_CommsBunker.scr
exec global/ambient.scr m5l1b
thread global/exploder.scr::main
$world farplane 2750
$world farplane_color (0.333 0.333 0.333)
$door1_nopulse hide
$door1_off hide
$door2_nopulse hide
$door3_nopulse hide
$b_pipe1 anim hide
level.defusing_team = "axis"
level.planting_team = "allies"
level.targets_to_destroy = 1
level.bomb_damage = 200
level.bomb_explosion_radius = 2048
level.dmrespawning = 0
level.dmroundlimit = 5
level.clockside = axis
thread rowboat_prep
//thread open_piano_lid
exec global/door_locked.scr::lock

level waittill spawn
$church_door lock
level.church = getcvar church
if (level.church == "lock")
$church_door lock
if (level.church == "unlock")
$church_door unlock


//Level waittill roundstart
$radar_bomb thread global/obj_dm.scr::bomb_thinker
thread allies_win_bomb
$radar_bomb thread axis_win_timer
thread bombs_setup
thread remove_radar

end

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

axis_win_timer:
level waittill axiswin
end


bombs_setup:

thread bomb1_start
thread bomb2_start
thread bomb3_start
end

bomb1_start:

while(1)
{
$door1_trigger waittill trigger
local.player = parm.other
if (local.player.dmteam != axis)
{
goto door1
}
}
end

door1:
$door1_trigger playsound plantbomb
$door1_nopulse show
$door1_pulse hide
local.player = parm.other
local.player stopwatch 5
$door1_nopulse playsound plantbomb
wait .5
$door1_nopulse loopsound final_countdown
wait 5
$door1_nopulse stoploopsound
radiusdamage $door1_nopulse.origin 120 256
thread jitter_large
$door1_explosion_fx anim start
$door1 remove
$door1_off show
$door1_nopulse remove
$door1_pulse remove
iprintlnbold "Allies have gained access to the passages"
end

bomb2_start:

while(1)
{
$door2_trigger waittill trigger
local.player = parm.other
if (local.player.dmteam != axis)
{
goto door2
}
}
end

door2:
$door2_trigger playsound plantbomb
$door2_nopulse show
$door2_pulse hide
local.player = parm.other
local.player stopwatch 5
$door2_nopulse playsound plantbomb
wait .5
$door2_nopulse loopsound final_countdown
wait 5
$door2_nopulse stoploopsound
radiusdamage $door1_nopulse.origin 120 256
thread jitter_large
$door2_explosion_fx anim start
$door2 remove
$door2_nopulse remove
$door2_pulse remove
$door2_trigger remove
$b_pipe2 anim start
iprintlnbold "The allies have blown a hole in the ground"
end

bomb3_start:

while(1)
{
$door3_trigger waittill trigger
local.player = parm.other
if (local.player.dmteam != axis)
{
goto door3
}
}
end

door3:
$door3_trigger playsound plantbomb
$door3_nopulse show
$door3_pulse hide
local.player = parm.other
local.player stopwatch 5
wait .5
$door3_nopulse loopsound final_countdown
wait 5
$door3_nopulse stoploopsound
radiusdamage $door3_nopulse.origin 120 256
thread jitter_large
$door3_explosion_fx anim start
$door3 remove
$door3_nopulse remove
$door3_pulse remove
$door3_trigger remove
$b_pipe3 anim start
iprintlnbold "The allies have blown a hole in the ground"
end

jitter_large:

waitexec global/earthquake.scr .35 10 0 0
waitexec global/earthquake.scr .23 6 0 0
waitexec global/earthquake.scr 1 1 0 0
waitexec global/earthquake.scr 1.25 .3 0 1
end


remove_radar:
while !($radar_bomb.exploded) {
waitframe
}
$radar remove
end


rowboat_prep:

$row_boat_ores bind $row_boat
$row_boat speed 100

goto rowboat_move

rowboat_move:

$row_boat_trigger waittill trigger
$row_boat_ores rotatez -360
wait .5
$row_boat moveto waypoint_rb_2
$row_boat waitmove
$row_boat moveto waypoint_rb_1
$row_boat waitmove
$row_boat_ores rotatez 360
$row_boat_ores stop

goto rowboat_move
end

//open_piano_lid:
while(true) {
$piano waitTill trigger
$piano nottriggerable
$piano playsound moh_piano
wait 8
$piano triggerable
}
end

The problem appears to be the Level waittill roundstart section, with it as is now i get no problems, while the // is removed the script fails to work. Any ideas on what is causing this?

Also:
I cannot get the script to set work for the locking and unlocking of doors through rcon, i only want people to enter a certain builing when rcon users are around to stop camping. The targetnames for the door are correct so there is obviously somthing else i need in, if the bsp is needed i can also supply this.

Any help will be appreciated.

Thanks
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

im no pro,but it looks like there should be end before level waittil spawn.

:wink:
Cobra {sfx}
Site Admin
Posts: 194
Joined: Tue Mar 23, 2004 10:25 pm
Contact:

Post by Cobra {sfx} »

I think you need this

setcvar "g_gametype" "4" // for obj

above level waittill prespawn



Also console should point to any problem
Splaetos
Major General
Posts: 730
Joined: Tue Jan 20, 2004 2:55 pm
Contact:

Post by Splaetos »

eh... why would he have to set the cvar in the script unless it was in a mixed rotation?

I didnt read the script... too flat lol...

but yea... either look in console or better, Log console, and look at qconsole.txt afterwards, if a script fails, it will point out why while its trying ot load the map.
When I am king, you will be first against the wall~
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

At first glance: that script has no main... put

Code: Select all

main:
at the top-
Admin .MAP Forums
Image
Head above heels.
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

OK: try this one:

Code: Select all

// Comms Bunker
// ARCHITECTURE: billandben
// SCRIPTING: billandben

// Bjarne says: There was no main.
// You need a main, because there is where it all starts.
main:
	setcvar "g_obj_alliedtext1" "We need to distrupt"
	setcvar "g_obj_alliedtext2" "their communications"
	setcvar "g_obj_alliedtext3" ""
	setcvar "g_obj_axistext1" "Protect the dish"
	setcvar "g_obj_axistext2" ""
	setcvar "g_obj_axistext3" ""
	setcvar "g_scoreboardpic" ""

	level waittill prespawn

	exec global/DMprecache.scr
	level.script = maps/obj/obj_lol_CommsBunker.scr
	exec global/ambient.scr m5l1b
	thread global/exploder.scr::main
	$world farplane 2750
	$world farplane_color (0.333 0.333 0.333)
	$door1_nopulse hide
	$door1_off hide
	$door2_nopulse hide
	$door3_nopulse hide
	$b_pipe1 anim hide
	level.defusing_team = "axis"
	level.planting_team = "allies"
	level.targets_to_destroy = 1
	level.bomb_damage = 200
	level.bomb_explosion_radius = 2048
	level.dmrespawning = 0
	level.dmroundlimit = 5
	level.clockside = axis
	thread rowboat_prep
	
	// Commented this back in... my guess is that
	// you took it out because it didnt work...
	// ...should work now. The Canal :)
	thread open_piano_lid
	
	exec global/door_locked.scr::lock

	level waittill spawn

	$church_door lock
	level.church = getcvar church
	if (level.church == "lock")
	$church_door lock
	if (level.church == "unlock")
	$church_door unlock

	// Not sure it matters, but i think level needs
	// a small 'L' to work
	
	// level waittill roundstart

	$radar_bomb thread global/obj_dm.scr::bomb_thinker
	thread allies_win_bomb
	$radar_bomb thread axis_win_timer
	thread bombs_setup
	thread remove_radar
end

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

axis_win_timer:
	level waittill axiswin
end


bombs_setup:
	thread bomb1_start
	thread bomb2_start
	thread bomb3_start
end

bomb1_start:
	while(1)
	{
		$door1_trigger waittill trigger
		local.player = parm.other
		if (local.player.dmteam != axis)
		{
			// Bjarne hates the GOTO command :)
			waitthread door1
			// Not sure, but you want this one time, right?
			/ If so, you should break the while looping here
			// with an 'end'
		}
	}
end

door1:
	$door1_trigger playsound plantbomb
	$door1_nopulse show
	$door1_pulse hide
	local.player = parm.other
	local.player stopwatch 5
	$door1_nopulse playsound plantbomb
	wait .5
	$door1_nopulse loopsound final_countdown
	wait 5
	$door1_nopulse stoploopsound
	radiusdamage $door1_nopulse.origin 120 256
	thread jitter_large
	$door1_explosion_fx anim start
	$door1 remove
	$door1_off show
	$door1_nopulse remove
	$door1_pulse remove
	iprintlnbold "Allies have gained access to the passages"
end

bomb2_start:
	while(1)
	{
		$door2_trigger waittill trigger
		local.player = parm.other
		if (local.player.dmteam != axis)
		{
			// Bjarne hates the GOTO command :)
			waitthread door2
			// Not sure, but you want this one time, right?
			// If so, you should break the while looping here
			// with an 'end'
		}
	}
end

door2:
	$door2_trigger playsound plantbomb
	$door2_nopulse show
	$door2_pulse hide
	local.player = parm.other
	local.player stopwatch 5
	$door2_nopulse playsound plantbomb
	wait .5
	$door2_nopulse loopsound final_countdown
	wait 5
	$door2_nopulse stoploopsound
	radiusdamage $door1_nopulse.origin 120 256
	thread jitter_large
	$door2_explosion_fx anim start
	$door2 remove
	$door2_nopulse remove
	$door2_pulse remove
	$door2_trigger remove
	$b_pipe2 anim start
	iprintlnbold "The allies have blown a hole in the ground"
end

bomb3_start:
	while(1)
	{
		$door3_trigger waittill trigger
		local.player = parm.other
		if (local.player.dmteam != axis)
		{
			// Bjarne hates the GOTO command :)
			waitthread door3
			// Not sure, but you want this one time, right?
			// If so, you should break the while looping here
			// with an 'end'
		}
	}
end

door3:
	$door3_trigger playsound plantbomb
	$door3_nopulse show
	$door3_pulse hide
	local.player = parm.other
	local.player stopwatch 5
	wait .5
	$door3_nopulse loopsound final_countdown
	wait 5
	$door3_nopulse stoploopsound
	radiusdamage $door3_nopulse.origin 120 256
	thread jitter_large
	$door3_explosion_fx anim start
	$door3 remove
	$door3_nopulse remove
	$door3_pulse remove
	$door3_trigger remove
	$b_pipe3 anim start
	iprintlnbold "The allies have blown a hole in the ground"
end

jitter_large:
	waitexec global/earthquake.scr .35 10 0 0
	waitexec global/earthquake.scr .23 6 0 0
	waitexec global/earthquake.scr 1 1 0 0
	waitexec global/earthquake.scr 1.25 .3 0 1
end


remove_radar:
	while !($radar_bomb.exploded)
	{
		waitframe
	}
	$radar remove
end


rowboat_prep:
	$row_boat_ores bind $row_boat
	$row_boat speed 100

	// Bjarne hates the GOTO command :)
	while(1)
	{
		$row_boat_trigger waittill trigger
		$row_boat_ores rotatez -360
		wait .5
		$row_boat moveto waypoint_rb_2
		$row_boat waitmove
		$row_boat moveto waypoint_rb_1
		$row_boat waitmove
		$row_boat_ores rotatez 360
		$row_boat_ores stop
	}
end

// Bjarne says: Next line was commented out. Not right. Right?
open_piano_lid:
	while(1)
	{
		$piano waitTill trigger
		$piano nottriggerable
		$piano playsound moh_piano
		wait 8
		$piano triggerable
	}
end
Admin .MAP Forums
Image
Head above heels.
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

You don't need a main: at the top of the script file, you could just start typing... I would recommend you to make a main: thread though.

Anyway, if you look in your console it will always tell you what the error is. Probably you just need to type 'Level' in lowercase :wink:
Image
Daniel Radcliffe
Second Lieutenant
Posts: 168
Joined: Fri May 30, 2003 9:49 am

Post by Daniel Radcliffe »

Thx for your help all, error is now fixed and it was the capital L in "level waittill spawn" and ill try the piano script out again, although its just a random bit of the map to be added in.

Again thanks for your help.
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

thats always my mistakes,mispelling or a dang capital 8-)
strafer
Captain
Posts: 237
Joined: Sat Jan 31, 2004 11:29 pm
Location: The Motherland..
Contact:

Post by strafer »

Green Beret wrote:thats always my mistakes,mispelling or a dang capital 8-)
Yep, my mistakes usually aren't HUGE mistakes. Usually they are just the misspellings and leaving a certain word out or something and it takes me a while to debug it. After I realise how easy it was, I always have to kick myself in my own butt.
Image
Daniel Radcliffe
Second Lieutenant
Posts: 168
Joined: Fri May 30, 2003 9:49 am

Post by Daniel Radcliffe »

Ohhh, while were here with this script.

Any ideas why i dont seem able to get the door lock/unlock command to work? Or am i just being stupid and not typing it in console correctly? :roll: :oops:

Just for ease of finding this is the relevant part of the script:

level waittill prespawn
exec global/door_locked.scr::lock


level waittill spawn
$church_door lock
level.church = getcvar church
if (level.church == "lock")
$church_door lock
if (level.church == "unlock")
$church_door unlock

Chuch starts off locked, how i want it, but i cant unlock it :(


Thanks again for your help on this :)
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Well, I guess you want to unlock the church while the game is running. If so you need to check that variable all the time ( in a while loop ) to see if the variable has changed.
Admin .MAP Forums
Image
Head above heels.
Daniel Radcliffe
Second Lieutenant
Posts: 168
Joined: Fri May 30, 2003 9:49 am

Post by Daniel Radcliffe »

Hi, its me again :)

After trying for several hours I have managed to get as far as this with the script to open up the church:

church_door:
while(1)
{
level.church = getcvar church
if level.church "lock" church_door unlock
if level.church "unlock" church_door lock
}
end

This however does not work as when I load the map up the error in console says church_door unknown command.

Ive also tried it with $ in it like so:

church_door:
while(1)
{
level.church = getcvar church
if level.church "lock" $church_door unlock
if level.church "unlock" $church_door lock
}
end

However it says that the $ arnt needed and to remove them, can someone point me in the right direction as to what it is im doing wrong.

Thanks
Splaetos
Major General
Posts: 730
Joined: Tue Jan 20, 2004 2:55 pm
Contact:

Post by Splaetos »

can a trigger play a soundfile?

For my piano I have a trigger and speaker as such:

Code: Select all

$piano_trigger waitTIll trigger
$piano_speaker playsound snd_melody
And i really cant remember the details on when you do or dont need to cache your sounds, I just cache every sound im going to use as habit.

Code: Select all

local.master = spawn ScriptMaster

	local.master aliascache snd_shutter sound/mechanics/GateWoodOpen_01.wav soundparms 2.0 0.2 1.0 0.2 200 2000 auto loaded maps "obj dm"
	local.master aliascache snd_shutter_close sound/mechanics/GateWoodClose_01.wav soundparms 2.0 0.2 1.0 0.2 200 2000 auto loaded maps "obj dm"
     local.master aliascache snd_melody sound/thesting.mp3 soundparms 5.0 0.2 1.0 0.2 200 2000 auto loaded maps "obj dm"
i cant remember how it works for sounds that are already defined in ubersound... does moh_piano work automaticaly?
When I am king, you will be first against the wall~
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Daniel Radcliffe wrote:church_door:
while(1)
{
level.church = getcvar church
if level.church "lock" $church_door unlock
if level.church "unlock" $church_door lock
}
end
Should be

Code: Select all

church_door:
	while(1)
	{
	  level.church = getcvar church
	  if (level.church == "lock")
             $church_door unlock
	  else if (level.church == "unlock")
             $church_door lock
          
          wait 0.5
	}
end
Also best use local.church instead of level.church... just incase there is a concentration of holiness in your map :wink:

Note that this will lock the door if you set the cvar to 'unlock', but that's how you had it before :?

Splaetos I'm not really sure if your post belongs to this thread :?
Image
Post Reply