AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Get weapon bullet start origin where that Muzzleflash sprite appear (https://forums.alliedmods.net/showthread.php?t=240670)

.Dare Devil. 05-19-2014 20:10

Get weapon bullet start origin where that Muzzleflash sprite appear
 
Hello everyone!

As the tittle says ... i want to create some new shooting effects but in order to do that i need to know
how to do that what tittle says :)

Well here is image:
http://www.upload.ee/image/4062987/asd.png

Part of me remembers that it was somehow possible yet i cant remember how and i dont know how to search it because i dont know what is the name of that thing i want.

Thanks!

DavidJr 05-20-2014 19:55

Re: Get weapon bullet start origin where that Muzzleflash sprite appear
 
I use this for tracer:

PHP Code:

public fwd_TraceAttack_Post(iVictimiAttackerFloat:flDamageFloat:fDir[3], ptriDamageType)
{
    new 
iWeapon get_user_weapon(iAttacker);
    
    if (
iWeapon == CSW_KNIFE) return;

    new 
Float:flOrigin[3], Float:flEnd[3];

    
GetWeaponAttachment(iAttackerflOrigin);
    
get_tr2(ptrTR_vecEndPosflEnd);
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_TRACER);
    
write_coord(floatround(flOrigin[0]));
    
write_coord(floatround(flOrigin[1]));
    
write_coord(floatround(flOrigin[2]));
    
write_coord_f(flEnd[0]);
    
write_coord_f(flEnd[1]);
    
write_coord_f(flEnd[2]);
    
message_end();
}

GetWeaponAttachment(iIndexFloat:flOutput[3], Float:fDist 40.0)

    new 
Float:flEnd[3], iEnd[3];
    
get_user_origin(iIndexiEnd3);
    
IVecFVec(iEndflEnd);
    
    new 
Float:flOrigin[3];
    
pev(iIndexpev_originflOrigin);
    
    new 
Float:flAngles[3];
    
pev(iIndexpev_view_ofsflAngles);
    
    
xs_vec_add(flOriginflAnglesflOrigin
    
    new 
Float:flAttack[3];
    
xs_vec_sub(flEndflOriginflAttack);
    
xs_vec_sub(flEndflOriginflAttack);
    
    new 
Float:flRate fDist vector_length(flAttack);
    
    
xs_vec_mul_scalar(flAttackflRateflAttack);
    
xs_vec_add(flOriginflAttackflOutput);


By the way, is it CS 1.6? How do you show the location under radar?

.Dare Devil. 05-20-2014 23:32

Re: Get weapon bullet start origin where that Muzzleflash sprite appear
 
that code wont work for the model in image.
Also it is not cs1.6, it is css :)

DavidJr 05-21-2014 00:32

Re: Get weapon bullet start origin where that Muzzleflash sprite appear
 
Quote:

Originally Posted by .Dare Devil. (Post 2140554)
that code wont work for the model in image.

Muzzleflash starts to show from the attachment, I just showed it to you.

Quote:

Originally Posted by .Dare Devil. (Post 2140554)
Also it is not cs1.6, it is css :)

Okay, I believe you. :D :D :D :D


meTaLiCroSS 05-21-2014 02:51

Re: Get weapon bullet start origin where that Muzzleflash sprite appear
 
That's something that can be half-done. To get the exact position of it's attachments, it is not possible that easy. You can get an entity's attachment with engfunc(EngFunc_GetAttachment, ...) providing the right params.

There's something that you can try, but it is just an idea, because there are some math calculations involucrated.

You can create a entity on precache, set it's model and angles to 0.0-0.0-0.0, set it's model to the weapon's v_ model (yeah, v_ model) and use the function related to get it's attachments. Then, you will have the origin of the attachment and the angle to the attachment starting from the middle of the model.

Don't know if this math guess will work, but "try" to use angle_vector(...) with the angle gotten, and scale the vector result by the len of the origin gotten. Add the scaled vector to your eye position, and try an effect to see if that was accurate.

NiHiLaNTh 05-21-2014 03:45

Re: Get weapon bullet start origin where that Muzzleflash sprite appear
 
try searching on russian forums. Somebody has posted something similar years ago

.Dare Devil. 05-21-2014 10:17

Re: Get weapon bullet start origin where that Muzzleflash sprite appear
 
It is not hard to get the origin where muzzleflash appear, the problem is where it gonna appear.
This weapon have 2 muzzleflash origin and detecting which one will appear when i shoot is hard.
I guess this is impossible and i should trash my idea.

DavidJr 05-21-2014 10:23

Re: Get weapon bullet start origin where that Muzzleflash sprite appear
 
I guess it depends on the CSW_*

meTaLiCroSS 05-21-2014 16:41

Re: Get weapon bullet start origin where that Muzzleflash sprite appear
 
It's a model handled by the client, and anyway, you can try to guess a point by doing some random tests, but having the exact attachment position seems to be not possible.

I'm going to test what I said and going to tell you what happens.

WildCard65 05-21-2014 17:23

Re: Get weapon bullet start origin where that Muzzleflash sprite appear
 
Quote:

Originally Posted by .Dare Devil. (Post 2140554)
that code wont work for the model in image.
Also it is not cs1.6, it is css :)

you want it for css or for cs 1.6?


All times are GMT -4. The time now is 09:38.

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