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

Solved [L4D2]How do you spawn a breakable wooden crate?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Morning
Member
Join Date: May 2021
Old 02-22-2024 , 03:48   [L4D2]How do you spawn a breakable wooden crate?
Reply With Quote #1

I use a pretty basic function to spawn in physics props within my plugins. It's not the most elegant method, but it's been enough for what I want up until now:

Code:
public Action:spawnpropangle(char item[64], char origin[128], char angle[128], float scale)

{
	new ent = CreateEntityByName("prop_physics_override");
	DispatchKeyValue(ent, "count", "1");
	DispatchKeyValue(ent, "collisions", "1");
	DispatchKeyValue(ent, "spawnflags", "3");
	DispatchKeyValue(ent, "origin", origin);
	DispatchKeyValue(ent, "angles", angle);
    DispatchKeyValue(ent, "model", item); 
	DispatchSpawn(ent);
	AcceptEntityInput(ent, "EnableMotion");
	SetEntPropFloat(ent, Prop_Send, "m_flModelScale", scale);
}
I now want to go a little further, and create a wooden box which will break into fragments based on the model (and gibs):

Code:
	PrecacheModel("models/props_junk/wood_crate002a.mdl", 1);
	PrecacheModel("models/props_junk/wood_crate001a_chunk01.mdl", 1);
	PrecacheModel("models/props_junk/wood_crate001a_chunk02.mdl", 1);
	PrecacheModel("models/props_junk/wood_crate001a_chunk03.mdl", 1);
	PrecacheModel("models/props_junk/wood_crate001a_chunk04.mdl", 1);
	PrecacheModel("models/props_junk/wood_crate001a_chunk05.mdl", 1);
I have no idea how to do this - I'm guessing using the brush entity func_breakable. It doesnt have to be perfect, I just want to be able to spawn regular breakable boxes.

edit: okay that was silly, i just added health keyvalue to the original function and it breaks into peices

Last edited by Morning; 02-22-2024 at 04:02.
Morning is offline
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 15:45.


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