AlliedModders Donor
Join Date: Jun 2016
Location: Antofagasta, Chile
|
05-21-2020
, 13:30
Re: How to set Physics Properties on custom model ?
|
#3
|
Its for csgo sir ^.^ and yes it actually need to be a solid where players can stand on it like in this photo of 1.6
https://prnt.sc/sl83z2
it need to do exactly as that photo, so should i code it with dynamic ? could u give me and example? because the code actually spawn it like this
PHP Code:
PlantMine(client, Float:activation_delay = 0.0, explode_damage, explode_radius, const health = 0, const color[3] = {255, 255, 255}) { 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(end, trace); TR_GetPlaneNormal(trace, normal); CloseHandle(trace); GetVectorAngles(normal, normal); TR_TraceRayFilter(end, normal, CONTENTS_SOLID, RayType_Infinite, FilterAll); TR_GetEndPosition(beamend, INVALID_HANDLE); new ent = CreateEntityByName("prop_physics_override"); if (ent == -1 || !IsValidEdict(ent)) { LogError("Could not create entity \"prop_physics_override\""); return -1; } new beament = CreateEntityByName("env_beam"); if (beament == -1 || !IsValidEdict(beament)) { LogError("Could not create entity \"env_beam\""); return -1; } decl String:start[30], String:tmp[200]; Format(start, sizeof(start), "Beam%i", beament); SetEntityModel(ent, MDL_MINE); decl String:buffer[16]; IntToString(explode_damage, buffer, sizeof(buffer)); DispatchKeyValue(ent, "ExplodeDamage", buffer); IntToString(explode_radius, buffer, sizeof(buffer)); DispatchKeyValue(ent, "ExplodeRadius", buffer); DispatchKeyValue(ent, "spawnflags", "3"); DispatchSpawn(ent); AcceptEntityInput(ent, "DisableMotion"); SetEntityMoveType(ent, MOVETYPE_NONE); TeleportEntity(ent, end, normal, NULL_VECTOR); SetEntProp(ent, Prop_Data, "m_nSolidType", 6); SetEntProp(ent, Prop_Data, "m_CollisionGroup", 5); if (health) { SetEntProp(ent, Prop_Data, "m_takedamage", 2); SetEntProp(ent, Prop_Data, "m_iHealth", health); } Format(tmp, sizeof(tmp), "%s,Kill,,0,-1", start); DispatchKeyValue(ent, "OnBreak", tmp); EmitSoundToAll(SND_MINEPUT, ent); // 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(beament, MDL_LASER); TeleportEntity(beament, beamend, NULL_VECTOR, NULL_VECTOR); // Teleport the beam SetEntPropVector(beament, Prop_Data, "m_vecEndPos", end); SetEntPropFloat(beament, Prop_Data, "m_fWidth", 3.0); SetEntPropFloat(beament, Prop_Data, "m_fEndWidth", 3.0); SetEntPropEnt(beament, Prop_Data, "m_hOwnerEntity", client); // Sets the owner of the beam SetEntPropEnt(ent, Prop_Data, "m_hMoveChild", beament); SetEntPropEnt(beament, Prop_Data, "m_hEffectEntity", ent); new Handle:datapack = CreateDataPack(); WritePackCell(datapack, beament); WritePackCell(datapack, ent); WritePackCell(datapack, color[0]); WritePackCell(datapack, color[1]); WritePackCell(datapack, color[2]); WritePackString(datapack, start); CreateTimer(activation_delay, OnActivateLaser, datapack, TIMER_FLAG_NO_MAPCHANGE|TIMER_HNDL_CLOSE); SDKHook(ent, SDKHook_OnTakeDamage, OnTakeDamage); return ent; } else CloseHandle(trace); return -1; }
PD: I dont have to do nothing in the .qc file of the model then ? or yes ? because the qc is actually like this
Code:
// Created by Crowbar 0.68
$modelname "sharks/tripmine/tripmine.mdl"
$bodygroup "Perfect World Wings"
{
studio "perfectworld_wings01_v3_reference.smd"
}
$surfaceprop "default"
$contents "solid"
$illumposition 0 -3.273 -0.187
$cdmaterials "models\sharks\tripmine\"
$cbox 0 0 0 0 0 0
$bbox -1.074 -8.24 -4.244 7.811 8.24 4.234
$definebone "ValveBiped.Bip01_R_Hand" "" 8.128044 -0.554475 -4.243925 -87.796618 53.219246 -142.581975 0 0 0 0 0 0
$definebone "w_tripmine" "ValveBiped.Bip01_R_Hand" 4.070752 -8.218533 0.517858 88.130628 -160.734172 -159.404922 0 0 0 0 0 0
$sectionframes 30 100
$sequence "idle" {
"tripmine_anims\idle.smd"
fadein 0.2
fadeout 0.2
fps 30
loop
}
$collisionmodel "tripmine_physics.smd"
{
$mass 3000
$inertia 1
$damping 0
$rotdamping 0
$rootbone " "
$concave
$maxconvexpieces 1
}
$keyvalues
{
qc_path
{
"value" "c:\users\versuspc\desktop\modelos\- props -\tripmine\perfectworld_wings01_v3.qc"
}
}
__________________
Last edited by Elitcky; 05-21-2020 at 13:34.
|
|