Raised This Month: $ Target: $400
 0% 

Can fake player entities be given weapons?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mugwump
Senior Member
Join Date: May 2004
Old 06-24-2004 , 13:38   Can fake player entities be given weapons?
Reply With Quote #1

I tried to give_item() a weapon to the fake player entity I created and it ended up causing odd results: the entity fell through the floor slowly and never did have the weapon, or at least it wasn't wielded.

Anyone know of sma source I could look at to accomplish this (assuming its possible) or if not does anyone have any suggestions?

Also, if give_item() doesn't cause an entity to wield the weapon, what would be the followup command to do that?

Thanks for any assistance!

Mugwump
Mugwump is offline
BAILOPAN
Join Date: Jan 2004
Old 06-24-2004 , 13:53  
Reply With Quote #2

give_item is a weird command that actually is kind of hackish.

It creates an entity, then forces it to touch the target. If it still exists after touching, it's deleted. So the only reason you "see" an entity is that it's a temporary marker.

If your entity is not a player that registers touching like that, nothing will happen. After all, only valid players can use weapons.
__________________
egg
BAILOPAN is offline
Ryan
Senior Member
Join Date: May 2004
Location: NH, USA
Old 06-24-2004 , 18:32  
Reply With Quote #3

If i'm not mistaken, you can get/set what weapon a player model (even if it's fake) is holding using.

Code:
// Get weapon model held new szWeaponModel[64]; Entvars_Get_String( iEnt, EV_SZ_weaponmodel, szWeaponModel, 63 ); // Set weapon model held Entvars_Set_String( iEnt, EV_SZ_weaponmodel, "someweaponname" );

I believe it goes by p_weaponname.mdl but i'm not sure. I am almost postive that you can achieve this, if not with EV_SZ_weaponmodel, then one of the other string entity variables.
__________________
Warcraft 3: Expansion
Homepage | Downloads | Forums
Ryan is offline
Send a message via AIM to Ryan
Mugwump
Senior Member
Join Date: May 2004
Old 06-24-2004 , 21:19  
Reply With Quote #4

Hmm, so there is no way for a fake player entity to wield a weapon? If so that doesn't explain how bots can wield weapons unless they are actually interfaced to be _real_ players as far as the server understands ... In any event this is disappointing .

Mugwump
Mugwump is offline
BAILOPAN
Join Date: Jan 2004
Old 06-24-2004 , 22:07  
Reply With Quote #5

1] Bots ARE real players...

2] Ryan just gave you code to strap weapon models on, does it work?
__________________
egg
BAILOPAN is offline
Mugwump
Senior Member
Join Date: May 2004
Old 06-24-2004 , 22:25  
Reply With Quote #6

Sorry, when I posted earlier I hadnt seen your post Ryan, will be checking into it and will post.

Thanks
Mugwump
Mugwump is offline
Mugwump
Senior Member
Join Date: May 2004
Old 06-24-2004 , 22:52  
Reply With Quote #7

I was not able to get the weaponmodel string to work. I tried the following to copy my weaponmodel to the entity:

Code:
   new szWeaponModel[64];
   Entvars_Get_String( id, EV_SZ_weaponmodel, szWeaponModel, 63 );
   Entvars_Set_String( dEnt, EV_SZ_weaponmodel, szWeaponModel );
The model spawns with no weapon, in his idle sequence. I also added an additional _Get_String call to verify that the model actually had the right weapon name set, it did.

I then tried:

Code:
   entity_set_string(dEnt, EV_SZ_weaponmodel,"models/p_knife.mdl")
and I added that model name to the plugin_precache() list of precached models, no change. I realize the above is simply an alias for the older format but wanted to rule that out just in case.

If that setting has any effect I don't see it.

Mugwump
Mugwump is offline
Neo-Vortex
Senior Member
Join Date: Jun 2004
Location: Australia
Old 06-25-2004 , 03:45   hmmm
Reply With Quote #8

speaking of which, that gave me an idea, is it possible to give hostages a gun? (like they just hold it to look pretty, they dont shoot nor drop it when dead )

if it is possible, would it be done the same way as mentioned above (if it works) or some other way, and if it is possible by the way mentioned above, how do you get the id or whatever of the hostages (Im guessing theres one for each)
Neo-Vortex is offline
Ryan
Senior Member
Join Date: May 2004
Location: NH, USA
Old 06-25-2004 , 03:48  
Reply With Quote #9

i dont think so. I think the player models are coded with properties to accept the weapon attachments, whereas the hostage models are probably not.
__________________
Warcraft 3: Expansion
Homepage | Downloads | Forums
Ryan is offline
Send a message via AIM to Ryan
Neo-Vortex
Senior Member
Join Date: Jun 2004
Location: Australia
Old 06-25-2004 , 03:56   hmmm
Reply With Quote #10

hmmm, ill check if they can hold a gun or not...
Neo-Vortex 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 14:53.


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