-
-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG?] Entity teleportation can only be activated once #765
Comments
Both the client and the server are Windows systems... |
What do you think @KillStr3aK |
What if you set the follow entity input instead of teleporting around? |
Nothing happened (the glow remains static) |
mind sharing your glow code? |
var buffer = Utilities.CreateEntityByName<CBaseModelEntity>("basemodelentity");
buffer!.DispatchSpawn();
buffer!.Spawnflags = 256U;
buffer!.SetModel("xxx");
buffer!.Collision.CollisionGroup = 0;
buffer!.ShadowStrength = 0.0f;
buffer!.AnimTime = 0.0f;
buffer!.RenderMode = RenderMode_t.kRenderWorldGlow;
buffer!.RenderFX = RenderFx_t.kRenderFxFadeSlow;
buffer!.Render = Color.FromArgb(1, 255, 255, 255);
buffer!.FadeMinDist = 100.0f;
buffer!.Glow.GlowRange = 5000;
buffer!.Glow.GlowTeam = -1;
buffer!.Glow.GlowType = 3;
buffer!.Glow.GlowRangeMin = 3;
buffer!.Glow.GlowColorOverride = Color.FromArgb(255, rand.Next(256), rand.Next(256), rand.Next(256));
Utilities.SetStateChanged(buffer!, "CBaseEntity", "m_CBodyComponent");
Utilities.SetStateChanged(buffer!, "CBaseModelEntity", "m_nRenderMode");
Utilities.SetStateChanged(buffer!, "CBaseModelEntity", "m_nRenderFX");
Utilities.SetStateChanged(buffer!, "CBaseModelEntity", "m_clrRender");
buffer!.Teleport(new Vector(player.PlayerPawn.Value!.AbsOrigin!.X, player.PlayerPawn.Value!.AbsOrigin!.Y, player.PlayerPawn.Value!.AbsOrigin!.Z + player.PlayerPawn.Value!.ViewOffset.As<Vector>().Z + 40), new QAngle(0, 0, 0), new Vector(0, 0, 0)); My code is similar to this, but it will include more complex checks to ensure the entity is valid. |
This doesn't set the weapon as a parent or follow it, you need to try with either solutions as @KillStr3aK said 👍 |
I actually tried the method he mentioned and the glow stayed where it teleported. |
Try this, it works on pawn, it should work on a weapon (I didn't test it though) public static void SetGlow(this CBaseEntity entity)
{
CBaseModelEntity? modelGlow = Utilities.CreateEntityByName<CBaseModelEntity>("prop_dynamic");
CBaseModelEntity? modelRelay = Utilities.CreateEntityByName<CBaseModelEntity>("prop_dynamic");
if (modelGlow == null || modelRelay == null)
return;
string modelName = entity.CBodyComponent!.SceneNode!.GetSkeletonInstance().ModelState.ModelName;
modelRelay.SetModel(modelName);
modelRelay.Spawnflags = 256u;
modelRelay.RenderMode = RenderMode_t.kRenderNone;
modelRelay.DispatchSpawn();
modelGlow.SetModel(modelName);
modelGlow.Spawnflags = 256u;
modelGlow.DispatchSpawn();
modelGlow.Glow.GlowColorOverride = Color.Magenta;
modelGlow.Glow.GlowRange = 5000;
modelGlow.Glow.GlowTeam = -1;
modelGlow.Glow.GlowType = 3;
modelGlow.Glow.GlowRangeMin = 100;
modelRelay.AcceptInput("FollowEntity", entity, modelRelay, "!activator");
modelGlow.AcceptInput("FollowEntity", modelRelay, modelGlow, "!activator");
} |
Actually, I have already solved the model glowing. The purpose of opening this issue is to understand why the teleportation only works the first time when alpha = 0. Or is there a way to hide the model's texture? |
Preface: Maybe This Is Not a Bug🥲
When the Alpha of
CBaseModelEntity.Render
Is Set to an Integer Between 1 and 255The issue described in the title does not occur if the alpha value is set to an integer between 1 and 255.
Example (In CS2):

When Alpha Is Set to 0
The unexpected behavior mentioned in the title occurs when alpha is set to 0.
Note: The title might not be fully accurate (details explained below).
Why set alpha to 0?
I aimed to make the entity glow without rendering its model/texture, similar to the
prop_dynamic_glow
effect in CS:GO.Example (In CS2):

Initially, I assumed the issue was caused by the entity not updating on the network when
alpha=0
. However, them_lastNetworkChange
property of the entity continuously increases, suggesting network updates are still occurring.Key Observations
DispatchSpawn
on an entity withalpha=0
, only the first teleport takes effect. Subsequent teleports do not update the entity’s glow position (the glow remains static).AbsOrigin
after teleporting withalpha=0
confirms the coordinates match the target position.CBaseModelEntity.RenderMode
values:kRenderTransColor
kRenderTransTexture
kRenderGlow
kRenderTransAlpha
kRenderTransAlphaAdd
kRenderWorldGlow
All resulted in the same issue.
CBaseModelEntity.RenderFX
values:kRenderFxNone
kRenderFxFadeSlow
kRenderFxFadeIn
No changes observed.
prop_dynamic_override
prop_physics_override
CBaseModelEntity
Issue persisted in all cases.
The text was updated successfully, but these errors were encountered: