Raised This Month: $7 Target: $400
 1% 

[Tutorial] Creating brush entities


Post New Thread Reply   
 
Thread Tools Display Modes
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 02-20-2011 , 12:11   Re: [Tutorial] Creating brush entities
Reply With Quote #41

i have an idea how to be able to rotate the brushes using a custom model, but at the moment i want to get my vehicle mod finished before i try other stuff, i have no idea how long it will take.
blodia is offline
Monkeys
Veteran Member
Join Date: Jan 2010
Old 02-21-2011 , 17:47   Re: [Tutorial] Creating brush entities
Reply With Quote #42

Yeah, I noticed your car mod and all the bumps these cars are facing x)
I'm in no hurry, so do take your time.
__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.
Monkeys is offline
Nail
BANNED
Join Date: May 2008
Location: PetrovЪ GradЪ
Old 05-09-2011 , 06:22   Re: [Tutorial] Creating brush entities
Reply With Quote #43

I created Func_button
PHP Code:
    new entindex CreateEntityByName("func_button");
    
PrecacheModel("models/props/cs_office/vending_machine.mdl"true);
    if (
entindex != -1)
    {
        
DispatchKeyValue(entindex"pushdir""0 90 0");
        
DispatchKeyValue(entindex"speed""500");
        
DispatchKeyValue(entindex"spawnflags""64");
        
DispatchKeyValue(entindex"OnPressed""!self,Use,,-1,-1");
        
DispatchKeyValue(entindex"Press""!self,Kill,,-1,-1");
        
DispatchKeyValue(entindex"OnPressed""!self,Kill,,-1,-1");
        
DispatchKeyValue(entindex"OnIn""!self,Kill,,-1,-1");
        
DispatchKeyValue(entindex"OnOut""!self,Kill,,-1,-1");
        
DispatchKeyValue(entindex"OnPlayerUse""!self,Kill,,-1,-1");
        
HookSingleEntityOutput(entindex"OnPressed"buttUsetrue);
    }

    
DispatchSpawn(entindex);
    
ActivateEntity(entindex);

    
TeleportEntity(entindexendnormalNULL_VECTOR);
    
    
SetEntityModel(entindex"models/props/cs_office/vending_machine.mdl");

    new 
Float:minbounds[3] = {-100.0, -100.00.0};
    new 
Float:maxbounds[3] = {100.0100.0200.0};
    
SetEntPropVector(entindexProp_Send"m_vecMins"minbounds);
    
SetEntPropVector(entindexProp_Send"m_vecMaxs"maxbounds);
    
    
SetEntProp(entindexProp_Send"m_nSolidType"2);

    new 
enteffects GetEntProp(entindexProp_Send"m_fEffects");
    
enteffects |= 32;
    
SetEntProp(entindexProp_Send"m_fEffects"enteffects); 
But OnPressed, OnIn, OnPlayerUse does not work, why can this be?
Nail is offline
Zoomj
New Member
Join Date: Apr 2009
Old 05-09-2011 , 13:01   Re: [Tutorial] Creating brush entities
Reply With Quote #44

it might be the spawnflags stopping it from working, according the the devwiki:
Quote:
1024 : Use Activates - Using +use (Default: E) on this button will trigger it.
although i'm still not so sure whether this will work as intended, remember this method doesn't work for all entities, and the flexibility with the ones it does work with is limited. for such a button, it might be worth trying prop_physics, you'll be able to see a visual model and it also provides a +use output if the spawn flags are set correctly (see top of props_shared.h).

Quote:
i have an idea how to be able to rotate the brushes using a custom model
care to explain ? i've been trying to get rotations working for a while now, i've tried just about everything i could think of using solid types, flags and surrounding bounds properties but i can't seem to get it. i thought i had it a moment ago, but just realized that rotations work when the rotated angle happens to align perfectly with the world axis (0, 90, 180, 270, 360).. that was cruel whenever they don't align it just creates a bounding box around the whole area that does align (or appears to). i did find something curious on the devwiki which i'm going to test in a bit, but i'm doubtful at this point (also limiting it to such an entity makes me need to install sdkhooks or something.. and it's not a brush haha).
Quote:
prop_dynamic entities set to SOLID_NONE are upgraded to SOLID_OBB and FSOLID_NOT_SOLID when Spawned so that the bounding box will properly rotate.
anyway, thanks for posting this method blodia.
Zoomj is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 05-11-2011 , 07:44   Re: [Tutorial] Creating brush entities
Reply With Quote #45

since i have no idea when i'll be able to get back to this i'll try and explain my idea (it may not work).

you need to make a custom model, a 1x1x1 cube, it needs 3 animation that will be used as pose parameters, each animation moves the vetices of one of the edge faces upto lets say 10000. so you should have 3 animations, 1 that changes x from 1 to 10000, 1 that changes y from 1 to 10000 and 1 that changes z from 1 to 10000.

when you compile the model use the reference model as the collision model, hopefully this will retain the animation data for the collision model. you need to set up the animation for pose parameters aswell. once in game you change change the pose parameters manually which means you can change the dimension of the cube along each axis from 1 to 10000. if the collision model did retain the animation data of the reference model it should also change in dimension.

in the example in the first post i change the "m_nSolidType" to bbox(2), instead we want to use vphysics(6). this will use the models collision model for collisions which can be rotated (i tested with the vending machine). i have no idea if this will work, it was just something that came to me, its a lot of work but if anyone wants to give it a try. it would have been a lot easier if valve had implemented the oobb.

if it works its mainly for triggers, for entities like func_conveyor you're better of have a dynamic prop for the visual model then the brush using the same model with vphysics so it syncs perfectly up with the visual model.

Last edited by blodia; 05-11-2011 at 07:49.
blodia is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 04-06-2012 , 17:34   Re: [Tutorial] Creating brush entities
Reply With Quote #46

This started me down a path I hope would allow me to do something, but turns out Source doesn't allow full model scaling...

I was trying to change the size of a prop_physics_multiplayer, but after a few attempts and help from IRC (Drifter and Peace-Maker), it turns out:

<@asherkin> Source doesnt support full model scaling

If anyone has any other ideas how to dynamically set a models size, please advise... or maybe Source will one day support it.
__________________
View my Plugins | Donate
TnTSCS is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 04-06-2012 , 18:08   Re: [Tutorial] Creating brush entities
Reply With Quote #47

ugh i thought i had posted about info i mentioned in my previous post but i was wrong, i tried out the method i mentioned last year sometime and it didn't work for anyone who was wondering.

TntSCS theres an entity called prop_scalable in ep2 that allows you to scale models but it doesn't seem to be available in most other games which is a shame.
closest you can do is "m_flModelWidthScale" which is used for entities being eaten by barnacles in hl2 to make models "thin" as they're being swallowed, i can't remember but i think it only affects the reference model and not the collision model though.

lol i can't count the number i times went down long paths that ended up no where. other times they eventually worked out when the answer just suddenly pops in my head like a year after giving up. getting brushes to work was one, i remember trying to get them to work in eventscripts back in 2007, 3 years later in sourcemod i got it partially working lol.

just keep at it, you'll probably find a way eventually even if its only a hacky method like most of my plugins, as far as i'm concerned something is better than nothing. just forget about it for a while and it might hit you one day.

Last edited by blodia; 04-06-2012 at 18:33.
blodia is offline
Predator01337
Junior Member
Join Date: Feb 2012
Old 08-01-2012 , 14:28   Re: [Tutorial] Creating brush entities
Reply With Quote #48

Could anyone provide a example of creating a trigger_multiple with hooked output?

I'm basically going to do is that when a client enters a definden Area of the he is forced to suicide.

I want to place 3 or 4 Trigger with that effect but enable only 1.

Need Help.
Predator01337 is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 05-28-2013 , 07:18   Re: [Tutorial] Creating brush entities
Reply With Quote #49

I just want to create a simple area that I can pop SDKHook_StartTouch on. The area CANNOT be solid to players. The only effect that the entity can have on anything is what comes about as a result of SDKHooks.

What entity should I use? Just func_brush? Also,

PHP Code:
SetEntProp(entindexProp_Send"m_CollisionGroup"X);
SetEntProp(entindexProp_Send"m_nSolidType"Y);
SetEntProp(entindexProp_Send"m_usSolidFlags"Z); 
What should X, Y, and Z be set to? I keep trying different things, but everything I try is either solid to players, or doesn't seem to actually trigger the hook.

Last edited by ddhoward; 05-28-2013 at 07:19.
ddhoward is offline
Root_
Veteran Member
Join Date: Jan 2012
Location: ryssland
Old 05-28-2013 , 13:51   Re: [Tutorial] Creating brush entities
Reply With Quote #50

It's enough to use m_CollisionGroup and m_usSolidFlags
Values are 11 and 152 respectively
__________________


dodsplugins.com - Plugins and Resources for Day of Defeat
http://twitch.tv/zadroot
Root_ 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 06:02.


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