minefield tutorial?

If you're looking for mapping help or you reckon you're a mapping guru, post your questions / solutions here

Moderator: Moderators

User avatar
Liberator
First Lieutenant
Posts: 196
Joined: Sun Jul 02, 2006 10:55 am
Location: Denmark

minefield tutorial?

Post by Liberator »

Hi everyone ;)

Anyone knows where to find a "minefield tutorial"?

Lib ;)
I liberate stuff...the danish way..
Imagination
Sergeant
Posts: 56
Joined: Thu May 04, 2006 7:35 am

Post by Imagination »

make a brush trigger multiple, give it a targetname minefield then add to your script exec global/minefield.scr
User avatar
Liberator
First Lieutenant
Posts: 196
Joined: Sun Jul 02, 2006 10:55 am
Location: Denmark

Post by Liberator »

Hi and thanks, but im not cool with scripting... what should I add to the scr file?
I liberate stuff...the danish way..
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

script

Post by tltrude »

The tutorial is in the global/minefield.scr script itself. Here is what it says.

//**********************************
//*** minefield script
//*** The player enters the minefield, and within a short random amount of time
//*** if he's still in the minefield he'll blow himself up and crush his skull.
//*** This main thread is called by this script and should not be called by the
//*** level script itsself. The level script should call minefield_setup
//*** syntax ------------------------------------
//*** minefield [this is the index number for the array of minefield triggers]
//*********************************

I think I can help you understand this a little better.

First off, I hope you know what a "thread" is. It is a section of a script that starts with a name like "main:". Notice the colon just after the thread name. All thread names have a colon. The thread has lines in it that are read by the game (lines that start with "//" are just comments). The game stops reading the lines when it get to one with "end" in it.

Your map's script, also called the "level script", will start with a thread named "main:" -- as does the minefield script. And, that is where the line for the minefield script goes. Here is an example from mohdm4.scr -- also know as "The Bridge".

Code: Select all

main:

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

setcvar "g_scoreboardpic" "mohdm4"

	// call additional stuff for playing this map round based is needed
	if(level.roundbased)
		thread roundbasedthread

	level waittill prespawn

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

	exec global/door_locked.scr::lock
	level.script = maps/dm/mohdm4.scr
	exec global/ambient.scr mohdm4
	
	thread global/minefield.scr::minefield_setup // <-- runs minefield script thread

	level waittill spawn

end

//-----------------------------------------------------------------------------

roundbasedthread:

	// Can specify different scoreboard messages for round based games here.

	level waitTill prespawn

	level waittill spawn

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

	level waittill roundstart

end
See it?

The tutorial also talks about an "array of triggers". "Array" just means more than one. So, you can have as many minefield triggers (trigger_multiples) as you like. But, they all must have the same targetname.

Key: targetname
Value: minefield

Hope that helps!
Tom Trude,

Image
User avatar
Liberator
First Lieutenant
Posts: 196
Joined: Sun Jul 02, 2006 10:55 am
Location: Denmark

Post by Liberator »

woaw! -Yeah Ill take a look at it ;)

And thank you for the detailed explanation ;)

Lib
I liberate stuff...the danish way..
User avatar
Liberator
First Lieutenant
Posts: 196
Joined: Sun Jul 02, 2006 10:55 am
Location: Denmark

Post by Liberator »

What may I change in that script to make it work in my pk3?



As I understand, I should make a .scr file with those lien above, right? :)
Then put it in my map/dm/minefield.scr (I call it minefield.scr)
In MOHradient I Put a multiple trigger with key: targetname - and Value: minefield . And when I step on that trigger I blow up...

I cant make it work... :(

Mine looks like this:

Code: Select all

main:


// set scoreboard messages


setcvar "g_obj_alliedtext1" "The Crossroads"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "mohdm4"

  // call additional stuff for playing this map round based is needed
  if(level.roundbased)
  thread roundbasedthread

      level waittill prespawn

      //*** Precache Dm Stuff
      exec global/DMprecache.scr
 
      exec global/door_locked.scr::lock
      level.script = maps/dm/minefield.scr
      exec global/ambient.scr mohdm4
   
      thread global/minefield.scr::minefield_setup // <-- runs minefield script thread

      level waittill spawn

      end

//-----------------------------------------------------------------------------

roundbasedthread:

// Can specify different scoreboard messages for round based games here.

level waitTill prespawn

level waittill spawn

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

level waittill roundstart

end 

Hope u see my mistakes

Lib :)
I liberate stuff...the danish way..
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

You put ur script into "main/map/dm"? So u created an additional folder called "map"? Your bsp is main/maps/dm/minefield.bsp?

You should place both, minefield.bsp nd minefield.scr into main/maps/dm
User avatar
Liberator
First Lieutenant
Posts: 196
Joined: Sun Jul 02, 2006 10:55 am
Location: Denmark

Post by Liberator »

wacko wrote:You put ur script into "main/map/dm"? So u created an additional folder called "map"? Your bsp is main/maps/dm/minefield.bsp?

You should place both, minefield.bsp nd minefield.scr into main/maps/dm
yes..I forgot to mention that The .scr file should be placed in the same dir as the .bsp file. They?re both in the map/dm dir ;)
I liberate stuff...the danish way..
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

Liberator wrote:They?re both in the map/dm dir ;)
'map' or 'maps'? ought to be 'maps', especially when mentioning this path in ur script
User avatar
Liberator
First Lieutenant
Posts: 196
Joined: Sun Jul 02, 2006 10:55 am
Location: Denmark

Post by Liberator »

wacko wrote:
Liberator wrote:They?re both in the map/dm dir ;)
'map' or 'maps'? ought to be 'maps', especially when mentioning this path in ur script
Yes my mistake. Its IS "maps" written in my pk3 ;) Sorry to confuse you :)
I liberate stuff...the danish way..
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

For me, your script is okay.
I quckly made a map with the trigger_multiple and booom it worked.
Here's my working pk3, inside u find the map-file.
So, you must have done something wrong in your map. Or, you didn't test in DM-mode, starting as SP won't work ofcourse
User avatar
Liberator
First Lieutenant
Posts: 196
Joined: Sun Jul 02, 2006 10:55 am
Location: Denmark

Post by Liberator »

Uhm...DM mode? :?
I liberate stuff...the danish way..
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

Liberator wrote:Uhm...DM mode? :?
i.e. Deathmatch. Giving a map some deathmatch-spawnpoints and putting it into maps/dm "makes" it a Deathmatch map. Starting it as Singleplayer wont execute this script. For this, u'd have to put the map and scr into main/maps and change the line in ur script:

Code: Select all

      level.script = maps/minefield.scr
User avatar
Liberator
First Lieutenant
Posts: 196
Joined: Sun Jul 02, 2006 10:55 am
Location: Denmark

Post by Liberator »

Ah no...I never create singleplayer maps. Only team or deathmatches ;)

Lib
I liberate stuff...the danish way..
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

Errr, so?

U did put bsp and scr into maps/dm?
U did launch ur map as a deathmatch map?
Your minefield didn't work?

U did copy ma pk3 into mohaa/main?
U did launch my map minefield?
My minefield did work?

You did take a look into my map file?
You did compare the both trigger_multiples?
...
Post Reply