AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Rotating Entity (https://forums.alliedmods.net/showthread.php?t=294828)

Beqa Gurgenidze 03-09-2017 01:44

[HELP] Rotating Entity
 
How to rotate entity on its center? when i'm changing its angles it changes also position. :shock:

georgik57 03-09-2017 04:07

Re: [HELP] Rotating Entity
 
EV_VEC_avelocity or pev_avelocity

Beqa Gurgenidze 03-09-2017 04:19

Re: [HELP] Rotating Entity
 
Quote:

Originally Posted by georgik57 (Post 2502007)
EV_VEC_avelocity or pev_avelocity

Does not seems to be working.

georgik57 03-10-2017 08:57

Re: [HELP] Rotating Entity
 
1 Attachment(s)
The engine seems to have a lot of requirements for avelocity one of them being that the entity must be thinking.
So it's easier for us to just do our own custom angle movement instead.

If you want and know how, you can fully convert the code to use Engine module's natives and forwards.
If you don't understand any part of the code, ask and I will answer. Have fun.

Code:
#include <amxmodx> #include <engine> #include <fakemeta> new const g_szModel[] = "models/chick.mdl"; new const g_szClassName[] = "MyCustomEntClassName"; const Float:g_fEntThinkFrequency = 0.001; public plugin_precache() {     precache_model(g_szModel) } public plugin_init() {     register_think(g_szClassName, "fwEgThinkEntCustom")         register_clcmd("say /entrot", "fwClCMDSay") } public fwEgThinkEntCustom(const iIDEnt) {     static Float:fVecTemp[3], Float:fVecTemp2[3];         pev(iIDEnt, pev_angles, fVecTemp2)     pev(iIDEnt, pev_vuser4, fVecTemp)         fVecTemp2[0] += (fVecTemp[0] * g_fEntThinkFrequency * 10);     fVecTemp2[1] += (fVecTemp[1] * g_fEntThinkFrequency * 10);     fVecTemp2[2] += (fVecTemp[2] * g_fEntThinkFrequency * 10);         set_pev(iIDEnt, pev_angles, fVecTemp2)     set_pev(iIDEnt, pev_nextthink, get_gametime() + g_fEntThinkFrequency) } public fwClCMDSay(const iID) {     static iIDAllocString;         if (!iIDAllocString)         iIDAllocString = engfunc(EngFunc_AllocString, "info_target");         new iIDEnt = engfunc(EngFunc_CreateNamedEntity, iIDAllocString);         if (!pev_valid(iIDEnt))         return;         set_pev(iIDEnt, pev_framerate, 1.0)         new Float:fGameTime = get_gametime();         set_pev(iIDEnt, pev_animtime, fGameTime)         dllfunc(DLLFunc_Spawn, iIDEnt)         set_pev(iIDEnt, pev_rendermode, kRenderNormal)     set_pev(iIDEnt, pev_renderfx, kRenderFxGlowShell)     set_pev(iIDEnt, pev_renderamt, 10.0)         static Float:fVecTemp[3];         fVecTemp[0] = random_float(50.0, 255.0);     fVecTemp[1] = random_float(0.0, 255.0);     fVecTemp[2] = random_float(0.0, 255.0);         set_pev(iIDEnt, pev_rendercolor, fVecTemp)         fVecTemp[0] = 0.0; // forward or backward rolling     fVecTemp[1] = random_num(0, 1) ? 50.0 : -50.0; //random_float(-50.0, 50.0) sideways turning     fVecTemp[2] = 0.0; // sideways rolling         set_pev(iIDEnt, pev_vuser4, fVecTemp)//pev_avelocity         pev(iID, pev_origin, fVecTemp)         fVecTemp[2] += 100.0;         engfunc(EngFunc_SetOrigin, iIDEnt, fVecTemp)     engfunc(EngFunc_SetModel, iIDEnt, g_szModel)     engfunc(EngFunc_SetSize, iIDEnt, Float:{ -5.0, -5.0, -5.0 }, Float:{ 5.0, 5.0, 5.0 })         set_pev(iIDEnt, pev_solid, SOLID_BBOX)//SOLID_TRIGGER SOLID_BSP SOLID_SLIDEBOX     set_pev(iIDEnt, pev_movetype, MOVETYPE_TOSS)//MOVETYPE_FLY MOVETYPE_PUSH         set_pev(iIDEnt, pev_classname, g_szClassName)     set_pev(iIDEnt, pev_nextthink, fGameTime)     //dllfunc(DLLFunc_Think, iIDEnt)         set_task(10.0, "fwTaskEntRemove", iIDEnt) } public fwTaskEntRemove(const iIDEnt) {     if (!pev_valid(iIDEnt))         return;         engfunc(EngFunc_RemoveEntity, iIDEnt) }


All times are GMT -4. The time now is 17:55.

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