Scripting for stealing objectives?...

Post your scripting questions / solutions here

Moderator: Moderators

User avatar
GrimReaper
Sergeant
Posts: 58
Joined: Tue Dec 30, 2003 5:40 am

Scripting for stealing objectives?...

Post by GrimReaper »

Alrighty,guys I have got the objective(documents) and got the trigger but on the scripting what do I save it as?...scr? :twisted:
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

yes, a .scr. place it together with ur map
Live to map, not map to live.
-mohaa_rox, .map
moderator
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Yes, and same name on the script as the maps bsp file (exept that it should be an scr file instead of a bsp file :wink: ).

Here is a basic MP script tut:
/t.php?id=35
Admin .MAP Forums
Image
Head above heels.
User avatar
GrimReaper
Sergeant
Posts: 58
Joined: Tue Dec 30, 2003 5:40 am

Post by GrimReaper »

Thanks!
User avatar
GrimReaper
Sergeant
Posts: 58
Joined: Tue Dec 30, 2003 5:40 am

Post by GrimReaper »

It didnt seem to work I put the scr file in with the BSP while making the pk3 it loads.The documents flash red but the allies cant take them nor can the axis?Can someone give me a screenshot of where the trigger should go or something?Anything that you people can think of that could make it not work/work?!When I type in targetname and then documents it sais classname instead of targetname...is that right?
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

1) Dont make a pk3 while testing. Its only extra work.
2) The trigger should enclose the documents (because the player will try to trigger the docs, as he/she cant see the trigger itself).
3) Is the scr file in the same dir as the bsp file?
4) Does the scr file have the same name as the bsp file (if your map is "hello_monkey.bsp", the script should be named "hello_monkey.scr")?
5) Does your script contain errors? Look in the text in the console... or set logfile 2 before loading the map and look in the "qconsole.log" file in your main dir afterwards...

Help any?
Admin .MAP Forums
Image
Head above heels.
User avatar
GrimReaper
Sergeant
Posts: 58
Joined: Tue Dec 30, 2003 5:40 am

Post by GrimReaper »

I dont get errors but I get a lot of warnings if that is what you mean.I get WARNING-DOWNGRADING TO OLD ANIMATION FORMAT- and the other is the light leaked entity.Oh error loading objtest(name of my map).pft!!!!!!I think that is probibly it!But under where your guyses General tutorials for mapping it doesnt say that you need to put the pft file in with your PK3 so that shouldnt be it?I may be doing the script wrong...All the things that you added with "//" should I delete them or keep them there?I kept them there! :? :( :!: :?: :idea:
User avatar
GrimReaper
Sergeant
Posts: 58
Joined: Tue Dec 30, 2003 5:40 am

Post by GrimReaper »

Alrighty,I checked to see if this question was anywhere in here and I didnt seem to find it but anyways...I was woundering if you can edit the MOH:AA stock maps?I'm off topic but it kinda was my post so I guess you guys wouldnt care:P?
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

GrimReaper wrote:I get WARNING-DOWNGRADING TO OLD ANIMATION FORMAT- and the other is the light leaked entity.
Does not affect the triggers and objectives.
GrimReaper wrote:Oh error loading objtest(name of my map).pft!!!!!!I think that is probibly it!
Think this is something to do with transparent textures... not sure, but pretty sure it won't affect triggers and objectives.
GrimReaper wrote:All the things that you added with "//" should I delete them or keep them there?I kept them there!
Everything after "//" on a line is ignored by MOH... "//" are used to remove code while keeping it in the file, or writing helpful comments for humans to read.

So... what does your script look like? Please post it inside a pair of CODE tags. Maby there is an error in there....
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 »

GrimReaper wrote:I was woundering if you can edit the MOH:AA stock maps?
No not really, but you can add things with scripting. There is a tutoial on adding a working flak in the tutorial section.
Admin .MAP Forums
Image
Head above heels.
User avatar
GrimReaper
Sergeant
Posts: 58
Joined: Tue Dec 30, 2003 5:40 am

Post by GrimReaper »

Code: Select all

// Custom objective test map
// ARCHITECTURE: Bjarne Gr?nnevik// SCRIPTING: Bjarne Gr?nnevikmain:
	setcvar "g_obj_alliedtext1" "Steal the documents." 
	setcvar "g_obj_alliedtext2" "- Go get them"
	setcvar "g_obj_alliedtext3" "- U know U want to"
	setcvar "g_obj_axistext1" "Prevent the allies"
	setcvar "g_obj_axistext2" "from stealing the"
	setcvar "g_obj_axistext3" "documents."
	setcvar "g_scoreboardpic" "none"
	level waittill prespawn
	exec global/OBJprecache.scr
	// Change <objtest> to
	// the name of you'r map file
	level.script = maps/obj/<objtest>.scr
	exec global/ambient.scr <objtest>
	level waittill spawn
	// 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 // axis, allies, kills, or draw
	// Comment out this line to be able to set the bomb
	// when alone on the map ( just for testing )
	// level waittill roundstart
	// Start the win check thread for allies
	thread desk_document_check
	// If the end of the match is reached, the Axis win
	level waittill axiswin
end // end of main

// Document checks
desk_document_check:	while(1) { // forever
		// Dont execute past this line
		// until someone triggers the object
		$documents_trigger waittill trigger
		// parm.other is the triggerer
		if(parm.other.dmteam == allies) {
			// Make the document graphix disappear
			$documents hide
			// break out of the while loop
			break
		}
		// protection against making this
		// thread use too much CPU
		waitframe
	}
	teamwin allies // Make allies win the match
end // end allies victory test

think thats what you want:P :? :lol:
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

This should work better:

Code: Select all

// Custom objective test map
// ARCHITECTURE: Bjarne Gr?nnevik
// SCRIPTING: Bjarne Gr?nnevik
// the main below was on the line above (commented out)
main:
   setcvar "g_obj_alliedtext1" "Steal the documents."
   setcvar "g_obj_alliedtext2" "- Go get them"
   setcvar "g_obj_alliedtext3" "- U know U want to"
   setcvar "g_obj_axistext1" "Prevent the allies"
   setcvar "g_obj_axistext2" "from stealing the"
   setcvar "g_obj_axistext3" "documents."
   setcvar "g_scoreboardpic" "none"
   level waittill prespawn
   exec global/OBJprecache.scr
   // Change <objtest> to
   // the name of you'r map file
   // Really... change the <objtest> to
   // your map name... no '<' or '>'
   level.script = maps/obj/<objtest>.scr
   exec global/ambient.scr <objtest>
   level waittill spawn
   // 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 // axis, allies, kills, or draw
   // Comment out this line to be able to set the bomb
   // when alone on the map ( just for testing )
   // level waittill roundstart
   // Start the win check thread for allies
   thread desk_document_check
   // If the end of the match is reached, the Axis win
   level waittill axiswin
end // end of main

// Document checks
desk_document_check:
   while(1) { // forever
      // Dont execute past this line
      // until someone triggers the object
      $documents_trigger waittill trigger
      // parm.other is the triggerer
      if(parm.other.dmteam == allies) {
         // Make the document graphix disappear
         $documents hide
         // break out of the while loop
         break
      }
      // protection against making this
      // thread use too much CPU
      waitframe
   }
   teamwin allies // Make allies win the match
end // end allies victory test
You had commented out the very important "main:" (or rather moved it up to the comment on line 2).
Admin .MAP Forums
Image
Head above heels.
User avatar
GrimReaper
Sergeant
Posts: 58
Joined: Tue Dec 30, 2003 5:40 am

Post by GrimReaper »

I know you have done a lot for me but can you make the script for me becaseu its still confusing.The name of my map is objtest.Man I still couldnt get it to work!You dont have to if you dont want obviously but it would really be appreciated!Man where it sais exec global/ambient.scr <objtest>. I wasent sure if I had to change the ambient to objtest or what:PSo please someone help the newbie. :wink:
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

This should be it:

Code: Select all

// Custom objective test map
// ARCHITECTURE: GrimReaper
// SCRIPTING: GrimReaper
main:

   setcvar "g_obj_alliedtext1" "Steal the documents."
   setcvar "g_obj_alliedtext2" "- Go get them"
   setcvar "g_obj_alliedtext3" "- U know U want to"
   setcvar "g_obj_axistext1" "Prevent the allies"
   setcvar "g_obj_axistext2" "from stealing the"
   setcvar "g_obj_axistext3" "documents."

   setcvar "g_scoreboardpic" "none"

   level waittill prespawn

   // There is no OBJprecache.scr
   exec global/DMprecache.scr

   level.script = maps/obj/objtest.scr

   // m6l1a is a blowing wnind sound
   exec global/ambient.scr m6l1a

   level waittill spawn

   // 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 // axis, allies, kills, or draw

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

   // Start the win check thread for allies
   thread desk_document_check

   // If the end of the match is reached, the Axis win
   level waittill axiswin

end // end of main

// Document checks
desk_document_check:
   while(1) { // forever
      // Dont execute past this line
      // until someone triggers the object
      $documents_trigger waittill trigger
      // parm.other is the triggerer
      if(parm.other.dmteam == allies) {
         // Make the document graphix disappear
         $documents hide
         // break out of the while loop
         break
      }
      // protection against making this
      // thread use too much CPU
      waitframe
   }
   teamwin allies // Make allies win the match
end // end allies victory test
If it still doesent work, I suggest you go over all targetnames again and read the tutorial again, both VERY carefully :)
It's SOOOO very easy to forget one small thing that makes it all F.U.B.A.R.
Admin .MAP Forums
Image
Head above heels.
User avatar
GrimReaper
Sergeant
Posts: 58
Joined: Tue Dec 30, 2003 5:40 am

Post by GrimReaper »

Ok,im finally back because I got some virus but anyways..thanks bro I finally got it to work after that but...I have one more question.You know how you put the noise in my script,Well the noise doesnt really follow my map.I have a map like the v2,and I woundering if someone could just put the name of one that would fit for a factory inside kinda map.So someone just give a little list of different noises.Thanks!!!
Post Reply