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

how to link some func args to register_touch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ehha
SourceMod Donor
Join Date: Apr 2006
Location: Sibiu
Old 04-06-2010 , 16:21   how to link some func args to register_touch
Reply With Quote #1

So, I've modified death coil function from WC3 mod to suit my needs & I need one more thing: the thing in the title

This is the function's header:
PHP Code:
public dota_projectilecastertargetspeedszModel[64], redgreenblue 
I want to change it into this:
PHP Code:
public dota_projectilecastertargetspeeddamagestunszModel[64], redgreenblue 
Since I want to do the stun & damage at impact I've registered a touch:
PHP Code:
register_touch"DOTA_PROJ",   "player""DOTA_PROJ_touch" ); 
How can I link damage & stun to the touch? Assuming that there are more than one call of the function.

I thought of two arrays of 32 cells each ( one for every player ) but it seems kinda rudimentary.
Since dota_projectile creates a different entity for each function call, can I find out which function created the entity that touched a player & use some its arguments?
__________________
ehha is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 04-06-2010 , 17:09   Re: how to link some func args to register_touch
Reply With Quote #2

Use pev fields on the entity to save the information you want. You'll probably want to use pev_iuser1, ..., pev_iuser4

In the touch function, retrieve the corresponding information from the entity.

Pseudocode:
Code:
// in entity create
set entity pev_iuser1 to caster
set entity pev_iuser2 to damage
set entity pev_iuser3 to stun

// in entity touch
caster = entity pev_iuser1
damage = entity pev_iuser2
stun = entity pev_iuser3

Last edited by Emp`; 04-06-2010 at 17:11.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
ehha
SourceMod Donor
Join Date: Apr 2006
Location: Sibiu
Old 04-07-2010 , 07:33   Re: how to link some func args to register_touch
Reply With Quote #3

Great stuff, thank you Emp`.

Can I store floats in pev_iuser1-4 constants & are they the only unused constants in which I can store data?
__________________

Last edited by ehha; 04-07-2010 at 08:05.
ehha is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-07-2010 , 07:56   Re: how to link some func args to register_touch
Reply With Quote #4

For float, just use... pev_fuser*
__________________
Arkshine is offline
Old 04-07-2010, 08:29
Seta00
This message has been deleted by Seta00. Reason: nvm
ehha
SourceMod Donor
Join Date: Apr 2006
Location: Sibiu
Old 09-29-2010 , 15:49   Re: how to link some func args to register_touch
Reply With Quote #5

PHP Code:
new Float:stun1 peventpev_fuser1 );
new 
Float:stun2 entity_get_floatentEV_FL_fuser1 ); 
Any idea why the 1st gives a tag mismatch?
__________________
ehha is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-29-2010 , 16:01   Re: how to link some func args to register_touch
Reply With Quote #6

float are passed by reference in pev() :

new Float:stun1;
pev( ent, pev_fuser1, stun1 );
__________________

Last edited by Arkshine; 09-29-2010 at 16:05.
Arkshine is offline
ehha
SourceMod Donor
Join Date: Apr 2006
Location: Sibiu
Old 09-29-2010 , 16:07   Re: how to link some func args to register_touch
Reply With Quote #7

Sadly, I've read that and tried this:
pev(ent, pev_fuser1, &stun1);
which failed. But now I understand why, & goes into the function header.

Thanks.
__________________
ehha is offline
lazarev
Veteran Member
Join Date: Sep 2008
Old 09-30-2010 , 05:44   Re: how to link some func args to register_touch
Reply With Quote #8

leave DotA alone, lol.
lazarev is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 10-01-2010 , 05:16   Re: how to link some func args to register_touch
Reply With Quote #9

DotA is actually left alone, CS is the one who's infected with all kind of stuff from other games
__________________
Hunter-Digital 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 19:08.


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