AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [Help] Spawning Rocket (TF2) (https://forums.alliedmods.net/showthread.php?t=253219)

Inhib 12-18-2014 02:35

[Help] Spawning Rocket (TF2)
 
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); 


turtsmcgurts 12-18-2014 05:25

Re: [Help] Spawning Rocket (TF2)
 
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.

Inhib 12-18-2014 08:05

Re: [Help] Spawning Rocket (TF2)
 
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 


Wliu 12-18-2014 08:57

Re: [Help] Spawning Rocket (TF2)
 
"tf_projectile_rocket", not tf_projectile_rocket

Inhib 12-18-2014 09:10

Re: [Help] Spawning Rocket (TF2)
 
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

Mitchell 12-18-2014 11:53

Re: [Help] Spawning Rocket (TF2)
 
just do:
Code:

SetEntProp(rocket_entity, Prop_Send, "m_iTeamNum", 2);
//etc.


Inhib 12-20-2014 00:18

Re: [Help] Spawning Rocket (TF2)
 
Quote:

Originally Posted by Mitchell (Post 2236831)
just do:
Code:

SetEntProp(rocket_entity, Prop_Send, "m_iTeamNum", 2);
//etc.


Same error for the same line

bl4nk 12-20-2014 16:27

Re: [Help] Spawning Rocket (TF2)
 
"tf_projectile_rocket" isn't the name of the netclass classname. You'll want to use "CTFProjectile_Rocket" instead.

Chdata 12-20-2014 17:20

Re: [Help] Spawning Rocket (TF2)
 
Quote:

Originally Posted by Inhib (Post 2237386)
Same error for the same line

SetEntProp(rocket_entity, Prop_Data, "m_iTeamNum", 2);

Powerlord 12-21-2014 11:34

Re: [Help] Spawning Rocket (TF2)
 
Quote:

Originally Posted by bl4nk (Post 2237723)
"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.


All times are GMT -4. The time now is 17:28.

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