Raised This Month: $12 Target: $400
 3% 

[Help] Spawning Rocket (TF2)


Post New Thread Reply   
 
Thread Tools Display Modes
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 12-21-2014 , 15:39   Re: [Help] Spawning Rocket (TF2)
Reply With Quote #11

Sorry, should have said that I was talking about inside of FindSendPropInfo().
bl4nk is offline
Inhib
Member
Join Date: Oct 2014
Old 12-28-2014 , 00:54   [Help] Spawning Rocket, Setting Entity Properties(TF2)
Reply With Quote #12

Reply With Quote Multi-Quote This Message #1
I need to spawn a rocket in tf2, I know the client(who fired it), position, angle and velocity.
the code I have so far:
PHP Code:
            new rocket_entity CreateEntityByName("tf_projectile_rocket");
            
DispatchSpawn(rocket_entity);
            
TeleportEntity(rocket_entityrocketposvectorfloatNULL_VECTOR); 
I need to set the ent data and I have no idea how or what to set for the rocket, and thats what I need help with.

Thanks in advance!
Inhib is offline
turtsmcgurts
SourceMod Donor
Join Date: Jul 2011
Old 12-28-2014 , 04:46   Re: [Help] Spawning Rocket, Setting Entity Properties(TF2)
Reply With Quote #13

PHP Code:
new String:rocket_entity_name[32] = "tf_projectile_rocket";
public 
FireRocket (clientFloatattack_direction[3], teamFloatspeed) {    
    new 
Floatorigin[3];
    
GetClientAbsOrigin(clientorigin);
    
origin[2] += 68.0;
    
    
rocket_entity CreateEntityByName(rocket_entity_name);

    if(!
IsValidEntity(rocket_entity)) return -1;

    new 
Float:angles[3];
    
GetVectorAngles(attack_directionangles);
   
    
decl Float:velocity[3];
    
velocity attack_direction;
    
ScaleVector(velocityspeed);
   
    
TeleportEntity(rocket_entityoriginanglesvelocity);
    
    
SetEntPropEnt(rocket_entityProp_Send"m_hOwnerEntity"client);
    
SetEntData(rocket_entityFindSendPropInfo(rocket_class_name"m_iTeamNum"), teamtrue);
    
SetEntDataFloat(rocket_entityFindSendPropInfo(rocket_class_name"m_iDeflected") + 4100.0true); 
    
//SetEntData(rocket_entity, FindSendPropInfo("CTFProjectile_Rocket", "m_bCritical"), 1, 1, true); 
    
    
DispatchSpawn(rocket_entity);
    
   
    return 
rocket_entity;

this is more or less the same code i've posted in your past two threads asking about this. this is fully working, just tested it again myself. because you're spawning it manually you will need to emit the rocket_fired sound.
turtsmcgurts is offline
Inhib
Member
Join Date: Oct 2014
Old 01-01-2015 , 04:05   Re: [Help] Spawning Rocket (TF2)
Reply With Quote #14

My code:
PHP Code:
new rocket_entity CreateEntityByName("tf_projectile_rocket");
            new 
team=GetClientTeam(client);
            
SetEntProp(rocket_entityProp_Send"m_hOwnerEntity"client210);
            
SetEntProp(rocket_entityProp_Send"m_iTeamNum"team60);
            
SetEntProp(rocket_entityProp_Send"m_iDeflected"040)
            
SetEntProp(rocket_entityProp_Send"m_bCritical"110)
            
DispatchSpawn(rocket_entity);
            
TeleportEntity(rocket_entityrocketposvectorfloatrocketvel); 
Spawns a rocket that does no damage. How do I fix it?
Inhib is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 01-01-2015 , 09:39   Re: [Help] Spawning Rocket (TF2)
Reply With Quote #15

You don't need to set m_iDeflected, you need to set the unnamed damage prop which is 4 bytes after m_iDeflected - read the code you were originally given.
__________________
asherkin is offline
Inhib
Member
Join Date: Oct 2014
Old 01-01-2015 , 09:43   Re: [Help] Spawning Rocket (TF2)
Reply With Quote #16

Quote:
Originally Posted by asherkin View Post
You don't need to set m_iDeflected, you need to set the unnamed damage prop which is 4 bytes after m_iDeflected - read the code you were originally given.
OK, I see
Inhib is offline
Inhib
Member
Join Date: Oct 2014
Old 01-02-2015 , 08:47   Re: [Help] Spawning Rocket (TF2)
Reply With Quote #17

Quote:
Originally Posted by asherkin View Post
You don't need to set m_iDeflected, you need to set the unnamed damage prop which is 4 bytes after m_iDeflected - read the code you were originally given.
Unnamed properties seem pretty annoying, is there anywhere where ALL properties are documented? I know sm_dump_netprops does this, but does it include the unnamed props? also, this dump does not document what each property defines (while some are pretty self explanatory, others are not so), is there any proper documentation for it?
Inhib is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 01-02-2015 , 10:21   Re: [Help] Spawning Rocket (TF2)
Reply With Quote #18

Quote:
Originally Posted by Inhib View Post
is there anywhere where ALL properties are documented?
The source code for the game.
__________________
asherkin is offline
Inhib
Member
Join Date: Oct 2014
Old 01-03-2015 , 09:00   Re: [Help] Spawning Rocket (TF2)
Reply With Quote #19

Quote:
Originally Posted by asherkin View Post
The source code for the game.
welp.. thanks!

Last edited by Inhib; 01-03-2015 at 09:01.
Inhib is offline
Inhib
Member
Join Date: Oct 2014
Old 01-04-2015 , 01:40   Re: [Help] Spawning Rocket (TF2)
Reply With Quote #20

/groups/sourcemod/upload_tmp/texttheWBj.sp(182) : warning 213: tag mismatch
/groups/sourcemod/upload_tmp/texttheWBj.sp(182) : error 035: argument type mismatch (argument 3)

My Code:
PHP Code:
new rocket_entity CreateEntityByName("tf_projectile_rocket");
            new 
team=GetClientTeam(client);
            
SetEntProp(rocket_entityProp_Send"m_hOwnerEntity"client210);
            
SetEntProp(rocket_entityProp_Send"m_iTeamNum"team60);
            
SetEntPropFloat(rocket_entityFindSendPropInfo("tf_projectile_rocket""m_iDeflected") + 4100.0true);          <----- Line 182
            SetEntProp
(rocket_entityProp_Send"m_bCritical"110);
            
DispatchSpawn(rocket_entity);
            
TeleportEntity(rocket_entityrocketposvectorfloatrocketvel); 
Inhib 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 12:53.


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