adding player spawn points in maps thru script

Post your scripting questions / solutions here

Moderator: Moderators

M&M
General
Posts: 1427
Joined: Sun Sep 14, 2003 1:03 am
Location: egypt
Contact:

adding player spawn points in maps thru script

Post by M&M »

hi every1,
my problem is that some of the maps i dloaded (.bsp format or pk3) have only one spawn area 4 players in ffa mode (imagine what happens at the begining of every level).many of these maps are cool so thats y i want 2 play them,after learning that i cant edit them by decompiling editing and recompiling (by trial and error :x ,and asking in mapping forum) i was told that i could use script 2 edit it ,so my question obviously is HOW :?: ?i know nothing about scripting ,im a total newbie.
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Step one: learn scripting: http://www.planetmedalofhonor.com/rjuka ... guage.html

Step 2: Something like this:

Code: Select all

spawn info_player_axis targetname a_new_spawn_is_here
$a_new_spawn_is_here.origin = ( 100 100 100 )
Admin .MAP Forums
Image
Head above heels.
Sgt.Pepper
Sergeant
Posts: 69
Joined: Tue Feb 25, 2003 5:41 pm
Location: Canada

Post by Sgt.Pepper »

Here is an example of one spawn point added to a map by Rindog, the fella that "discovered" spawning spawn points.
local.axis = spawn info_player_axis
local.axis.origin = ( 432 -16 -32 )
local.axis.angle = 0
Change the spawn info_player_axis to the appropriate spawn point for ffa. The origin is the loacation in the map, and the angle is the angle of the spawn point, which way the player will face when spawned.
M&M
General
Posts: 1427
Joined: Sun Sep 14, 2003 1:03 am
Location: egypt
Contact:

Post by M&M »

thnx guys i guess thats what i need but there is still one more problem ,eerrm where do i type this :?: :oops: the console?
Image
User avatar
The Jackal
Sergeant Major
Posts: 101
Joined: Wed May 07, 2003 10:09 am
Contact:

Post by The Jackal »

I guess you missed that!
Bjarne BZR wrote:Step one: learn scripting: http://www.planetmedalofhonor.com/rjuka ... guage.html
But for simplification purposes.

1. First of all you need to get the locations that you wish to spawn a player at. Start a server and go to the spot(s) and in the console type:

Code: Select all

viewpos
This returns your location and the angle you are facing e.g (696 -452 -1247) : -125

2. Using Notepad, create a file and save it as my_spawns.scr
3. Add the following to the my_spawns.scr file:

Code: Select all

// Axis spawn here
local.axis = spawn info_player_axis 
local.axis.origin = ( 696 -452 -1247 )
local.axis.angle = -125

// Allies spawn here
local.allied = spawn info_player_allied 
local.allied.origin = ( 900 809 -1694 ) 
local.allied.angle = 85

// FFA players spawn here
local.freeforall = spawn info_player_deathmatch 
local.freeforall = ( 900 809 -1694 ) 
local.freeforall = 85

// (You can repeat this to add more Allied, German or FFA spawns)
Next, you need to call this my_spawn.scr from the map script file (mp_Malta_dm.scr) so that the spawns you added can be loaded.

4. Using Packscape, export the map script file from the PK3 file.
5. Open the map script file (using Notepad)
6. Add this line above "level waittill spawn":

Code: Select all

exec global/my_spawns.scr
7. Finally you need to create a PK3 file to store your scripts.
8. In the new PK3, create these folders - in the paths shown:

maps/DM // We use the same path we got the original map script file from.
global

9. Import the map script file to the DM folder
10. Import the my_spawns.scr to the Global folder

11. Save your PK3 (user_morepspawns.pk3)

Place this file in your game directory (main, mainta)

That's it!
Last edited by The Jackal on Sun Sep 28, 2003 5:41 pm, edited 1 time in total.
M&M
General
Posts: 1427
Joined: Sun Sep 14, 2003 1:03 am
Location: egypt
Contact:

Post by M&M »

tnx alot 4 ur help,ive tried 2 read the tutorial 2(but i just got lost because its so big) ,and there are still a few small points i didnt get :oops: (plz dont shoot me).the points i didnt understand were:

3:what was that about (mp_malta_dm.scr) i didnt quit understand what this is and has 2 do with my maps but i understood the part about making the my_spawn.scr though

4:if u mean export the .bsp (or any other format) file out of the pk3 then im afraid that isnt possible cause most of the maps i want 2 edit are .bsp format already

other than that i understood almost well :?

tnx again 4 ur help jackal and every1 else but plz explain those points 2 me and excuse me 4 my ignorance :oops: .
Image
User avatar
The Jackal
Sergeant Major
Posts: 101
Joined: Wed May 07, 2003 10:09 am
Contact:

Post by The Jackal »

M&M wrote:(plz dont shoot me)
No Promises
M&M wrote:what was that about (mp_malta_dm.scr)
I used the Malta filename for example purposes. The file you need to open is the .SCR file with the mapname you are trying to add spawns to.
M&M wrote:if u mean export the .bsp
Never said anything about .BSP

Hope this helps!
M&M
General
Posts: 1427
Joined: Sun Sep 14, 2003 1:03 am
Location: egypt
Contact:

Post by M&M »

ok,tnx again 4 replying 1st
but it still didnt work :shock: *hiding in kevlar vest*,i think i did everything exactly how u described.
1\i found a few spawn points and put them in a my_spawn.scr file with notepad using the script u gave me
2\i told the pk3 2 run using winrar then extracted the (original).scr from it
3\i opened it with notepad and added above the line "level waittill spawn" ,not respawn the code u gave me "exec global\myspawn.scr"
4\i replaced the .scr in the pk3 with this one then added my_spawn.scr with them and also in a folder i made called main\dm\global\(file in here)

5\i ran the game on 2 pcs ,and still one spawned at one place and the other right over his head

so where have i gone wrong *hides hands in kevlar vest :roll: *

oh and 1 more thing,i copied and pasted the script (except for the points and angle) so there is no possible way i could have mistyped .
Image
User avatar
The Jackal
Sergeant Major
Posts: 101
Joined: Wed May 07, 2003 10:09 am
Contact:

Post by The Jackal »

I see several things wrong here.

1. In the original map script, above "level waittill spawn", be sure you type the EXACT path and file name. The line should read:

exec global/my_spawns.scr ( not myspawns.scr ) and use / not \

Now in the my_spawn.scr you will should have a folder named Maps. In that folder you should have a DM or OBJ folder depending on the original path and map type. In the DM or OBJ folder you should have placed the modified map script file.

Now back in the root of the PK3 file, you need to add a folder and Name it Global. Then place your my_spawns.scr file in there. Remember this is the path you referenced in the map script file.

Save it as user_morespawns.pk3 and place in Main folder. Take your time and read these steps. It's all explained before. I could easily take the files and make the mod for you, but I want you to learn to do it.

PS: Kevlar is over-rated!
M&M
General
Posts: 1427
Joined: Sun Sep 14, 2003 1:03 am
Location: egypt
Contact:

Post by M&M »

well tnx 4 wanting me 2 learn,because i really do want 2.i actually copied and pasted the script u gave me because i wanted 2 make no mistakes,i just wrote \ instead of / by accident and i wrote the file as my_spawn.scr as u said i also mistyped it here 2:oops: .and i placed the (original).scr and the my_spawn.scr in main\maps\dm ,and main\maps\dm\global in the origninal .pk3

after i read ur last post i placed an extra (user_morespawns).pk3 file in main folder and i placed a global folder in the root directory of that pk3 and maps\dm\ and inside each global is a my_spawn.scr file (its probably now in seven different places).i now understand what i did but i dont know which one of them is wrong.
sgt.pepper wrote: local.axis = spawn info_player_axis
local.axis.origin = ( 432 -16 -32 )
local.axis.angle = 0
why does this code differ a little from the one u gave me
Image
User avatar
The Jackal
Sergeant Major
Posts: 101
Joined: Wed May 07, 2003 10:09 am
Contact:

Post by The Jackal »

OK you have several players you can spawn.

This one allows you to spawn an German player:

Code: Select all

// Axis spawn here
local.axis = spawn info_player_axis
local.axis.origin = ( 696 -452 -1247 )
local.axis.angle = -125
The Allied player

Code: Select all

// Allies spawn here
local.allied = spawn info_player_allied
local.allied.origin = ( 900 809 -1694 )
local.allied.angle = 85
The Free For All Player

Code: Select all

// FFA players spawn here
local.freeforall = spawn info_player_deathmatch
local.freeforall.origin = ( 900 809 -1694 )
local.freeforall.angle = 85
The first player to join the server spawns in Spectator at this location:

Code: Select all

local.start1 = spawn info_player_start
local.start1.origin = ( 1200 205 -1575 )
local.start1.angle = 18
For your script, you need to use the FFA spawns. Allies or Axis are not valid teams when playing in FFA gametype. I just listed them all incase someone was searching for help would find use in them.

You do not need 3 million PK3 files to do the same thing. Delete all execept one and email it to me for perusal.

evansluytman@aol.com
Last edited by The Jackal on Tue Sep 30, 2003 5:27 pm, edited 1 time in total.
M&M
General
Posts: 1427
Joined: Sun Sep 14, 2003 1:03 am
Location: egypt
Contact:

Post by M&M »

i need 2 do this on my own so i can feel i accompolished something,i know u have that feeling that im not doing it right but i copied and pasted ur script and did exactly what u said.
the main folder contains the map.pk3 which contains the edited.scr (added the line exec global/my_spawn.scr above 'level waittill spawn")
and it also contains a new (user_morespawnpoints).pk3 which contains a my_spawn.scr in a global folder in root directory and in the maps/dm directory 2 be sure.
i will also show u a potrion of the script inside the files u told me 2 edit

original .scr

Code: Select all

...........
//$world farplane 5000
//$world farplane_color (.333 .333 .329)

$world farplane_color "0.752941 0.752941 0.752941"
level.fogplane = 1500
$world farplane level.fogplane

exec global/my_spawn.scr (//do spaces between lines affect the script?)

level waittill spawn
thread random_explode1

end
.........
my_spawn.scr

Code: Select all

 local.freeforall = spawn info_player_deathmatch 
local.freeforall = ( 2815 234 334 ) 
local.freeforall = 195

local.freeforall = spawn info_player_deathmatch 
local.freeforall = ( 2337 -491 240 )
local.freeforall = 175

local.freeforall = spawn info_player_deathmatch 
local.freeforall = ( 2397 1004 240 )
local.freeforall = -176
there is another problem,i thought maybe this map might be a bit screwed so i tried another but i found that it only comes in .bsp format without any .scr files in its pk3 so tell me what 2 do on the both (but the 1st most importantly)
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

local.freeforall = ( 2815 234 334 )

should be

local.freeforall.origin = ( 2815 234 334 )

local.freeforall = 195

should be omitted :?
Image
M&M
General
Posts: 1427
Joined: Sun Sep 14, 2003 1:03 am
Location: egypt
Contact:

Post by M&M »

ok,after i did that same result but now i have no fog in the map
there was fog previously.i thought maybe i screwed the wrong line so i started from scratch with the original .pk3 and edited the .scr that came with the map then added the new spawn points in the same .pk3 and another 1 for precation.they both contain a global folder in the root directory containing the my_spawn.scr,those pk3s are ofcourse in the main folder.and still no fog,but thats not a big problem right now (the map is rather better without it but its still a problem i wish 2 adress later)and no spawn points either :o :shock: :? :( :cry: :evil: :twisted:
jv_map wrote:local.freeforall = 195

should be omitted
isnt that used 2 set the angle of spawning?
or local.freeforall.origin = 195 ?
Image
User avatar
The Jackal
Sergeant Major
Posts: 101
Joined: Wed May 07, 2003 10:09 am
Contact:

Post by The Jackal »

Right, you need 3 basic parts. The spawn entity, the origin and the angle. While the angle is not really necessary, it looks better to spawn in the right angle than facing a wall.

local.spawn // spawn the entity
local.spawn.origin // in this location
local.spawn.angle // facing this direction

Next, remove the 2 parenthesis in this line of text.

Code: Select all

exec global/my_spawn.scr (//do spaces between lines affect the script?)
Its making your whole mapscript dead.

That should do it.
Post Reply