AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [Tutorial] Creating brush entities (https://forums.alliedmods.net/showthread.php?t=129597)

blodia 06-21-2010 07:08

Re: [Tutorial] Creating brush entities
 
this section is for source pawn related tutorials and snippets, you're better off asking in the metamod:source section.

AtomicStryker 06-22-2010 11:39

Re: [Tutorial] Creating brush entities
 
Could one spawn working ladders?

blodia 06-22-2010 13:05

Re: [Tutorial] Creating brush entities
 
i haven't tried but i don't think you can, in the wiki it mentions "This is an internal entity. When the map is compiled by VBSP it is processed and then removed: it does not exist when the map is running." its the same with some other entities.

almcaeobtac 06-22-2010 15:29

Re: [Tutorial] Creating brush entities
 
Great work, this will be extremely useful!

berni 06-30-2010 19:31

Re: [Tutorial] Creating brush entities
 
This tutorial helped me allot. Thank you blodia !

Chrisber 07-01-2010 08:36

Re: [Tutorial] Creating brush entities
 
Wow! You've done an impossible thing. Nice!

flud 07-05-2010 06:31

Re: [Tutorial] Creating brush entities
 
anyone try trigger_teleport ?

PHP Code:

#pragma semicolon 1

#include <sourcemod>
#include <sdktools>

#define PLUGIN_VERSION    "2.0"

new String:model[PLATFORM_MAX_PATH] = "models/props_mall/mall_shopliftscanner.mdl";

public 
Plugin:myinfo = {
    
name "test",
    
author "FluD",
    
description "test device",
    
version PLUGIN_VERSION,
    
url "www.alliedmods.net"
}

public 
OnPluginStart(){

    
RegConsoleCmd("sm_test"cmd_test"");
}

public 
Action:cmd_test(client,args){

    new 
index CreateEntityByName("prop_dynamic");
    if (
index != -1){
        new 
Float:position[3];
        
GetCollisionPoint(clientposition);

        if (!
IsModelPrecached(model))
        {
            
PrecacheModel(model);
        }
        
DispatchKeyValue(index"model"model);
        
DispatchKeyValue(index"classname""prop_dynamic");
        
DispatchKeyValue(index"disableselfshadowing""1");
        
DispatchKeyValue(index"disablevertexlighting""1");
        
DispatchKeyValue(index"fademindist""-1");
        
DispatchKeyValue(index"fadescale""1");
        
DispatchKeyValue(index"renderamt""255");
        
DispatchKeyValue(index"rendercolor""255 0 0");
        
DispatchKeyValue(index"skin""0");
        
DispatchKeyValue(index"solid""0");
        
DispatchKeyValueVector(index"Origin"position);
        
DispatchSpawn(index);
    }

    new 
trigger CreateEntityByName("trigger_teleport");
    if (
trigger != -1){
        new 
Float:position[3];
        
GetCollisionPoint(clientposition);

        
DispatchKeyValueVector(trigger"origin"position );
        
DispatchKeyValue(trigger"classname""trigger_teleport");
        
DispatchKeyValue(trigger"spawnflags""15");
        
DispatchKeyValue(trigger"StartDisabled""0");
        
DispatchKeyValue(trigger"target""t_out");
        
DispatchSpawn(trigger);
        
ActivateEntity(trigger);
        
SetEntityModel(triggermodel);

        new 
Float:minbounds[3];
        
minbounds[0] = -100.0;
        
minbounds[1] = -100.0;
        
minbounds[2] = 0.0;

        new 
Float:maxbounds[3];
        
minbounds[0] = 100.0;
        
minbounds[1] = 100.0;
        
minbounds[2] = 200.0;

        
SetEntPropVector(triggerProp_Send"m_vecMins"minbounds);
        
SetEntPropVector(triggerProp_Send"m_vecMaxs"maxbounds);
        
        
SetEntProp(triggerProp_Send"m_nSolidType"2);

        new 
enteffects GetEntProp(triggerProp_Send"m_fEffects");
        
enteffects |= 32;
        
SetEntProp(triggerProp_Send"m_fEffects"enteffects);
    }

    new 
destination CreateEntityByName("info_teleport_destination");
    if (
destination != -1){
        new 
Float:position[3];
        
GetCollisionPoint(clientposition);
        
position[0] = (position[0] + 200);

        
DispatchKeyValueVector(destination"origin"position);
        
DispatchKeyValue(destination"angles""0 0 0");
        
DispatchKeyValue(destination"spawnflags""15");
        
DispatchKeyValue(destination"targetname""t_out");
        
DispatchKeyValue(destination"classname""info_teleport_destination");
        
DispatchSpawn(destination);
    }
    return 
Plugin_Continue;
}

stock GetCollisionPoint(clientFloat:pos[3]){

    
decl Float:vOrigin[3], Float:vAngles[3];

    
GetClientEyePosition(clientvOrigin);
    
GetClientEyeAngles(clientvAngles);

    new 
Handle:trace TR_TraceRayFilterEx(vOriginvAnglesMASK_SOLIDRayType_InfiniteTraceEntityFilterPlayer);

    if(
TR_DidHit(trace))
    {
        
TR_GetEndPosition(postrace);
        
CloseHandle(trace);

        return;
    }
    
CloseHandle(trace);
}

public 
bool:TraceEntityFilterPlayer(entitycontentsMask){
    return 
entity GetMaxClients() || !entity;


does not work :cry: I will be glad if someone can help

blodia 07-05-2010 07:02

Re: [Tutorial] Creating brush entities
 
i would try and test/fix it for you but unfortunately since the css update i haven't been able to get the steam srcds or the standalone working so i can't do anything until its fixed.

do you get any errors? have you tried TeleportEntity instead of setting the origin and angles keyvalue. you also don't need to set the classname keyvalue. although it shouldn't matter try creating the info_teleport_destination before the trigger_teleport

flud 07-05-2010 11:04

Re: [Tutorial] Creating brush entities
 
my bad it's work

PHP Code:

        new Float:minbounds[3]; 
        
minbounds[0] = -100.0
        
minbounds[1] = -100.0
        
minbounds[2] = 0.0

        new 
Float:maxbounds[3]; 
        
minbounds[0] = 100.0
        
minbounds[1] = 100.0
        
minbounds[2] = 200.0

change to
PHP Code:

        new Float:minbounds[3] = {-100.0, -100.00.0}; 
        new 
Float:maxbounds[3] = {100.0100.0200.0}; 

:oops:

flud 07-06-2010 02:50

Re: [Tutorial] Creating brush entities
 
Quote:

Originally Posted by blodia (Post 1208636)
you can addoutputs to the entities and hook the output so you can call a function whenever the output is fired. e.g you could have a trigger_once/trigger_multiple thats fires a blank output that is hooked, this will allow you to run code on whoever triggered the output.

Snippets? :| how to

i try but nothing
PHP Code:

public OnPluginStart(){
HookEntityOutput("trigger_teleport""OnTouching"Entity_OnPlayerTouch);
}

public 
Entity_OnPlayerTouch(const String:output[], calleractivatorFloat:delay){
   
PrintToChatAll("TRIGGERED");


ops again my fault, all ok, just need know entity exist then hook


All times are GMT -4. The time now is 11:56.

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