Page 1 of 1

Strange OBJ problem, works once in server then not at all

Posted: Mon Mar 08, 2004 2:00 am
by BirdsofaFeather
I'm posting this here because I believe this is a script problem and I had to do some unusual scripting for the objectives, but here's the relevant pieces of my script:

Code: Select all

main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "- Destroy the V2" 
setcvar "g_obj_alliedtext2" "Rocket, Steal"
setcvar "g_obj_alliedtext3" "the Manuscript"
setcvar "g_obj_axistext1" "- Defend the"
setcvar "g_obj_axistext2" "Complex"
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "none"

local.master = spawn ScriptMaster 
local.master aliascache doc_pickup_snd sound/items/Item_PaperPU_02.wav soundparms 1.0 0.0 1.0 0.0 100 2000 item loaded maps "m dm moh obj " 

level waitTill prespawn

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

level.script = maps/obj/CrimsonTwilight.scr

exec global/ambient.scr CrimsonTwilight

$world farplane_color "0.752941 0.752941 0.752941"
level.fogplane = 10000 
$world farplane level.fogplane

exec global/door_locked.scr::lock

thread global/exploder.scr::main

$lab_elevator notsolid
$lab_elevator moveDown 64
$lab_elevator moveNorth 272
$lab_elevator waitmove
$lab_elevator solid

thread g_elevator_prep
thread lab_elevator_prep
thread lab_tableflip_standby
thread gdoor_prep
thread roof_door_prep
thread trapdoor_mover
thread trapdoor2_mover
thread lightswitch_prep
thread window_door_prep
thread chalkboard1
thread chalkboard2
thread boiler
thread warehouse_elevator_prep
thread safe_standby
thread safe_table

level waittill spawn

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

level.dmrespawning = 0
level.dmroundlimit = 4
level.clockside = axis

level waittill roundstart

thread document_check
thread explosion_checker

$v2_bomb thread global/obj_dm.scr::bomb_thinker
	
thread allies_win_bomb $v2_bomb
$v2_bomb thread axis_win_timer

end

//----------------------
// Document Check
//----------------------

document_check:

level.docind = 0

	while(1)
	{
		$documents_trigger waittill trigger

		if(parm.other.dmteam == allies) 
		{
			$documents playsound doc_pickup_snd
			$documents hide
			iprintln "The Manuscript has been stolen"
			level.docind = 1
			level.targets_destroyed++
			break
		}

		waitframe

	}
end

//-------------------------------
// Explosion Checker
//-------------------------------

explosion_checker:

	while(1)
	{
		if (level.targets_destroyed == 1 && level.docind != 1)
		{
			$v2 hide
			break
		}
		
		if (level.targets_destroyed == 2)
		{
			$v2 hide
			break
		}

		waitframe
	}

end


//-----------------------
// Allies Victory Test
//-----------------------

allies_win_bomb:

	while(level.targets_destroyed < level.targets_to_destroy)
		{
			// chill out
			waitframe
		}
	// No objectives left allies win
	teamwin allies

end

//-----------------------
// Axis Victory Test
//-----------------------

axis_win_timer:

	level waittill axiswin

end
The level.docind variable in there is because of some unusual scripting I had to do to make the v2 explode correctly and be non-solid at the same time. Regardless, for the first round all the objectives work smoothly. The v2 explodes correctly, whether the documents are found first or not (that's what the docind is for). But starting with the second round, the objectives simply do not work. I can trigger neither the documents nor the v2 bomb. Keep in mind that this only happens on servers with waittill roundstart not commented out. When I test it alone with that line commented out, it works fine. I'm at a loss, if you guys need any more info just let me know. Thanks in advance.

Posted: Mon Mar 08, 2004 7:03 pm
by jv_map
Put all this

thread global/exploder.scr::main

$lab_elevator notsolid
$lab_elevator moveDown 64
$lab_elevator moveNorth 272
$lab_elevator waitmove
$lab_elevator solid

thread g_elevator_prep
thread lab_elevator_prep
thread lab_tableflip_standby
thread gdoor_prep
thread roof_door_prep
thread trapdoor_mover
thread trapdoor2_mover
thread lightswitch_prep
thread window_door_prep
thread chalkboard1
thread chalkboard2
thread boiler
thread warehouse_elevator_prep
thread safe_standby
thread safe_table

below level waittill spawn

:)

Posted: Tue Mar 09, 2004 4:01 am
by BirdsofaFeather
shoot, i was so excited, getting a response from jv, sorry, it didn't work man...

If it means anything, I found out that that everytime a new set of rounds is started, the objectives work for that first round of the set, just not after subsequent rounds. For instance I made a server that just a friend and I went on with the map, and the objectives worked the first round, then not after. But when my friend left the server and rejoined, the objectives worked for one round again. It has to be something with the waittill roundstart command, because when I comment it out, the objectives work fine for multiple rounds. Should I try placing the "thread global/exploder.scr::main" command under the waittill roundstart command? Would that even work? I'm not sure why the triggers wouldn't be reassigned to the objectives after each round, but that has to be the problem. I guess I'm at a loss, not sure at all where to go from here, I do appreciate the help though.

Posted: Tue Mar 09, 2004 6:38 pm
by jv_map
Try moving the level waittill roundstart line up until just below the level waittill spawn line.

A layout like this should work fine:

Code: Select all

  // no interesting code here
  
  level waittill spawn

  level waittill roundstart

  // interesting code starts here :)

Posted: Wed Mar 10, 2004 2:07 am
by BirdsofaFeather
well, i tried putting all the script that's objective related below the waittill roundstart line, and still no luck, it still works once and then fails to work in subsequent rounds. I tried commenting out level waittill roundstart too, and again, it then works perfectly fine, the objectives work over and over. Here's my current relevant script:

Code: Select all

main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "- Destroy the V2" 
setcvar "g_obj_alliedtext2" "Rocket, Steal"
setcvar "g_obj_alliedtext3" "the Manuscript"
setcvar "g_obj_axistext1" "- Defend the"
setcvar "g_obj_axistext2" "Complex"
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "none"

local.master = spawn ScriptMaster 
local.master aliascache doc_pickup_snd sound/items/Item_PaperPU_02.wav soundparms 1.0 0.0 1.0 0.0 100 2000 item loaded maps "m dm moh obj " 

level waitTill prespawn

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

level.script = maps/obj/CrimsonTwilight.scr

exec global/ambient.scr CrimsonTwilight

$world farplane_color "0.752941 0.752941 0.752941"
level.fogplane = 10000 
$world farplane level.fogplane

exec global/door_locked.scr::lock

level waittill spawn

$lab_elevator notsolid
$lab_elevator moveDown 64
$lab_elevator moveNorth 272
$lab_elevator waitmove
$lab_elevator solid

thread g_elevator_prep
thread lab_elevator_prep
thread lab_tableflip_standby
thread gdoor_prep
thread roof_door_prep
thread trapdoor_mover
thread trapdoor2_mover
thread lightswitch_prep
thread window_door_prep
thread chalkboard1
thread chalkboard2
thread boiler
thread warehouse_elevator_prep
thread safe_standby
thread safe_table

level waittill roundstart

thread global/exploder.scr::main

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

level.dmrespawning = 0
level.dmroundlimit = 4
level.clockside = axis

thread document_check
thread explosion_checker

$v2_bomb thread global/obj_dm.scr::bomb_thinker
	
thread allies_win_bomb $v2_bomb
$v2_bomb thread axis_win_timer

end

//----------------------
// Document Check
//----------------------

document_check:

level.docind = 0

	while(1)
	{
		$documents_trigger waittill trigger

		if(parm.other.dmteam == allies) 
		{
			$documents playsound doc_pickup_snd
			$documents hide
			iprintln "The Manuscript has been stolen"
			level.docind = 1
			level.targets_destroyed++
			break
		}

		waitframe

	}
end

//-------------------------------
// Explosion Checker
//-------------------------------

explosion_checker:

	while(1)
	{
		if (level.targets_destroyed == 1 && level.docind != 1)
		{
			$v2 hide
			break
		}
		
		if (level.targets_destroyed == 2)
		{
			$v2 hide
			break
		}

		waitframe
	}

end


//-----------------------
// Allies Victory Test
//-----------------------

allies_win_bomb:

	while(level.targets_destroyed < level.targets_to_destroy)
		{
			// chill out
			waitframe
		}
	// No objectives left allies win
	teamwin allies

end

//-----------------------
// Axis Victory Test
//-----------------------

axis_win_timer:

	level waittill axiswin

end
Would there really be any adverse effects if I just left level waittill roundstart commented out when I release it? It works that way no matter what, so I have to consider it. I know that then people could set the bomb if they were alone in the server, but would anything else happen? Any other advice is highly appreciated, I don't care if your advice doesn't work because I don't know anything that will work. Thanks again jv for your responses.

Posted: Thu Mar 11, 2004 2:23 am
by BirdsofaFeather
Alright let me rephrase that, would it be a big problem if I just left waittill roundstart like this?:

//level waittill roundstart

The only time it seems to work is if this is commented out, so would there be any big issues in doing this other than that a single player in the map could set off objectives?

Posted: Thu Mar 11, 2004 2:34 am
by Bjarne BZR
No, its not any real problem. But it is irritating that it wont work as you want it to.
Are you getting any errors in the console during this time? ( write "logfile 1" in console before starting the map ).

Posted: Thu Mar 11, 2004 2:39 am
by Bjarne BZR
I see no reason for the explosion_checker method... or the level.docind...

Why are you using those?

Posted: Thu Mar 11, 2004 2:43 am
by Bjarne BZR
Never mind, you explained those in the first post ( me = very tired ). But if you dont care about the V2 beeing correc, does the objs work if you DONT use explosion_checker and the level.docind?

Posted: Thu Mar 11, 2004 3:27 am
by omniscient
wow, im curious what happens, i cant find anything. im not that great though.

Posted: Thu Mar 11, 2004 3:35 am
by BirdsofaFeather
Never mind, you explained those in the first post ( me = very tired ). But if you dont care about the V2 beeing correc, does the objs work if you DONT use explosion_checker and the level.docind?
Well, I haven't tried running it in a server without that method enabled, all that would happen is that my v2 wouldn't "explode". So in truth, to spite me it probably would work without that enabled, but then my v2 wouldn't blow up so I'd be worse off imo than before. It seems I've reached some sort of strange dilemma. And unfortunatly I have to test this in a very screwy way. Both my friend and I are behind firewalls so we can't host servers (and my DMZ doesn't work either, imagine that?), but he has a network at his house, so I'm constantly sending him the map so he can test it on his network. I'd ask him to do the logfile 1 thing while he's running it but there's no way I could tell him what to look for, and he lives about 1500 miles aways so I can't really help him lol.

Gahh forget it, it's probably unprofessional, but it looks like I'll just leave level waittill roundstart commented out, save myself from trying to fix a problem that isn't really worth fixing. Thanks for the help you guys.

Posted: Thu Mar 11, 2004 3:36 am
by BirdsofaFeather
Know what I'm curious, I'll try it anyway, I'll post an answer tomorrow.

Posted: Thu Mar 11, 2004 11:31 pm
by BirdsofaFeather
Wow, very weird. I commented all the level.docind and explosion_checker stuff out, and it STILL didn't work. There's nothing else in there that could possibly mess it up, what the heck is up? This all works perfectly fine if I JUST comment level waittill roundstart out...I'm at a loss.