Raised This Month: $ Target: $400
 0% 

help with reorienting a rocket (Team Fortress Classic)


Post New Thread Reply   
 
Thread Tools Display Modes
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
wirehead1
Junior Member
Join Date: May 2021
Old 12-06-2021 , 20:45   Re: help with reorienting a rocket (Team Fortress Classic)
Reply With Quote #2

In other words, I want to do this:

// get user's view angle
pev( id, pev_v_angle, viewangles );

// get user's origin
pev(id, pev_origin, usrorig);

// move rocket projectile to user's origin
engfunc(EngFunc_SetOrigin, rocket, usrorig);

// change its view angle to players'
set_pev(rocket,pev_angles,viewangles);

// and apply 900 units of speed (vector_length of 900) to it

Here I'm confused.

Last edited by wirehead1; 12-06-2021 at 20:45.
wirehead1 is offline
wirehead1
Junior Member
Join Date: May 2021
Old 12-06-2021 , 21:05   Re: help with reorienting a rocket (Team Fortress Classic)
Reply With Quote #3

Quake 3 has a command "makevectors" that makes a vector with length of 1 from viewangles.

https://quakewiki.org/wiki/makevectors

What is the amxmodx equivalent of this?
wirehead1 is offline
wirehead1
Junior Member
Join Date: May 2021
Old 12-06-2021 , 21:35   Re: help with reorienting a rocket (Team Fortress Classic)
Reply With Quote #4

Ah, I have it.

velocity_by_aim(iIndex, iVelocity, Float:vRetValue[3]);
wirehead1 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-07-2021 , 03:58   Re: help with reorienting a rocket (Team Fortress Classic)
Reply With Quote #5

Quote:
Originally Posted by wirehead1 View Post
Quake 3 has a command "makevectors" that makes a vector with length of 1 from viewangles.

https://quakewiki.org/wiki/makevectors

What is the amxmodx equivalent of this?
https://forums.alliedmods.net/showthread.php?t=262138
__________________
HamletEagle is offline
wirehead1
Junior Member
Join Date: May 2021
Old 12-07-2021 , 15:39   Re: help with reorienting a rocket (Team Fortress Classic)
Reply With Quote #6

@HamletEagle yes that page was pivotal in figuring this out, thanks.

Going to make an update to the lagless rocket plugin in some days.
wirehead1 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 11:37.


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