Raised This Month: $ Target: $400
 0% 

Finding Weapon Entities


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Votorx
Senior Member
Join Date: Jun 2004
Old 03-03-2005 , 11:50   Finding Weapon Entities
Reply With Quote #1

How can I find weapon entities that are on the floor? For instance, I'm trying to find out if the client is close enough to a m4a1 (classname "weapon_m4a1", I think) to do something. Its not working and I don't know why. Maybe I have the wrong classname, what IS the right classname for a dropped m4a1 (or any other weapon) or an easier way to find a dropped weapon without find_ent_in_sphere().[/i]
__________________
Currently Looking for a mod team.
Votorx is offline
Send a message via AIM to Votorx Send a message via MSN to Votorx Send a message via Yahoo to Votorx
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 03-03-2005 , 12:16  
Reply With Quote #2

Classname of any dropped weapon is "weaponbox" I believe. You just have to figure out what the model name is (I would look in the server's basedir in the models directory) then you cna use find_ent_by_class or some such and then figure out if they're close enough.

I think that's right.
__________________
twistedeuphoria is offline
Votorx
Senior Member
Join Date: Jun 2004
Old 03-03-2005 , 21:16  
Reply With Quote #3

Huh...Weapon box...I'll try it out then.
__________________
Currently Looking for a mod team.
Votorx is offline
Send a message via AIM to Votorx Send a message via MSN to Votorx Send a message via Yahoo to Votorx
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 03-03-2005 , 21:46  
Reply With Quote #4

armoury_entity

It would have an index to indicate which weapon it is, but I am not exactly sure how to grab it in amx.. maybe an offset value, but I have never experimented with it... Also, here is the listing for it found in the Expert FGDs for making maps...

Code:
@PointClass iconsprite("sprites/CS/Armoury.spr") size(-16 -16 0, 16 16 16) = armoury_entity : "Items in the armoury" 
[
	item(choices)  : "Item" : 0 = 
	[
		0: "weapon_mp5"
		1: "weapon_tmp"
		2: "weapon_p90"
		3: "weapon_mac10"
		4: "weapon_ak47"
		5: "weapon_sg552"
		6: "weapon_m4a1"
		7: "weapon_aug"
		8: "weapon_scout"
		9: "weapon_g3sg1"
		10: "weapon_awp"
		11: "weapon_m3"
		12: "weapon_xm1014"
		13: "weapon_m249"
		14: "weapon_flashbang"
		15: "weapon_hegrenade"
		16: "item_kevlar"
		17: "item_assaultsuit"
		18: "weapon_smokegrenade"
	]
	count(integer) : "Count" : 1
]
I dont know, maybe that helps?
xeroblood is offline
Send a message via MSN to xeroblood
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 03-03-2005 , 23:13  
Reply With Quote #5

You could just catch it AFTER spawn, when they are weapon_*'s.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 03-04-2005 , 04:50  
Reply With Quote #6

You have to tell *dropped* weapons from weapons that are onground as they are compiled into the map.

Classname "weaponbox" is a dropped weapon.
Classname "armoury_entity" is an onground weapon.

You could loop through the weaponboxes but then you're not always sure which weapon entity it is tied to (I haven't found out a way). Instead you can loop through all weapon_m4a1 for instance, and check its EV_ENT_owner. If it's above get_maxplayers() it will be a weaponbox entity, and thus, a dropped weapon.

For onground, compiled weapons you could just loop through the armoury_entity:s and check their EV_SZ_model. There is no weapon entity ever tied to an armoury_entity.

To check if you are near the m4a1 then just compare the origin of the weaponbox.
Johnny got his gun is offline
Votorx
Senior Member
Join Date: Jun 2004
Old 03-04-2005 , 11:56  
Reply With Quote #7

Does the weaponbox have the same key values as armoury_entity?
And, when looking at an fgd file, how can I tell which are the values and which are the actual keys?

Like here
Code:
item(choices)  : "Item" : 0 =
item (not "Item") is the key? and (choices) (whichever weapon_*) is the key value? So If I were to create an entity with the classname "armoury_entity) and gave the key "item" the value "weapon_m4a1" then this would create that weapon on the floor or whatever origin I give it after DispatchSpawn() right?
__________________
Currently Looking for a mod team.
Votorx is offline
Send a message via AIM to Votorx Send a message via MSN to Votorx Send a message via Yahoo to Votorx
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 09:30.


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