Raised This Month: $ Target: $400
 0% 

Detecting func_breakable destruction. & Create breakable func_pushable.


Post New Thread Reply   
 
Thread Tools Display Modes
KWo
AMX Mod X Beta Tester
Join Date: Jul 2004
Location: Poland
Old 10-18-2006 , 12:50   Re: Detecting func_breakable destruction. & Create breakable func_pushable.
Reply With Quote #11

Code:
bool IsShootableBreakable (edict_t *pent)  // KWo - 08.02.2006 {    if (pent == NULL)       return (false);    return ( ( (FStrEq ("func_breakable", STRING (pent->v.classname))            && ( (pent->v.playerclass == 1) || (pent->v.health == 0)                 || ( (pent->v.health > 1) && (pent->v.health < 1000))                 || (pent->v.rendermode == 4) ) // KWo - 21.02.2006 - br. crates has rendermode 4                 || (FStrEq ("func_pushable", STRING (pent->v.classname))                   && (pent->v.spawnflags & SF_PUSH_BREAKABLE))))                && (pent->v.impulse == 0)                && (pent->v.takedamage > 0)                && !(pent->v.spawnflags & SF_BREAK_TRIGGER_ONLY) ); }
Here is the code in C++ from podbot mm to recognize breakable "func_breakable". Another thing is this - in info key values You can also check the material, the breakable is created based on - and there is something like unbreakable glass - which makes the "func_breakable" despite its name as unbreakable. Hope it can help You somehow.
__________________
The Fullpack of podbot mm V3B22 - 24 apr 2012!!! is available here.
The All-In-One 3.2a package - 02 jun 2013 (AMX X 1.8.2 [with ATAC 3.0.1b , CSDM2.1.3c beta, CM OE 0.6.5, podbot mm V3B22c and mm 1.20) is available here.
The newest Beta V3B23a (rel. 28 august 2018!!!) is available here.
KWo is offline
commonbullet
Veteran Member
Join Date: Oct 2005
Old 10-18-2006 , 16:35   Re: Detecting func_breakable destruction. & Create breakable func_pushable.
Reply With Quote #12

That message doesn’t inform the id of the broken entity.
So here’s an attempt, it gets the position and origin of the broken stuff; and finds the id of the entity.
Should work with no problems for func_breakables, since they’re usually not placed in the same origin. But it may also work ok with func_pushable (not included in code), since it checks pev->solid state.
Code:
#include <amxmodx> #include <fakemeta> public plugin_init() {     register_plugin("break_alert", "1.0", "commonbullet")     register_message(SVC_TEMPENTITY, "check_breakable")     } public check_breakable(msgid) {     if(get_msg_arg_int(1) != TE_BREAKMODEL)         return PLUGIN_CONTINUE         new Float:br_origin[3]     new Float:br_size[3]        new Float:tempvector[3]     new Float:health     new classname[32]     new ent     br_origin[0] = get_msg_arg_float(2)     br_origin[1] = get_msg_arg_float(3)     br_origin[2] = get_msg_arg_float(4)     br_size[0] = get_msg_arg_float(5)     br_size[1] = get_msg_arg_float(6)     br_size[2] = get_msg_arg_float(7)         while((ent = engfunc(EngFunc_FindEntityInSphere, ent, br_origin, 0))) {         pev(ent, pev_classname, classname, 31)         if(equal(classname, "func_breakable")) {             pev(ent, pev_health, health)             if(health > 0 && !(pev(ent, pev_spawnflags) & SF_BREAK_TRIGGER_ONLY))                 continue                        // breakable is still solid when this message is thrown             // so it'll block already broken entities             if(pev(ent, pev_solid) == SOLID_NOT)                 continue             fm_get_brush_entity_origin(ent, tempvector)             if(!equal_vector(tempvector, br_origin))                 continue             pev(ent, pev_size, tempvector)             if(!equal_vector(tempvector, br_size))                 continue                                    // ------ ADD HANDLE CODE... --------             client_print(0, print_chat, "Entity %d has been broken.", ent)             // ----------------------------------                         break         }     }     return PLUGIN_CONTINUE  } fm_get_brush_entity_origin(ent, Float:orig[3]) {     // converted to fm from engine stocks     new Float:Min[3]     new Float:Max[3]     pev(ent, pev_mins, Min)     pev(ent, pev_maxs, Max)         orig[0] = (Min[0] + Max[0]) * 0.5     orig[1] = (Min[1] + Max[1]) * 0.5     orig[2] = (Min[2] + Max[2]) * 0.5     return 1 } equal_vector(const Float:vector1[3], const Float:vector2[3]) {     return ((vector1[0] == vector2[0]) && (vector1[1] == vector2[1]) && (vector1[2] == vector2[2])) }

Conclusion: hooking entity prethink is a lot easier, don’t use this crap stuff.

Last edited by commonbullet; 10-19-2006 at 00:56.
commonbullet is offline
Send a message via ICQ to commonbullet Send a message via MSN to commonbullet
KWo
AMX Mod X Beta Tester
Join Date: Jul 2004
Location: Poland
Old 10-19-2006 , 06:15   Re: Detecting func_breakable destruction. & Create breakable func_pushable.
Reply With Quote #13

Yeah - I've forgot to say that edict_t *pent is passed to that function as tr.pHit from the traceline the bot is fireing and hits the obstacle. You have to know also the people are putting v.health as really big one (for example 1000000), so You don't have enough bullets in Your weapons to crash it. Also the parameter (pent->v.takedamage > 0) is important.
__________________
The Fullpack of podbot mm V3B22 - 24 apr 2012!!! is available here.
The All-In-One 3.2a package - 02 jun 2013 (AMX X 1.8.2 [with ATAC 3.0.1b , CSDM2.1.3c beta, CM OE 0.6.5, podbot mm V3B22c and mm 1.20) is available here.
The newest Beta V3B23a (rel. 28 august 2018!!!) is available here.

Last edited by KWo; 10-19-2006 at 06:17.
KWo is offline
commonbullet
Veteran Member
Join Date: Oct 2005
Old 10-19-2006 , 11:45   Re: Detecting func_breakable destruction. & Create breakable func_pushable.
Reply With Quote #14

hey KWo. I was referring to that message P34nut found in func_break.cpp. It’s only used when a breakable has been crashed, so he doesn’t need to know if it may break or not; unless he’s using prethink; in this case it would be better to check if it’s still solid.
commonbullet is offline
Send a message via ICQ to commonbullet Send a message via MSN to commonbullet
KWo
AMX Mod X Beta Tester
Join Date: Jul 2004
Location: Poland
Old 10-20-2006 , 05:04   Re: Detecting func_breakable destruction. & Create breakable func_pushable.
Reply With Quote #15

Ah - yes - the user was asking about detecting if the brekable is already broken or not. Note - I found some breakables they have at start v.health == 0, so another method posted by someone here to detect v.health <=0 will not work.

There is another flag - deadflag - which is saying the entity id death (breakable is broken).
// edict->deadflag values
#define DEAD_NO 0 // alive
#define DEAD_DYING 1 // playing death animation or still falling off of a ledge waiting to hit ground
#define DEAD_DEAD 2 // dead. lying still.
#define DEAD_RESPAWNABLE 3
#define DEAD_DISCARDBODY 4

So everything above 1 says it's already dead. I'm not sure if that SOLID is really changing or not. But that deadflag changes the status for sure (I was testing it).
__________________
The Fullpack of podbot mm V3B22 - 24 apr 2012!!! is available here.
The All-In-One 3.2a package - 02 jun 2013 (AMX X 1.8.2 [with ATAC 3.0.1b , CSDM2.1.3c beta, CM OE 0.6.5, podbot mm V3B22c and mm 1.20) is available here.
The newest Beta V3B23a (rel. 28 august 2018!!!) is available here.
KWo is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 08-11-2009 , 19:11   Re: Detecting func_breakable destruction. & Create breakable func_pushable.
Reply With Quote #16

Quote:
Originally Posted by KWo View Post
Code:
bool IsShootableBreakable (edict_t *pent)  // KWo - 08.02.2006 {    if (pent == NULL)       return (false);    return ( ( (FStrEq ("func_breakable", STRING (pent->v.classname))            && ( (pent->v.playerclass == 1) || (pent->v.health == 0)                 || ( (pent->v.health > 1) && (pent->v.health < 1000))                 || (pent->v.rendermode == 4) ) // KWo - 21.02.2006 - br. crates has rendermode 4                 || (FStrEq ("func_pushable", STRING (pent->v.classname))                   && (pent->v.spawnflags & SF_PUSH_BREAKABLE))))                && (pent->v.impulse == 0)                && (pent->v.takedamage > 0)                && !(pent->v.spawnflags & SF_BREAK_TRIGGER_ONLY) ); }
Here is the code in C++ from podbot mm to recognize breakable "func_breakable". Another thing is this - in info key values You can also check the material, the breakable is created based on - and there is something like unbreakable glass - which makes the "func_breakable" despite its name as unbreakable. Hope it can help You somehow.
Sorry to bring up an old thread, but I have question, will an entity work like a func_breakable (will be shootable) if the properties that are placed in this return (without the classnames) are assigned to it?
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 08-13-2009 , 10:25   Re: Detecting func_breakable destruction. & Create breakable func_pushable.
Reply With Quote #17

A respectful *bump*!
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 08-13-2009 , 10:35   Re: Detecting func_breakable destruction. & Create breakable func_pushable.
Reply With Quote #18

What you want to do
__________________
xPaw is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 08-13-2009 , 10:54   Re: Detecting func_breakable destruction. & Create breakable func_pushable.
Reply With Quote #19

Quote:
Originally Posted by xPaw View Post
What you want to do
The question ->

Quote:
Quote:
Originally Posted by KWo View Post
Code:
bool IsShootableBreakable (edict_t *pent)  // KWo - 08.02.2006 {    if (pent == NULL)       return (false);    return ( ( (FStrEq ("func_breakable", STRING (pent->v.classname))            && ( (pent->v.playerclass == 1) || (pent->v.health == 0)                 || ( (pent->v.health > 1) && (pent->v.health < 1000))                 || (pent->v.rendermode == 4) ) // KWo - 21.02.2006 - br. crates has rendermode 4                 || (FStrEq ("func_pushable", STRING (pent->v.classname))                   && (pent->v.spawnflags & SF_PUSH_BREAKABLE))))                && (pent->v.impulse == 0)                && (pent->v.takedamage > 0)                && !(pent->v.spawnflags & SF_BREAK_TRIGGER_ONLY) ); }
Here is the code in C++ from podbot mm to recognize breakable "func_breakable". Another thing is this - in info key values You can also check the material, the breakable is created based on - and there is something like unbreakable glass - which makes the "func_breakable" despite its name as unbreakable. Hope it can help You somehow.
Sorry to bring up an old thread, but I have question, will an entity work like a func_breakable (will be shootable) if the properties that are placed in this return (without the classnames) are assigned to it?
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
P34nut
AMX Mod X Beta Tester
Join Date: Feb 2006
Location: Netherlands
Old 08-13-2009 , 12:31   Re: Detecting func_breakable destruction. & Create breakable func_pushable.
Reply With Quote #20

I think that if you set the pev_spawnflags to SF_PUSH_BREAKABLE and pev_health to a value and pev_takedamage to 2 it should work.

Why dont you just try it?
__________________
All you need to change the world is one good lie and a river of blood
P34nut is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:51.


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