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

Getting owner of rpg rocket entity?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 10-07-2007 , 16:21   Getting owner of rpg rocket entity?
Reply With Quote #1

Would it be possible to get the owner of an RPG Rocket entity with SourceMod yet? If it is, how would I go about doing it?

I'm starting the transfer from AMXX to SM now and could use some help
hlstriker is offline
BAILOPAN
Join Date: Jan 2004
Old 10-07-2007 , 20:30   Re: Getting owner of rpg rocket entity?
Reply With Quote #2

It's possible if you know the index of the rocket entity in question.
__________________
egg
BAILOPAN is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 10-07-2007 , 22:35   Re: Getting owner of rpg rocket entity?
Reply With Quote #3

I don't have that yet. Was hoping maybe someone could let me know that too

The way I found a RPG rocket index with AMXX was using FM_SetModel. I tried searching around for a forward like that but found nothing

I'm clueless on how to do this, unless there is something like "find_ent_by_class" for SourceMod that I could search for?

I learn best by seeing others code and picking through it to see what it all does. I've already looked at quite a few plugins but none came close to doing this stuff.
hlstriker is offline
Nican
Veteran Member
Join Date: Jan 2006
Location: NY
Old 10-07-2007 , 22:50   Re: Getting owner of rpg rocket entity?
Reply With Quote #4

There is the function FindEntityByClassname, but I am not sure what would you look for...

This functions might be also useful for you:
http://sm.nican132.com/index.php?fastload=show&id=43&

EDIT:
I found this within weapon_rpg.cpp, it might be of your interest
Code:
void CMissile::Precache( void )
{
	PrecacheModel( "models/weapons/w_missile.mdl" );
	PrecacheModel( "models/weapons/w_missile_launch.mdl" );
	PrecacheModel( "models/weapons/w_missile_closed.mdl" );
}
Code:
CMissile *CMissile::Create( const Vector &vecOrigin, const QAngle &vecAngles, edict_t *pentOwner = NULL )
{
	//CMissile *pMissile = (CMissile *)CreateEntityByName("rpg_missile" );
	CMissile *pMissile = (CMissile *) CBaseEntity::Create( "rpg_missile", vecOrigin, vecAngles, CBaseEntity::Instance( pentOwner ) );
	pMissile->SetOwnerEntity( Instance( pentOwner ) );
	pMissile->Spawn();
	pMissile->AddEffects( EF_NOSHADOW );
	
	Vector vecForward;
	AngleVectors( vecAngles, &vecForward );

	pMissile->SetAbsVelocity( vecForward * 300 + Vector( 0,0, 128 ) );

	return pMissile;
}
Code:
DEFINE_FIELD( m_hOwner,					FIELD_EHANDLE ),
__________________
http://www.nican132.com
I require reputation!

Last edited by Nican; 10-07-2007 at 23:00.
Nican is offline
Send a message via ICQ to Nican Send a message via MSN to Nican
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 10-07-2007 , 23:33   Re: Getting owner of rpg rocket entity?
Reply With Quote #5

Thanks Nican, this should help a lot when I get a few other things figured out first.

I'm working with the mod Fortress-Forever and it controls the map entities with code written in a lua file. You can do all sorts of stuff with these files but it's all map specific. There are a list of 'call backs' the mod uses and was wondering if there is a way to call these with sourcemod. Here is a link to some of them...

http://fortress-forever.com/forum/sh...ad.php?t=11881

Also, I'm still wondering how to get the owner

I have a feeling the way I'm going to have to find the entity is in OnGameFrame() which I hoped to avoid.

EDIT:
I take using OnGameFrame() back. There has to be another method because calling FindEntityByClassname() will be to extreme there.

Last edited by hlstriker; 10-07-2007 at 23:35.
hlstriker is offline
Nican
Veteran Member
Join Date: Jan 2006
Location: NY
Old 10-08-2007 , 01:57   Re: Getting owner of rpg rocket entity?
Reply With Quote #6

Try hooking something releated to "+attack," (I think if directly hook +attack won't work) and on every "+attack," seek for the missile 0.2 sec later

I would love a bright between LUA and SM too... I hate lua and VB, they changed everything from the original computer langush

EDIT:
Does anyone know where I can find a TF:Forever offset props list? From there I can show you where to get the owner
__________________
http://www.nican132.com
I require reputation!

Last edited by Nican; 10-08-2007 at 02:08.
Nican is offline
Send a message via ICQ to Nican Send a message via MSN to Nican
BAILOPAN
Join Date: Jan 2004
Old 10-08-2007 , 07:24   Re: Getting owner of rpg rocket entity?
Reply With Quote #7

Owner is usually in an entity handle property named m_hOwner.

Getting the rocket entity sounds tricky, you will need to find an event or function where it's been created.
__________________
egg
BAILOPAN is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 10-08-2007 , 12:23   Re: Getting owner of rpg rocket entity?
Reply With Quote #8

Good news, hooking +attack worked!

Now I guess I'll just use that for now with a timer calling a function searching for the rocket (which I'm hoping it's classname is rpg_missile).

Thanks for the help BAIL and Nican

EDIT:
Gah! Got an error I don't want to see...
"FindEntityByClassname" not supported by this mod

Is there a way I can add this myself to the mod?

Last edited by hlstriker; 10-08-2007 at 12:48.
hlstriker 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 16:44.


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