Page 1 of 2

minefield tutorial?

Posted: Mon Feb 19, 2007 3:30 pm
by Liberator
Hi everyone ;)

Anyone knows where to find a "minefield tutorial"?

Lib ;)

Posted: Mon Feb 19, 2007 4:33 pm
by Imagination
make a brush trigger multiple, give it a targetname minefield then add to your script exec global/minefield.scr

Posted: Mon Feb 19, 2007 6:31 pm
by Liberator
Hi and thanks, but im not cool with scripting... what should I add to the scr file?

script

Posted: Mon Feb 19, 2007 11:06 pm
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!

Posted: Mon Feb 19, 2007 11:39 pm
by Liberator
woaw! -Yeah Ill take a look at it ;)

And thank you for the detailed explanation ;)

Lib

Posted: Tue Feb 27, 2007 11:59 am
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 :)

Posted: Tue Feb 27, 2007 1:52 pm
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

Posted: Tue Feb 27, 2007 2:51 pm
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 ;)

Posted: Tue Feb 27, 2007 3:07 pm
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

Posted: Tue Feb 27, 2007 3:18 pm
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 :)

Posted: Tue Feb 27, 2007 5:01 pm
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

Posted: Tue Feb 27, 2007 5:52 pm
by Liberator
Uhm...DM mode? :?

Posted: Tue Feb 27, 2007 6:22 pm
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

Posted: Tue Feb 27, 2007 7:02 pm
by Liberator
Ah no...I never create singleplayer maps. Only team or deathmatches ;)

Lib

Posted: Tue Feb 27, 2007 8:03 pm
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?
...