Page 2 of 2

Posted: Tue Mar 15, 2005 9:37 am
by Grassy
Try this for the Compass;

Code: Select all

//Farmhouse Objective Scripting

 main:
	setcvar "g_obj_alliedtext1" "- Steal the documents"
	setcvar "g_obj_alliedtext2" "- Transmit Documents"
	setcvar "g_obj_alliedtext3" ""
	setcvar "g_obj_axistext1" "- Defend Documents"
	setcvar "g_obj_axistext2" "- Defend Radio Transmitter"
	setcvar "g_obj_axistext3" ""
	setcvar "g_scoreboardpic" "none"

	level waittill prespawn
	exec global/DMprecache.scr

	level.script = maps/obj/mp_farm_house_obj.scr
	exec global/ambient.scr mohdm2
	thread global/exploder.scr::main

	level waittill spawn
	// Set the parameters for round based match
	level.dmrespawning = 0
	level.dmroundlimit = 5
	level.clockside = axis

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

	// level waittill roundstart //Disabled for testing

	thread document_check

	// obj_tick.scr custom bomb script
	$door_bomb thread global/obj_tick.scr::bomb_thinker

	level waittill axiswin
end

// Document checks
document_check:

//set the compass here first for the docs
addobjective 1 1 "" $documents.origin
setcurrentobjective 1

	while(1) {
		$documents_trigger waittill trigger
		if(parm.other.dmteam == allies) {
			$documents hide
			break
		}
		waitframe
	}
	thread radio_check
	
end

// radio checks
radio_check:

//now set the compass here for the radio
addobjective 1 1 "" $radio.origin
setcurrentobjective 1

	while(1) {
		$radio_trigger waittill trigger
		if(parm.other.dmteam == allies) {
			$radio hide // leaves a non flashing radio when used
			break
		}
		waitframe
	}
	teamwin allies
end
Compass... you can do this in SP, not sure you can do it in MP at all... but I've been in error before :)
I have it working like this for Spearhead MP no probs, not sure about AA though.. :)
Grassy

Posted: Tue Mar 15, 2005 11:36 am
by spy0012
The following code, shows the radio location on compass but not the document objective location.

Code: Select all

//Farmhouse Objective Scripting 

 main: 
   setcvar "g_obj_alliedtext1" "- Steal the documents" 
   setcvar "g_obj_alliedtext2" "- Transmit Documents" 
   setcvar "g_obj_alliedtext3" "" 
   setcvar "g_obj_axistext1" "- Defend Documents" 
   setcvar "g_obj_axistext2" "- Defend Radio Transmitter" 
   setcvar "g_obj_axistext3" "" 
   setcvar "g_scoreboardpic" "none" 

   level waittill prespawn 
   exec global/DMprecache.scr 

   level.script = maps/obj/mp_farm_house_obj.scr 
   exec global/ambient.scr mohdm2 
   thread global/exploder.scr::main 

   level waittill spawn 
   // Set the parameters for round based match 
   level.dmrespawning = 0 
   level.dmroundlimit = 5 
   level.clockside = axis 

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

   // level waittill roundstart //Disabled for testing 

   thread document_check 

   // obj_tick.scr custom bomb script 
   $door_bomb thread global/obj_tick.scr::bomb_thinker 

   level waittill axiswin 
end 

// Document checks 
document_check: 

//set the compass here first for the docs 
addobjective 1 1 "" $documents.origin 
setcurrentobjective 1 

   while(1) { 
      $documents_trigger waittill trigger 
      if(parm.other.dmteam == allies) { 
         $documents hide 
         break 
      } 
      waitframe 
   } 
   thread radio_check 
    
end 

// radio checks 
radio_check: 

//now set the compass here for the radio 
addobjective 1 1 "" $radio.origin 
setcurrentobjective 1 

   while(1) { 
      $radio_trigger waittill trigger 
      if(parm.other.dmteam == allies) { 
         $radio hide // leaves a non flashing radio when used 
         break 
      } 
      waitframe 
   } 
   teamwin allies 
end
As the above code, without the document location works excellent, cannot complete the radio objective until the documnts have gone which i wanted.

If anyone can get the document location to work it will be excellent, also is there a way to print on screen when an objective has completed, so everyone knows the documents ect have been stolen

i know can use

Code: Select all

iprintlnbold ( loc_convert_string "Documents have been stolen )
but where in the code do not know, code maybe wrong but i assume it's the right code.

Once this is done the script will be easier for me to add one more objective which will be final one.

Thanks guys, great help

Posted: Tue Mar 15, 2005 8:46 pm
by Grassy
Oops, I thought it would be ok as they were incremental, but maybe not. Try this,

Code: Select all

//set the compass here first for the docs 
addobjective 1 1 "" $documents.origin 
setcurrentobjective 1 

   while(1) { 
      $documents_trigger waittill trigger 
      if(parm.other.dmteam == allies) {
         //global print to screen for all players to see
         iprintlnbold_noloc "The allies have the documents!"
          $documents hide 
         break 
      } 
      waitframe 
   } 
   thread radio_check 
    
end 

// radio checks 
radio_check: 

//now set the compass here as objective 2 for the radio 
addobjective 2 1 "" $radio.origin 
setcurrentobjective 2 

   while(1) { 
      $radio_trigger waittill trigger 
      if(parm.other.dmteam == allies) { 
         $radio hide // leaves a non flashing radio when used 
         break 
      } 
      waitframe 
   } 
   //global print to screen that allies have won
   iprintlnbold_noloc "The allies have transmitted the documents!"
   wait 3
   teamwin allies 
end

Posted: Tue Mar 15, 2005 11:28 pm
by spy0012
Hey Grassy,

Thanks for your help, on this, the messages appear great when u complete an obj but the first objective won't appear on the compass.

That is about all that i need to get working.

Thanks for your help again Grassy

Posted: Wed Mar 16, 2005 6:39 am
by Grassy
Hmm thats odd, if the compass isnt pointing to the documents origin then try pointing it to the trigger on the documents like so;

//set the compass here first for the docs
addobjective 1 1 "" $documents_trigger.origin
setcurrentobjective 1

Do your docs actually hide when you hit the trigger?

Grassy

Posted: Wed Mar 16, 2005 8:30 am
by spy0012
Hi Grassy,

Yes the documents do go when you hit use and the message you added does appear Allies have got the documents ect.

I will try what u put up just now and see how it goes, going through the objects does finish the game as it should do, so something is working right :) just the compass on first obj

Cheers

Added the above 2 lines and voila works like a charm, thanks again for your help, ooh one last thing, how hard is it to add the boxes that get ticked when an objective is complete on scoreboard?

Posted: Wed Mar 16, 2005 1:08 pm
by Grassy
Cool about the compass, glad that worked.

As for the boxes, they are mainly for TOW in Spearhead, but you can do it for Obj with a workaround by changing your score cvars at the top, the ones that show up in the scoreboard, here is how it's done.

Code: Select all

//modify these lines at the top of your script like this
 
   setcvar "g_obj_alliedtext1" "[  ] Steal the documents" 
   setcvar "g_obj_alliedtext2" "[  ] Transmit Documents" 
   setcvar "g_obj_alliedtext3" "" 
   setcvar "g_obj_axistext1" "- Defend Documents" 
   setcvar "g_obj_axistext2" "- Defend Radio Transmitter" 
   setcvar "g_obj_axistext3" "" 
   setcvar "g_scoreboardpic" "none" 

   

//this line you add just after the print line when the docs have been stolen   
	setcvar "g_obj_alliedtext1" "[X] Steal the documents"
	
//this line add just after the print line when the radio has been activated
	setcvar "g_obj_alliedtext2" "[X] Transmit Documents"
Grassy

Posted: Wed Mar 16, 2005 8:37 pm
by spy0012
Cheers, works excellent, just one more obj then done, thanks again

Posted: Thu Mar 17, 2005 3:57 am
by spy0012
Hey grassy don't know if you know why the compass don't work when i add it to a clan server, i have been testing the map locally on my pc but on a server it don't work the compass any ideas.

Posted: Thu Mar 17, 2005 6:10 am
by Grassy
Got me beat, works ok on our servers like that. We ARE talking Spearhead arn't we? If the server and clients have the same script then it works fine.
Grassy

Posted: Thu Mar 17, 2005 6:50 am
by spy0012
Breakthrough, thought i mentioned it but obviously not sorry, i take it there is alot of code differences, everything else works but the compass, so can't see why it would differ as i test the file in BT on my machine.

Posted: Thu Mar 17, 2005 11:20 am
by Grassy
Oh sorry if I missed that, well even so, Breakthrough should have no problems with it either. We use the same commands in BT as well and they work ok. One thing I did notice, the line level waittill axiswin in the main thread is not the normal way to do it, I'm not sure but I think that might hold the main thread open until axiswin....

The normal way to do it is call a new thread from main,

Code: Select all

thread axis_win_timer

//----------------
axis_win_timer:
//----------------
	level waittill axiswin
end
Other than that I can't see why the compass isn't working for you :(

Grassy

Posted: Thu Mar 17, 2005 9:25 pm
by Green Beret
i never could get the compass to point at my objectives,even if i made a script_origin and put it next to the obj.