Raised This Month: $ Target: $400
 0% 

Aim vectors, detect impact, explosions


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
moosewanted
Member
Join Date: May 2009
Old 05-30-2009 , 08:12   Aim vectors, detect impact, explosions
Reply With Quote #1

Hey,
I havn't really searched much on these matters as I normally would but I thought I may aswell.

Im basically creating a new weapon and asking for ideas on firing a rocket.

First I would create the rocket entity.

* What sort of movetype, TOSS?
* Should it be solid?
* The ent size
* Set the model

Then I would set the origin/rotation(so that it lines up with the direction the user is aiming in) - How would I do this?
PHP Code:
set_pev(g_ent_player_model[id], pev_aimentid
Then I would set the velocity- How would I do this?
PHP Code:
velocity_by_aim (idROCKET_SPEEDrocket_velocity
Then I would need to detect the impact origin of the rocket and make it explode - Any ideas on this?

On impact it would explode and cause damage in a radius - Using a sphere
PHP Code:
EngFunc_FindEntityInSphere 
And search for players?

Then the rocket would be deleted.




I understand that I can find most of this out by looking through plugins, but I have limited time and I intend to do it while waiting on this topic.

I appreciate any help.
Thanks

EDIT:Confused, this code works on a local server made by "create game" on the cs menu. But doesn't work when I put it on my server?

PHP Code:
#include <amxmodx>
#include <fakemeta>

#define MODEL_CLASSNAME "apache_rocket"
#define APACHE_ROCKET_MODEL_PATH "models/rpgrocket.mdl"
#define ROCKET_SPEED "800"

new g_rocket[33]

public 
plugin_precache()
{
    
engfunc(EngFunc_PrecacheModelAPACHE_ROCKET_MODEL_PATH)
}

public 
plugin_init()
{
    
register_concmd("fire_rocket","fm_fire_rocket")
}

public 
fm_fire_rocket(id)
{
    
g_rocket[id] = engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"))
    
client_print(0print_chat"Create Named Enitiy")
    if(!
pev_valid(g_rocket[id])) return;

    
set_pev(g_rocket[id], pev_classnameMODEL_CLASSNAME)
    
client_print(0print_chat"Model Classname")
    
set_pev(g_rocket[id], pev_movetypeMOVETYPE_TOSS)
    
client_print(0print_chat"Movetype")
    
set_pev(g_rocket[id], pev_solidSOLID_BBOX)
    
client_print(0print_chat"SOLID BBOX")

    
engfunc(EngFunc_SetSize,g_rocket[id],Float:{-5.0,-5.0,-5.0},Float:{5.0,5.0,5.0})

    
set_pev(g_rocket[id], pev_ownerid)
    
client_print(0print_chat"owner")
    
engfunc(EngFunc_SetModelg_rocket[id], APACHE_ROCKET_MODEL_PATH)
    
client_print(0print_chat"MODEL")

    new 
Float:Origin[3]
    
pev(idpev_originOrigin)
    
Origin[2] = Origin[2] + 32
    engfunc
(EngFunc_SetOrigin,g_rocket[id],Origin)

    new 
Float:rocket_velocity[3]
    
velocity_by_aim (id800rocket_velocity)
    
client_print(0print_chat"VELOCITY")

    
set_pev(g_rocket[id], pev_velocityrocket_velocity)
    
client_print(0print_chat"set velocity")
    
set_task(5.0"remove_rocket"id)
    
client_print(0print_chat"Task")
}

public 
remove_rocket(id)
{
    
remove_task(id)
    
engfunc(EngFunc_RemoveEntityg_rocket[id])
    
client_print(0print_chat"Remove rocket")

Code is experimental.
moosewanted is offline
 


Thread Tools
Display Modes

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 13:51.


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