Raised This Month: $ Target: $400
 0% 

[SNIPPET][L4D2] Laser Sight & Explosive Barrel Creation


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
McFlurry
Veteran Member
Join Date: Mar 2010
Location: RemoveEdict(0);
Old 10-05-2010 , 23:02   [SNIPPET][L4D2] Laser Sight & Explosive Barrel Creation
Reply With Quote #1

I thought I would post some handy snippets for Left 4 Dead 2.

Creating an explosive Barrel:
PHP Code:
        new ent CreateEntityByName("prop_fuel_barrel"); //Special prop type for the barrel
        
DispatchKeyValue(ent"model""models/props_industrial/barrel_fuel.mdl");
        
DispatchKeyValue(ent"BasePiece""models/props_industrial/barrel_fuel_partb.mdl");
        
DispatchKeyValue(ent"FlyingPiece01""models/props_industrial/barrel_fuel_parta.mdl"); //FlyingPiece01 - FlyingPiece04 are supported
        
DispatchKeyValue(ent"DetonateParticles""weapon_pipebomb"); //Particles to use, weapon_vomitjar might work haven't tested
        
DispatchKeyValue(ent"FlyingParticles""barrel_fly"); //Particles to use, I have never successfully gotten a list of L4D2 particle names yet
        
DispatchKeyValue(ent"DetonateSound""BaseGrenade.Explode"); //Scene File name that will be used as sound when barrel explodes
        
DispatchSpawn(ent); 
Now theres also the matter of laser sights which can't be created by the simple CreateEntityByName

Here's how:
PHP Code:
        new Float:pos[3], String:position[64];
        new 
ent CreateEntityByName("upgrade_spawn");      
        
DispatchKeyValue(ent"count""1"
        
DispatchKeyValue(ent"laser_sight""1"); 
        
Format(positionsizeof(position), "%1.1f %1.1f %1.1f"pos[0], pos[1], pos[2]); //Teleporting this entity will not work must use origin key value!
        
DispatchKeyValue(ent"origin"position); 
        
DispatchKeyValue(ent"classname""upgrade_spawn"); 
        
DispatchSpawn(ent); 
After DispatchSpawn you can use TeleportEntity how you like to teleport it somewhere. ALSO HANDY FOR STRIPPER!
__________________

Last edited by McFlurry; 10-05-2010 at 23:26.
McFlurry is offline
Send a message via Skype™ to McFlurry
ku5h
Member
Join Date: Feb 2009
Old 10-06-2010 , 08:51   Re: [SNIPPET][L4D2] Laser Sight & Explosive Barrel Creation
Reply With Quote #2

thx!
__________________
ku5h is offline
MarshalZCC
Senior Member
Join Date: Feb 2010
Location: Alberta, Canada
Old 11-05-2010 , 12:45   Re: [SNIPPET][L4D2] Laser Sight & Explosive Barrel Creation
Reply With Quote #3

Interesting that the ent stored when creating the laser upgrade box cannot be used later to remove it - its reported as an invalid entity/edict. Anyone know why upgrade spawns behave this way? Anyone know of a way to delete/remove the laser box once spawned?
MarshalZCC is offline
McFlurry
Veteran Member
Join Date: Mar 2010
Location: RemoveEdict(0);
Old 11-05-2010 , 17:16   Re: [SNIPPET][L4D2] Laser Sight & Explosive Barrel Creation
Reply With Quote #4

The invalid ent problem might have something to do with why teleport entity doesn't work on it.
__________________
McFlurry is offline
Send a message via Skype™ to McFlurry
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 01-13-2011 , 15:42   Re: [SNIPPET][L4D2] Laser Sight & Explosive Barrel Creation
Reply With Quote #5

Sorry for revive the thread , but i have a problem with this.

I have made a this simple plugin.

Code:
#include <sourcemod> public Plugin:myinfo = {     name = "New Plugin",     author = "Unknown",     description = "<- Description ->",     version = "1.0",     url = "<- URL ->" } public OnPluginStart()     RegConsoleCmd("say", Get_Sayed) public Action:Get_Sayed( index, args ) {     decl String:Say[50]     GetCmdArgString(Say, sizeof(Say))         if( StrContains( Say , "/barril" , false ) != -1 )     {         new ent = CreateEntityByName("prop_fuel_barrel"); //Special prop type for the barrel         DispatchKeyValue(ent, "model", "models/props_industrial/barrel_fuel.mdl");         DispatchKeyValue(ent, "BasePiece", "models/props_industrial/barrel_fuel_partb.mdl");         DispatchKeyValue(ent, "FlyingPiece01", "models/props_industrial/barrel_fuel_parta.mdl"); //FlyingPiece01 - FlyingPiece04 are supported         DispatchKeyValue(ent, "DetonateParticles", "weapon_pipebomb"); //Particles to use, weapon_vomitjar might work haven't tested         DispatchKeyValue(ent, "FlyingParticles", "barrel_fly"); //Particles to use, I have never successfully gotten a list of L4D2 particle names yet         DispatchKeyValue(ent, "DetonateSound", "BaseGrenade.Explode"); //Scene File name that will be used as sound when barrel explodes         DispatchSpawn(ent);         PrintToChat( index , "[SM] Barril Creado")     } }

But , doens't make the barrel , what is the problem ?
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 01-13-2011 , 18:47   Re: [SNIPPET][L4D2] Laser Sight & Explosive Barrel Creation
Reply With Quote #6

Quote:
Originally Posted by McFlurry View Post
After DispatchSpawn you can use TeleportEntity how you like to teleport it somewhere. ALSO HANDY FOR STRIPPER!
I think you need to precache the model either
__________________
Peace-Maker is offline
McFlurry
Veteran Member
Join Date: Mar 2010
Location: RemoveEdict(0);
Old 01-13-2011 , 21:37   Re: [SNIPPET][L4D2] Laser Sight & Explosive Barrel Creation
Reply With Quote #7

PHP Code:
public OnMapStart()
{
    
PrecacheModel("models/props_industrial/barrel_fuel.mdl"true);
    
PrecacheModel("models/props_industrial/barrel_fuel_partb.mdl"true);
    
PrecacheModel("models/props_industrial/barrel_fuel_parta.mdl"true);

Also for lucas, You didn't teleport the barrel anywhere it's most likely at
0 0 0
And it's easier to create a command then to hook say.
Also at the top of the plugin you need
#include <sdktools>
__________________
McFlurry is offline
Send a message via Skype™ to McFlurry
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 01-14-2011 , 05:14   Re: [SNIPPET][L4D2] Laser Sight & Explosive Barrel Creation
Reply With Quote #8

Oh , i forgot the include , thanks .

When you say ' You didn't Teleport the barrel anywhere ' , i need put

PHP Code:
Format(positionsizeof(position), "%1.1f %1.1f %1.1f"pos[0], pos[1], pos[2]); 
DispatchKeyValue(ent"origin"position); 
Like that ?
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
McFlurry
Veteran Member
Join Date: Mar 2010
Location: RemoveEdict(0);
Old 01-14-2011 , 16:47   Re: [SNIPPET][L4D2] Laser Sight & Explosive Barrel Creation
Reply With Quote #9

The code you posted is only to be used on Laser Sight boxes, unless you fee like it. Though What you need to do is this.
After DispatchSpawn(ent);
PHP Code:
new Float:eye[3];
GetClientEyePosition(clienteye);
TeleportEntity(enteyeNULL_VECTORNULL_VECTOR); 
Also your prototype is wrong, it should be
public Action:Get_Sayed( client, args );
__________________
McFlurry is offline
Send a message via Skype™ to McFlurry
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 01-14-2011 , 17:04   Re: [SNIPPET][L4D2] Laser Sight & Explosive Barrel Creation
Reply With Quote #10

Oh , yeah , now works perfectly , thanks you very much .

One cuestion , have diference to change between client & index ?
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
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 19:12.


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