Raised This Month: $ Target: $400
 0% 

help with reorienting a rocket (Team Fortress Classic)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
wirehead1
Junior Member
Join Date: May 2021
Old 12-06-2021 , 18:19   help with reorienting a rocket (Team Fortress Classic)
Reply With Quote #1

Hello, okay so in TFC you have a rocket launcher that serves as the aim origin for the rocket, but this is off-center. It kind of diagonally aims the rocket into your crosshair's destination.

I wish to capture a rocket launch event, get the rocket, and re-fire it dead center of the player's aim. I want quake 3 style rockets basically.

Some code snippets to jog the memory:

Quote:
public PlayerPreThink(id)
{
// Apply this to all living human players

if( is_user_alive(id) && !is_user_bot(id) )
{
// See if a player is attacking

static button;
button = pev(id, pev_button);
if ((RocketDelay[id] == 0) && (button & IN_ATTACK) && (LaglessRocketsEnabled[id] == 1))
{
// If he is, see if he's carrying a rocket launcher

new wpnent1 = find_ent_by_owner(-1, "tf_weapon_rpg", id);
if (wpnent1 > 0)// && (LaglessRocketsEnabled[id] == 1))
{
// If he is, find entities within 50 units of the weapon origin

new Float:wpnorig[3];
pev(wpnent1, pev_origin, wpnorig)
new tent = 0;
while((tent = engfunc(EngFunc_FindEntityInSphere, tent, wpnorig, 50.0)))
{
// Check the found entities for RPG rockets

new sztargetname[31];
pev(tent, pev_classname, sztargetname, 31);
if (equal(sztargetname, tf_rpg_rocket))
{
// Determine that a found rocket was fired by the player

new rocketowner = pev(tent, pev_owner);
if (id == rocketowner)
{ //do stuff with rocket here...}}}}}}}

Last edited by wirehead1; 12-06-2021 at 18:20.
wirehead1 is offline
 



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 11:37.


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