AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Replacing RPG Trail. (https://forums.alliedmods.net/showthread.php?t=54642)

Drak 04-30-2007 15:34

Replacing RPG Trail.
 
Is there anyway to remove/change the trail on a RPG rocket?
(Color,size, etc etc)

XxAvalanchexX 04-30-2007 22:33

Re: Replacing RPG Trail.
 
One "think" after an RPG spawns, it executes this:

Code:
    // rocket trail     MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );         WRITE_BYTE( TE_BEAMFOLLOW );         WRITE_SHORT(entindex());    // entity         WRITE_SHORT(m_iTrail ); // model         WRITE_BYTE( 40 ); // life         WRITE_BYTE( 5 );  // width         WRITE_BYTE( 224 );   // r, g, b         WRITE_BYTE( 224 );   // r, g, b         WRITE_BYTE( 255 );   // r, g, b         WRITE_BYTE( 255 )// brightness     MESSAGE_END();  // move PHS/PVS data sending into here (SEND_ALL, SEND_PVS, SEND_PHS)

So just send your own TE_BEAMFOLLOW after that.

Drak 04-30-2007 22:52

Re: Replacing RPG Trail.
 
But, wouldn't I need to hook the model/entity somehow? To even know the the RPG has been fired?

XxAvalanchexX 05-01-2007 14:59

Re: Replacing RPG Trail.
 
You only need to know that the rocket has been fired if you want to change the trail right after it's been fired. So, if that's the case, I'd hook either setmodel or think (and only set the trail on the first think, none after).

Drak 05-01-2007 15:28

Re: Replacing RPG Trail.
 
I would assume you're saying that if I send my own trail message on the first think, it will override the original?

Code:
public EntityThink(ent) {     new classname[64]     pev(ent,pev_classname,classname,63)         if(equali(classname,"rpg_rocket")) {         message_begin(MSG_BROADCAST,SVC_TEMPENTITY);         write_byte(TE_BEAMFOLLOW)         write_short(ent)         write_short(m_iTrail)         write_byte(40)         write_byte(10)                 write_byte(random_num(50,255))         write_byte(random_num(50,255))         write_byte(random_num(50,255))                 write_byte(255)         message_end()     } }
I'm hooking it threw it's think, obviously. But how can I catch when it's "first think" is called?
(So I can completely hide the original trail, because mine just combines with it and makes it look all werid)

XxAvalanchexX 05-02-2007 00:17

Re: Replacing RPG Trail.
 
I'd use some sort of flag.

Code:
if(equali(classname,"rpg_rocket")) {     if(pev(ent,pev_iuser1)) return FMRES_IGNORED;     set_pev(ent,pev_iuser1,1);     // ... }

pev_iuser1 should be 0 by default. So it passes by the if statement unharmed the first time think is called, sets the value to 1 so that it knows not to do this again next time, and then executes your code.

As for not getting the beams to coincide, you might have to kill the old beam first:

Code:
message_begin(MSG_BROADCAST,SVC_TEMPENTITY); write_byte(TE_KILLBEAM); // Kill all beams attached to entity write_short(ent); message_end();

Drak 05-02-2007 13:04

Re: Replacing RPG Trail.
 
Thanks, Avalanche. Worked fine. : D

urban_ninja 02-11-2012 09:39

Re: Replacing RPG Trail.
 
I've tried this method with with team fortress classic's pipe bombs but new trail only took effect on alt fire if return PLUGIN_HANDLE is added to the bottom of the code as well as breaking pipe det which is supposed to be the alt fire. This method does nothing at all on pipe launch regardless of value returned.


All times are GMT -4. The time now is 06:43.

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