Raised This Month: $51 Target: $400
 12% 

Inserting weapons on maps


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
za_bullet
Junior Member
Join Date: Nov 2005
Old 11-23-2005 , 08:06   Inserting weapons on maps
Reply With Quote #1

Is it possible to "insert" weapons on the ground/on the map for players to pick up? If so, how?

D.
za_bullet is offline
Send a message via AIM to za_bullet
za_bullet
Junior Member
Join Date: Nov 2005
Old 11-24-2005 , 06:09  
Reply With Quote #2

Ok so I found something HERE

http://forums.alliedmods.net/showthread.php?p=335826

I assume you can do this with weapons too.....but is there a solution for getting it to work on windows?

D.
za_bullet is offline
Send a message via AIM to za_bullet
Austin
Senior Member
Join Date: Oct 2005
Old 11-27-2005 , 04:55   Re: Inserting weapons on maps
Reply With Quote #3

Quote:
Originally Posted by za_bullet
Is it possible to "insert" weapons on the ground/on the map for players to pick up? If so, how?

D.
You can insert weapons and do a whole lot more then that.
The map files (bsp format) have a large plain text section in them that defines nearly everything in the map you interact with like doors, crates, ladders, etc. You can see this text if you open a map in a hex editor. These items are called entities. There are two types.Point based, the ones you can change, and brush based ones you cannot change but you still can remove the brush based one too.

The great thing about entities is you can change them without having the map source code. You can change them without recompiling the map!

If you modify a map and put it on your server, when someone connects that already has the map they will not have to dl the modified map (in fact it won’t dl) BUT they WILL get your changes, because all of the entities are handled server side and sent to the client.

You can add in guns, grenades, kevlar.
You can add in any model anywhere in the map!
You can take out doors or
what I do is change all of the doors that swing open (func_door_rotating)
to the type of door that slides into the wall (func_door).
I do this because I play a lot of bots on the server and the bots handle these types of doors way better.

You can also remove items for the maps like take out crates and stuff.

For - CS 1/5 / 1.6 / condition zero maps.
---------------------------------------------------
Zoner’s hl tools for cs 1.5/.16 shipped with a dos tool called ripent.exe.
You could dump the entities to a text file, modify the text file and import your changed /added/removed entities back to the map. This utility was poorly written (imho) , had fixed memory sizes and would crash on a lot of maps.

I wrote a Windows application, BSPEdit to do this and you can dl it and the source code for it here:
http://filebase.bots-united.com/inde...on=file&id=177

I also wrote a Metamod utility that lets you simply start a LAN game and walk around in the map adding in guns nades, Kevlar and spawnpoints! You can dl it here:
http://filebase.bots-united.com/inde...on=file&id=297

But this is for cs 1.5/1.6/cz only. I will add support for hl2 bsp files and it is trivial to do for BSPEdit but I don’t have any time right now but will get to it asap.

Porting BSPEdit_mm to Metamod Source would take some doing since I don’t’ know the hl2 sdk or Metamod Source. The source code is in the dl if some one is interested!

Take a look at this thread where the person adds in a helicopter to his map.
http://forums.bots-united.com/showthread.php?t=4661

For more information on entity hacking go here:
http://forums.bots-united.com/forumdisplay.php?f=3

You can check out my server here:
Source:
68.165.128.15:27015 AustinBots! Source!
CZ:
68.165.128.15:27016 AustinBots! 1
When you join you will see guns in the spawn area and a number of other changes to the maps.

HL2 / Source mapping
----------------------------
Someone wrote a tool that lets you modify HL2 map entities.
You can dl it here:
http://ented.mybigspoon.com/

Ok how is this done?
-----------------------------
You asked about adding in guns. Here are some examples for SOURCE (HL2 format bsp files)

An entity starts and ends with {}

Here is an m4.
{
"origin" "1376 3168 -112"
"angles" "0 0 0"
"classname" "weapon_m4a1"
}

So to add in an m4 all you got to do is.
1) run ented and open up a map
2) Scroll down to the very end of the entities and paste in the above 4 lines. (the above example will only work with de_dust because of the origin line, more on this later..)
3) Save it.

The next time you load de_dust it will have an m4 in the ts spawn area and you can pick it up!

Here is the tricky part and why I wrote BSPEdit_mm.
Notice the origin line in the entity.
This specifies where in the map the gun is going to be created.
So lets say you are standing around at the ts spawn area in dust and you want to add in some guns. How would you know where you are in the map?

You can start a LAN game and go to the console and type:
Status
This will give you your x,y,z cords in the maps where you are currently standing.
This is tedious and what we will have to live with until I port BSPEdit_mm over to Metamod Source…..

Here are 6 entities for de_dust.
I put the 3 main t guns at the ct spawn area and I put the 3 main ct guns at the ts spawn area. I like to be able to pick any gun I want when I play!

So just open up de_dust with ented
Paste in these lines at the end and save it.
For all the other maps you will have to get the cords from the console status command and then add them in by hand.
Make SURE you don't add in any blank line between the ents.
{
"origin" "1376 3168 -112"
"angles" "0 0 0"
"classname" "weapon_m4a1"
}
{
"origin" "1200 3504 -96"
"angles" "0 0 0"
"classname" "weapon_aug"
}
{
"origin" "1504 3264 -112"
"angles" "0 0 0"
"classname" "weapon_famas"
}
{
"origin" "160 -1712 90"
"angles" "0 0 0"
"classname" "weapon_ak47"
}
{
"origin" "176 -1600 90"
"angles" "0 0 0"
"classname" "weapon_sg552"
}
{
"origin" "16 -1584 90"
"angles" "0 0 0"
"classname" "weapon_galil"
}

If people are interested I can post my changes to all the default cs source maps.
I also add in more spawn points so you can have more then 20 players per side.

Here is a list of weapons for Cs Source maps.
weapon_galil
weapon_ak47
weapon_sg552

weapon_famas
weapon_m4a1
weapon_aug

weapon_deagle
weapon_flashbang
weapon_hegrenade
weapon_smokegrenade

item_defuser
weapon_c4
weapon_glock
weapon_usp
weapon_p228
weapon_fiveseven
weapon_elite
weapon_m3
weapon_xm1014
weapon_tmp
weapon_mp5navy
weapon_ump45
weapon_p90
weapon_mac10
weapon_scout
weapon_g3sg1
weapon_sg550
weapon_awp
weapon_m249

One other thing…..
When I add in guns nades and kevlar I give them a z coord that is high off the ground. That puts them in the air. When the rounds restarts the guns spawn in the air and drop to the ground or if you put them above a player spawn and a player /bot is there they will drop into their hands, both of which are nice effects.

The best thing to do to learn about all the entities is to install hammer and learn how to create a basic map. A simple box is fine. Then you can use the entity map tool to put in guns and a (whole lot of other things), compile the map and then look at the entity text in the bsp to see what hammer adds in. This is exactly what I did to get guns into source maps. The format of the weapon items changed from cs 1.6 and I could not get them to work until I did this.

Hope this help!
LOL!
Austin is offline
za_bullet
Junior Member
Join Date: Nov 2005
Old 11-28-2005 , 06:35  
Reply With Quote #4

WOW! Thanks for the reply......great post. It’s helpful, but not entirely.....I really want to randomly spawn weapons on a round to round basis. From your post, this leaves one option (if entities can't be created programmatically)

Add the entities in the bsp file and then move them randomly on each round. .....which leads to my next question (which I'll cross post).....is it possible to move entities during the game? If so, HOW?

D.
za_bullet is offline
Send a message via AIM to za_bullet
Austin
Senior Member
Join Date: Oct 2005
Old 11-29-2005 , 14:23  
Reply With Quote #5

Quote:
Originally Posted by za_bullet
WOW! Thanks for the reply......great post. It’s helpful, but not entirely.....I really want to randomly spawn weapons on a round to round basis. From your post, this leaves one option (if entities can't be created programmatically)

Add the entities in the bsp file and then move them randomly on each round. .....which leads to my next question (which I'll cross post).....is it possible to move entities during the game? If so, HOW?

D.
Based on the information in your first post it sounded like you wanted to have guns on the ground. Now that you are more specific on what you want here again is sort for the answer. I say sort of because this is how you would do this for cs1.6. I don't know the hl2 sdk or mms so I can't show you how to do this for hl2/ccs. BUT I would think it has to be doable since it is so easy to do with cs1.6 + Metamod.

Here is code that shows exactly how to spawn any weapon anywhere in the map for cs 1.6



Code:
		// now spawn it so it shows up in the map

				edict_t	*pent = NULL;

				if (FNullEnt(pent = GameCreateEntity("armoury_entity")))
				{
					UTIL_printf ("ERROR: error creating entity.");
					return 1;
				}

				nullname[0] = 0;

				GameKeyValue(pent, nullname, "classname", "armoury_entity");

				GameKeyValue(pent, "armoury_entity", "count", "2");
				GameKeyValue(pent, "armoury_entity", "item", item);
				GameKeyValue(pent, "armoury_entity", "angle", "0");

				sprintf(newEntityOrigin, "%0.0f %0.0f %0.0f", origin.x, origin.y, origin.z);
				GameKeyValue(pent, "armoury_entity", "origin", newEntityOrigin);

				gpGamedllFuncs->dllapi_table->pfnSpawn( pent );

				return 0;

Search google for something called "Stripper2"
This was a utility written by botman that lets you strip items out of maps, add items to maps and i think also randomly spawn items. It reads a map specific config files and does everything at run time so it doesn't modify the bsp files. The last version i looked at was for cs1.5 and I think it had some serious problems with 1.6 and definitely would not work for hl2.

I don't know if anyone has ported it but it would be a great one to have for hl2...
Austin is offline
za_bullet
Junior Member
Join Date: Nov 2005
Old 12-02-2005 , 06:59  
Reply With Quote #6

CreateGameEntity doesn't appear to be part of the Source SDK. However I've tested that you can insert entities on your map and then use the Teleport method on the Entity to move it to where you want it. This allows you to move them when ever you want.....to a random point.

D.
za_bullet is offline
Send a message via AIM to za_bullet
Austin
Senior Member
Join Date: Oct 2005
Old 12-02-2005 , 15:30  
Reply With Quote #7

Quote:
Originally Posted by za_bullet
CreateGameEntity doesn't appear to be part of the Source SDK. However I've tested that you can insert entities on your map and then use the Teleport method on the Entity to move it to where you want it. This allows you to move them when ever you want.....to a random point.
D.
By insert you mean modifying the bsp?

Can you post the code you use to do the teleport?
Austin is offline
za_bullet
Junior Member
Join Date: Nov 2005
Old 12-05-2005 , 04:46  
Reply With Quote #8

Sure I haven't fully tested it....but I did some simple teleportation of entities. So I'll write some pseudo-code for it.

My basic idea for random placement is as follows.

1. Add a cache of weapons somewhere on the map by modifying the map file (outside the reach of players) in a known location (this makes it easy to locate them when iterating through the entities).
2. On rounds start.....go through the list of entities and find the weapons you have "planted"
3. Teleport them to "random" locations......obivously you'll need to maintain a list of suitable locations per map......you could make it completely random...but you'll probably end up putting them in walls and stuff.

Here is the "code" for teleportation (which I have tested)

Code:
//Remember this is just pseudo-code there isn't a method call FindEntityToMove
edict_t * et = FindEntityToMove();

//Set up new vector to place it at
Vector newLocation;
newLocation.x = newX;
newLocation.y = newY;
newLocation.z = newZ;

//TELEPORT!

et->GetUnknown()->GetBaseEntity()->Teleport(&newLocation,NULL,NULL);

//HOPE AND PRAY ;)
Hope this helps.

D.
za_bullet is offline
Send a message via AIM to za_bullet
putnani
Member
Join Date: Mar 2005
Old 01-17-2006 , 00:03  
Reply With Quote #9

HL2 / Source mapping
----------------------------
Someone wrote a tool that lets you modify HL2 map entities.



Austin the link is dead can u upload the tool ?

I did dl it before now i have lost it =(

btw nice tool
putnani is offline
ichthys
Veteran Member
Join Date: Dec 2004
Location: []*[]
Old 01-17-2006 , 00:44  
Reply With Quote #10

Stripper: Source written by Bailopan
Quote:
This is a port of Botman's Stripper2 utility for Half-Life 1. You can add any type of entity - hostage, spawn point, physics prop, permanently to the map. You can also filter out entities for deletion, either by specific entries or regular expressions.

Stripper:Source lets you define global rules and per-map rules. It also lets other plugins (both SourceMM plugins and Server Plugins) use its API.
__________________
ichthys is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:53.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode