Whats the right command to know coordinates on maps

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

Moderator: Moderators

Post Reply
GR3KO
Lance Corporal
Posts: 22
Joined: Fri Aug 16, 2013 1:59 pm

Whats the right command to know coordinates on maps

Post by GR3KO »

Hello can someone tell me the right command to know coordinates on maps to add items like crates etc ?
coords ...
and how to use it please?

Thanks !!

GR3KO
BatteryAziz
Moderator
Posts: 82
Joined: Tue Jun 15, 2010 4:44 pm

Re: Whats the right command to know coordinates on maps

Post by BatteryAziz »

type viewpos in console, it will give you the x,y,z coordinates and angle where you're standing.

so you walk around your map, type viewpos where you want to add stuff and write them down. since the z-coordinate is at eye-height (not the floor) you have to compensate for that by 50-100 units depending on the size of the item. so let's say you want to add a spawn point (like info_player_allied) somewhere, and viewpos gives you "500 240 95". in this case the z-coordinate is exactly 83 units too high. so in script you use "500 240 12" so you don't spawn high up in the air. remember each item is different this is just an example.

now an example how to spawn blueprints (i use this in my own map):

local.mydocuments = spawn script_model "model" "items/naxosplans2.tik"
local.mydocuments.origin = ( -1000.00 568.00 -736.00 )
local.mydocuments.angles = ( 0 315 0 )

for the angle, remember that the x/y/z-axis = tilt/rotate/tilt. so for in-plane rotation you only adjust the second term like ( 0 90 0) or ( 0 180 0 ).

for mohaa, you can find the items you want to spawn in pak0.pk3\models\, not sure for spearhead. just look for the .tik file and adjust the path appropriately.

to open/edit .pk3 files, download pakscape. if you're going to edit stock files, be sure to make a backup just in case you screw up.

i don't know if you've ever adjusted a map's script, so i'll just give you an example. let's say you want extra stuff in stalingrad. you find the mohdm6.scr (it's in main\pak5.pk3\DM\), copypaste mohdm6.scr to your desktop, and open it with notepad (or notepad++). this stock script file looks like this:

Code: Select all

// STALINGRAD
// ARCHITECTURE: ZIED, POWZER
// SCRIPTING: POWZER

main:

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

setcvar "g_scoreboardpic" "mohdm6"

	// 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/mohdm6.scr
	exec global/ambient.scr mohdm6
	
	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
to add an item you put your extra code like so:

Code: Select all

// STALINGRAD
// ARCHITECTURE: ZIED, POWZER
// SCRIPTING: POWZER

main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "Stalingrad"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" "With extra stuff"
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "mohdm6"

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

	level waittill prespawn
	
	local.mystuff = spawn script_model "model" "items/something.tik"
	local.mystuff.origin = ( x y z )
	local.mystuff.angles = ( 0 0 0 )

	local.mystuff2 = spawn script_model "model" "items/somethingelse.tik"
	local.mystuff2.origin = ( x y z )
	local.mystuff2.angles = ( 0 0 0 )
	
	//*** Precache Dm Stuff
	exec global/DMprecache.scr

	exec global/door_locked.scr::lock
	level.script = maps/dm/mohdm6.scr
	exec global/ambient.scr mohdm6
	
	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

when you're done, save, and overwrite the stock mohdm6.scr with your editted mohdm6.scr (copypaste back to pakscape) and then save the pk3. if you run a server with these changes, all players see the items too.

i hope this answers your question? :mrgreen:
Post Reply