Raised This Month: $32 Target: $400
 8% 

[CSGO] Is posible to spawn an ENT on other ENT ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Elitcky
AlliedModders Donor
Join Date: Jun 2016
Location: Antofagasta, Chile
Old 05-27-2020 , 13:45   [CSGO] Is posible to spawn an ENT on other ENT ?
Reply With Quote #1

Well all is working by far, the problem is than i can't spawn the same ent on it...

For example the Mine 1 is spawned to the wall, and i want the mine 2 to spawn on the mine 1, but it just let me spawn the mine 2 near the mine 1 and just in walls or floor or anything else which is not the mine 1

PHP Code:
PlantMine(clientFloat:activation_delay 0.0explode_damageexplode_radius, const health 0, const color[3] = {255255255})
{
    if (
activation_delay 10.0)
    {
        
activation_delay 10.0;
    }
    else if (
activation_delay 0.0)
    {
        
activation_delay 0.0;
    }
    
    new 
Handle:trace TraceRay(client);
    
    
decl Float:end[3], Float:normal[3], Float:beamend[3];
    if (
TR_DidHit(trace) && TR_GetEntityIndex(trace) < 1)
    {
        
TR_GetEndPosition(endtrace);
        
TR_GetPlaneNormal(tracenormal);
        
CloseHandle(trace);
        
        
GetVectorAngles(normalnormal);
        
        
TR_TraceRayFilter(endnormalCONTENTS_SOLIDRayType_InfiniteFilterAll);
        
TR_GetEndPosition(beamendINVALID_HANDLE);
        
        new 
ent CreateEntityByName("prop_physics_override");
        if (
ent == -|| !IsValidEdict(ent))
        {
            
LogError("Could not create entity \"prop_physics_override\"");
            return -
1;
        }
        
        new 
beament CreateEntityByName("env_beam");
        if (
beament == -|| !IsValidEdict(beament))
        {
            
LogError("Could not create entity \"env_beam\"");
            return -
1;
        }
        
//CreateTimer(2.0, MakeSolid, EntIndexToEntRef(ent), TIMER_FLAG_NO_MAPCHANGE);

        
decl String:start[30], String:tmp[200];
        
Format(startsizeof(start), "Beam%i"beament);
        
        
SetEntityModel(entMDL_MINE);
        
        
decl String:buffer[16];
        
IntToString(explode_damagebuffersizeof(buffer));
        
DispatchKeyValue(ent"ExplodeDamage"buffer);
        
IntToString(explode_radiusbuffersizeof(buffer));
        
DispatchKeyValue(ent"ExplodeRadius"buffer);
        
        
DispatchKeyValue(ent"spawnflags""3");
        
SetEntProp(entProp_Data"m_nSolidType"6);   //Hacer no solido
        
SetEntProp(entProp_Data"m_CollisionGroup"5); //Hacer no solido
        
DispatchSpawn(ent);
        
        
AcceptEntityInput(ent"DisableMotion");
        
SetEntityMoveType(entMOVETYPE_NONE);
        
TeleportEntity(entendnormalNULL_VECTOR);
        
        if (
health)
        {
            
SetEntProp(entProp_Data"m_takedamage"2);
            
SetEntProp(entProp_Data"m_iHealth"health);
        }
        
        
Format(tmpsizeof(tmp), "%s,Kill,,0,-1"start);
        
DispatchKeyValue(ent"OnBreak"tmp);
        
        
EmitSoundToAll(SND_MINEPUTent);
        
        
        
        
// Set keyvalues on the beam.
        
DispatchKeyValue(beament"targetname"start);
        
DispatchKeyValue(beament"damage""0");
        
DispatchKeyValue(beament"framestart""0");
        
DispatchKeyValue(beament"BoltWidth""4.0");
        
DispatchKeyValue(beament"renderfx""0");
        
DispatchKeyValue(beament"TouchType""3"); // 0 = none, 1 = player only, 2 = NPC only, 3 = player or NPC, 4 = player, NPC or physprop
        
DispatchKeyValue(beament"framerate""0");
        
DispatchKeyValue(beament"decalname""Bigshot");
        
DispatchKeyValue(beament"TextureScroll""35");
        
DispatchKeyValue(beament"HDRColorScale""1.0");
        
DispatchKeyValue(beament"texture"MDL_LASER);
        
DispatchKeyValue(beament"life""0"); // 0 = infinite, beam life time in seconds
        
DispatchKeyValue(beament"StrikeTime""1"); // If beam life time not infinite, this repeat it back
        
DispatchKeyValue(beament"LightningStart"start);
        
DispatchKeyValue(beament"spawnflags""0"); // 0 disable, 1 = start on, etc etc. look from hammer editor
        
DispatchKeyValue(beament"NoiseAmplitude""0"); // straight beam = 0, other make noise beam
        
DispatchKeyValue(beament"Radius""256");
        
DispatchKeyValue(beament"renderamt""100");
        
DispatchKeyValue(beament"rendercolor""0 0 0");
        
        
AcceptEntityInput(beament"TurnOff");
        
        
SetEntityModel(beamentMDL_LASER);
        
        
TeleportEntity(beamentbeamendNULL_VECTORNULL_VECTOR); // Teleport the beam
        
        
SetEntPropVector(beamentProp_Data"m_vecEndPos"end);
        
SetEntPropFloat(beamentProp_Data"m_fWidth"3.0);
        
SetEntPropFloat(beamentProp_Data"m_fEndWidth"3.0);
        
        
SetEntPropEnt(beamentProp_Data"m_hOwnerEntity"client); // Sets the owner of the beam
        
SetEntPropEnt(entProp_Data"m_hMoveChild"beament);
        
SetEntPropEnt(beamentProp_Data"m_hEffectEntity"ent);
        
        new 
Handle:datapack CreateDataPack();
        
WritePackCell(datapackbeament);
        
WritePackCell(datapackent);
        
WritePackCell(datapackcolor[0]);
        
WritePackCell(datapackcolor[1]);
        
WritePackCell(datapackcolor[2]);
        
WritePackString(datapackstart);
        
CreateTimer(activation_delayOnActivateLaserdatapackTIMER_FLAG_NO_MAPCHANGE|TIMER_HNDL_CLOSE);
        
        
SDKHook(entSDKHook_OnTakeDamageOnTakeDamage);
        
        return 
ent;
    }
    else
        
CloseHandle(trace);
    return -
1;

__________________
Elitcky is offline
Kellan123
AlliedModders Donor
Join Date: Aug 2012
Old 05-27-2020 , 14:39   Re: [CSGO] Is posible to spawn an ENT on other ENT ?
Reply With Quote #2

PHP Code:
SetParent 
?

Last edited by Kellan123; 05-28-2020 at 14:34.
Kellan123 is offline
Elitcky
AlliedModders Donor
Join Date: Jun 2016
Location: Antofagasta, Chile
Old 05-27-2020 , 15:29   Re: [CSGO] Is posible to spawn an ENT on other ENT ?
Reply With Quote #3

Hm u have an example how to use it ? cause im trying to look into google, but just found 1 post similar to what i need, but i can't understand it lol
__________________
Elitcky is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 05-27-2020 , 18:38   Re: [CSGO] Is posible to spawn an ENT on other ENT ?
Reply With Quote #4

Look at this plugin. It uses SetParent method.

https://forums.alliedmods.net/showthread.php?t=297161
__________________
Spirit_12 is offline
Elitcky
AlliedModders Donor
Join Date: Jun 2016
Location: Antofagasta, Chile
Old 05-28-2020 , 12:41   Re: [CSGO] Is posible to spawn an ENT on other ENT ?
Reply With Quote #5

I think that is not what im looking for o.o

As i understood, it attachs the entity to a player or other entity...
I want the mine to be allowed for "Create the same entity" on top of it, like if the first mine deployed was a wall...

I dont know if im explaining it correctly ?
__________________
Elitcky is offline
Kellan123
AlliedModders Donor
Join Date: Aug 2012
Old 05-28-2020 , 14:33   Re: [CSGO] Is posible to spawn an ENT on other ENT ?
Reply With Quote #6

PHP Code:
SetParent 
is for title, your message
Quote:
For example the Mine 1 is spawned to the wall, and i want the mine 2 to spawn on the mine 1, but it just let me spawn the mine 2 near the mine 1 and just in walls or floor or anything else which is not the mine 1
answer is
PHP Code:
TeleportEntity 

Last edited by Kellan123; 05-28-2020 at 14:35.
Kellan123 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 01:30.


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