Hello thar! I'm trying to attach a dynamic light to a model so that they light will move around with the model, but it's not attaching to the model when I try setparent. Both entities spawn, but the light just won't attach to the prop I spawned. Can anyone spot what I may be doing incorrectly or give some pointers? Here's my code:
Code:
new String:target_entityCoord[50];
Format(target_entityCoord, sizeof(target_entityCoord), "%f %f %f", target_entityCoordX, target_entityCoordY, target_entityCoordZ);
/**
* Make the prop
*/
new target_propIndex = CreateEntityByName("prop_physics_override");
SetEntityModel(target_propIndex, "models/weapons/w_eq_smokegrenade.mdl");
DispatchKeyValue(target_propIndex, "origin", target_entityCoord);
DispatchSpawn(target_propIndex);
SetEntProp(target_propIndex, Prop_Data, "m_CollisionGroup", 2);
SetEntityMoveType(target_propIndex, MOVETYPE_VPHYSICS);
SetEntProp(target_propIndex, Prop_Data, "m_nSolidType", 6);
SetEntProp(target_propIndex, Prop_Data, "m_takedamage", 0);
/**
* Make the flare
*/
new Float:brightness = 6.0;
new String:brightness_s[20];
FloatToString(brightness, brightness_s, sizeof(brightness_s));
new target_flareIndex = CreateEntityByName("light_dynamic");
AcceptEntityInput(target_flareIndex, "SetParent", target_propIndex, target_flareIndex, 0);
DispatchKeyValue(target_flareIndex, "_light", "245 0 0");
DispatchKeyValue(target_flareIndex, "origin", target_entityCoord);
DispatchKeyValue(target_flareIndex, "brightness", brightness_s);
DispatchKeyValue(target_flareIndex, "distance", "256");
DispatchKeyValue(target_flareIndex, "style", "6");
DispatchSpawn(target_flareIndex);