Raised This Month: $32 Target: $400
 8% 

[Help] Spawning Rocket (TF2)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Inhib
Member
Join Date: Oct 2014
Old 12-18-2014 , 02:35   [Help] Spawning Rocket (TF2)
Reply With Quote #1

I want to spawn a rocket to fly in a direction and explode on contact, dealing damage.
already have location and velocity for the entity.
My code at this point does not spawn any entity:
PHP Code:
            new rockets=CreateEntityByName("prop_physics_multiplayer");
            
SetEntityModel(rockets"models/weapons/w_models/w_rocket.mdl");
            
DispatchSpawn(rockets);
            
TeleportEntity(rocketsrocketposNULL_VECTORNULL_VECTOR); 
Inhib is offline
turtsmcgurts
SourceMod Donor
Join Date: Jul 2011
Old 12-18-2014 , 05:25   Re: [Help] Spawning Rocket (TF2)
Reply With Quote #2

PHP Code:
SpawnRocket() 

    
rocket_entity CreateEntityByName(rocket_entity_name); //"tf_projectile_rocket"  
     
    //1100 is the velocity of a normal rocket
    //1980 is the velocity of a direct hit rocket
    
TeleportEntity(rocket_entityoriginanglesvelocity); //sets the position, angle and velocity of the rocket so it flies to where you want. 
     
    
SetEntPropEnt(rocket_entityProp_Send"m_hOwnerEntity"client); //sets the owner of the rocket 
    
SetEntData(rocket_entityFindSendPropInfo(rocket_class_name"m_iTeamNum"), teamtrue); //sets the team value of the rocket 
    
SetEntDataFloat(rocket_entityFindSendPropInfo(rocket_class_name"m_iDeflected") + 4100.0true); //not sure why, but this is required in order for it to do damage. 
    
SetEntData(rocket_entityFindSendPropInfo(rocket_class_name"m_bCritical"), 11true); //set it to be critical 
     
    
DispatchSpawn(rocket_entity); //spawns the rocket 

I posted this in a previous thread of yours. I'm on my laptop without access to my plugins to check, but i'm sure this would work.
turtsmcgurts is offline
Inhib
Member
Join Date: Oct 2014
Old 12-18-2014 , 08:05   Re: [Help] Spawning Rocket (TF2)
Reply With Quote #3

returned this on compile:

/groups/sourcemod/upload_tmp/text1YVjOK.sp(160) : error 017: undefined symbol "tf_projectile_rocket"
/groups/sourcemod/upload_tmp/text1YVjOK.sp(162) : error 017: undefined symbol "tf_projectile_rocket"
/groups/sourcemod/upload_tmp/text1YVjOK.sp(163) : error 017: undefined symbol "tf_projectile_rocket"
/groups/sourcemod/upload_tmp/text1YVjOK.sp(164) : error 017: undefined symbol "tf_projectile_rocket"

PHP Code:
            new rocket_entity CreateEntityByName(tf_projectile_rocket);            <---160
            SetEntPropEnt
(rocket_entityProp_Send"m_hOwnerEntity"client);
            
SetEntData(rocket_entityFindSendPropInfo(tf_projectile_rocket"m_iTeamNum"), teamtrue);            <---162
            SetEntDataFloat
(rocket_entityFindSendPropInfo(tf_projectile_rocket"m_iDeflected") + 4100.0true);            <---163
            SetEntData
(rocket_entityFindSendPropInfo(tf_projectile_rocket"m_bCritical"), 11true);            <---164 

Last edited by Inhib; 12-18-2014 at 08:07.
Inhib is offline
Wliu
Veteran Member
Join Date: Apr 2013
Old 12-18-2014 , 08:57   Re: [Help] Spawning Rocket (TF2)
Reply With Quote #4

"tf_projectile_rocket", not tf_projectile_rocket
__________________
~Wliu
Wliu is offline
Inhib
Member
Join Date: Oct 2014
Old 12-18-2014 , 09:10   Re: [Help] Spawning Rocket (TF2)
Reply With Quote #5

PHP Code:
            new rocket_entity CreateEntityByName("tf_projectile_rocket");
            
SetEntPropEnt(rocket_entityProp_Send"m_hOwnerEntity"client);
            
//SetEntData(rocket_entity, FindSendPropInfo("tf_projectile_rocket", "m_iTeamNum"), 2, true);
            
SetEntDataFloat(rocket_entityFindSendPropInfo("tf_projectile_rocket""m_iDeflected") + 4100.0true);
            
SetEntData(rocket_entityFindSendPropInfo("tf_projectile_rocket""m_bCritical"), 11true);
            
DispatchSpawn(rocket_entity);
            
TeleportEntity(rocket_entityrocketposvectorfloatNULL_VECTOR); 
Crashed srcds
PHP Code:
            new rocket_entity CreateEntityByName("tf_projectile_rocket");
            
SetEntPropEnt(rocket_entityProp_Send"m_hOwnerEntity"client);
            
SetEntData(rocket_entityFindSendPropInfo("tf_projectile_rocket""m_iTeamNum"), 2true);
            
SetEntDataFloat(rocket_entityFindSendPropInfo("tf_projectile_rocket""m_iDeflected") + 4100.0true);
            
SetEntData(rocket_entityFindSendPropInfo("tf_projectile_rocket""m_bCritical"), 11true);
            
DispatchSpawn(rocket_entity);
            
TeleportEntity(rocket_entityrocketposvectorfloatNULL_VECTOR); 
returns SetEntData reported "Offset -1" is invalid

Last edited by Inhib; 12-18-2014 at 09:39.
Inhib is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 12-18-2014 , 11:53   Re: [Help] Spawning Rocket (TF2)
Reply With Quote #6

just do:
Code:
SetEntProp(rocket_entity, Prop_Send, "m_iTeamNum", 2);
//etc.
Mitchell is offline
Inhib
Member
Join Date: Oct 2014
Old 12-20-2014 , 00:18   Re: [Help] Spawning Rocket (TF2)
Reply With Quote #7

Quote:
Originally Posted by Mitchell View Post
just do:
Code:
SetEntProp(rocket_entity, Prop_Send, "m_iTeamNum", 2);
//etc.
Same error for the same line
Inhib is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 12-20-2014 , 16:27   Re: [Help] Spawning Rocket (TF2)
Reply With Quote #8

"tf_projectile_rocket" isn't the name of the netclass classname. You'll want to use "CTFProjectile_Rocket" instead.

Last edited by bl4nk; 12-20-2014 at 16:28.
bl4nk is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 12-20-2014 , 17:20   Re: [Help] Spawning Rocket (TF2)
Reply With Quote #9

Quote:
Originally Posted by Inhib View Post
Same error for the same line
SetEntProp(rocket_entity, Prop_Data, "m_iTeamNum", 2);
__________________
Chdata is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 12-21-2014 , 11:34   Re: [Help] Spawning Rocket (TF2)
Reply With Quote #10

Quote:
Originally Posted by bl4nk View Post
"tf_projectile_rocket" isn't the name of the netclass classname. You'll want to use "CTFProjectile_Rocket" instead.
Last I checked, CreateEntityByName has never used the CTF* names.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Reply


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 22:28.


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