darrenc182 Posted July 10, 2011 Share Posted July 10, 2011 Decals won't disappear when freeing the entity. This use to work fine and it was the way I erased bullet decals after a certain amount of time. Does anyone know why the decals no longer disappear after the decal's entity is freed? Also is there a way to remove a decal after a certain time frame? I will post some code if needed upon request. Thanks in advance for all help and suggestions. Quote Intel 2nd Generation i5 Quad Core Running at 3.30GHz. 8GB RAM, GeForce GTX 460 1024MB DDR5. Link to comment Share on other sites More sharing options...
Canardia Posted July 10, 2011 Share Posted July 10, 2011 You could use/copypaste the MultiTimer class from gamelib to give each decal a decaying time, and then remove them when the time has passed. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
darrenc182 Posted July 10, 2011 Author Share Posted July 10, 2011 You could use/copypaste the MultiTimer class from gamelib to give each decal a decaying time, and then remove them when the time has passed. Thanks for the reply Metatron. How do I remove the decal when the time passes. I make a call to FreeEntity when the set time expires, but that doesn't remove the decal. Quote Intel 2nd Generation i5 Quad Core Running at 3.30GHz. 8GB RAM, GeForce GTX 460 1024MB DDR5. Link to comment Share on other sites More sharing options...
macklebee Posted July 10, 2011 Share Posted July 10, 2011 are you setting the parent of the decal? if so then it should remove the decal automatically when you free the parent entity. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
darrenc182 Posted July 10, 2011 Author Share Posted July 10, 2011 I am setting the parent of the entity, but I'm not removing the parent until the user quits and I need the decal to disappear before then since these particular decals are bullet holes. Quote Intel 2nd Generation i5 Quad Core Running at 3.30GHz. 8GB RAM, GeForce GTX 460 1024MB DDR5. Link to comment Share on other sites More sharing options...
macklebee Posted July 10, 2011 Share Posted July 10, 2011 ah sorry... when you said the decal's entity in the first post i thought you meant the pick entity that it was being attached to... not the decal itself. I would suggest that you post your code because i can free a decal just fine... i assume it has something to do with however you are creating an array of them... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
darrenc182 Posted July 10, 2011 Author Share Posted July 10, 2011 ah sorry... when you said the decal's entity in the first post i thought you meant the pick entity that it was being attached to... not the decal itself. I would suggest that you post your code because i can free a decal just fine... i assume it has something to do with however you are creating an array of them... Here is my code for creating a decal. Decal = CreateDecal(pick.surface, TFormPoint(Vec3(pick.X,pick.Y,pick.Z), NULL, pick.entity), 1.0f, 0); EntityParent(Decal, pick.entity); PaintEntity(Decal, LoadMaterial("abstract::dev_decal.mat")); UpdateMesh(Decal); AddMesh(Decal, pick.entity); time = AppTime(); sprintf(key, "%f", time+5000); SetEntityKey(Decal, "killtime", key); SetEntityCallback(Decal, (byte *)UpdateBulletDecalCallback, ENTITYCALLBACK_UPDATEPHYSICS); And here is the code for freeing the decal once the specified time has been reached. void __stdcall UpdateBulletDecalCallback(TEntity entity) { float time, time_value; str key_value; key_value = GetEntityKey(entity, "killtime"); time_value = flt(atof(key_value)); time=AppTime(); if(time>time_value) FreeEntity(entity); } Quote Intel 2nd Generation i5 Quad Core Running at 3.30GHz. 8GB RAM, GeForce GTX 460 1024MB DDR5. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.