Raised This Month: $54 Target: $400
 13% 

Make entity breakable


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sebxx4
Member
Join Date: Feb 2013
Old 09-25-2022 , 10:19   Make entity breakable
Reply With Quote #1

Hello.
I have a KillStreak plugin for cod servers. There is one of option in it that creates a user-controlled predator missle. Below the code that creates it.
I would like to modify it to make it has eg 50HP. I mean, make this missle breakable via gun or something. Could someone give me a hand with it, please?

PHP Code:
public CreatePredator(id)
{
    if ( !
is_valid_ent(id) )
        return; 

    new 
numplayers[32];
    
get_players(playersnum"gh");
    for(new 
0numa++)
    {
        new 
players[a];
        if(
cs_get_user_team(id) != cs_get_user_team(i))
            
client_cmd(i"spk sound/mw/predator_enemy.wav");
        else
            
client_cmd(i"spk sound/mw/predator_friend.wav");
    }
    
print_info(id"Predator Missle");

    new 
Float:Origin[3], Float:Angle[3], Float:Velocity[3], ent;
    
    
velocity_by_aim(id700Velocity);

    if ( !
is_valid_ent(id) )
        return;

    
entity_get_vector(idEV_VEC_originOrigin);
    
entity_get_vector(idEV_VEC_v_angleAngle);
    
    
Angle[0] *= -1.0;
    
    
ent create_ent(id"predator""models/cod_predator.mdl"25Origin);
    
    
entity_set_vector(entEV_VEC_velocityVelocity);
    
entity_set_vector(entEV_VEC_anglesAngle);
    
    
message_begin(MSG_BROADCASTSVC_TEMPENTITY);
    
write_byte(TE_BEAMFOLLOW);
    
write_short(ent);
    
write_short(cache_trail);
    
write_byte(10);
    
write_byte(5);
    
write_byte(205);
    
write_byte(237);
    
write_byte(163);
    
write_byte(200);
    
message_end();

    
licznik_zabic[id] -= predator_steps[id];

    if ( 
licznik_zabic[id] < )
        
licznik_zabic[id] = 0

    
if ( licznik_zabic[id] < predator_steps[id] )
        
predator[id] = false;
    
    
attach_view(ident);
    
user_controll[id] = ent;

sebxx4 is offline
Old 09-26-2022, 01:50
000
This message has been deleted by 000.
sebxx4
Member
Join Date: Feb 2013
Old 09-26-2022 , 09:24   Re: Make entity breakable
Reply With Quote #2

I tried add set_pev(ent, pev_health, 100.0); and set_pev(ent, pev_takedamage, DAMAGE_YES); but it doesn't work.
sebxx4 is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 09-26-2022 , 15:36   Re: Make entity breakable
Reply With Quote #3

probably it should be func_breakable

this will help by
Arkshine: https://forums.alliedmods.net/showpo...0&postcount=10
Klippy: https://forums.alliedmods.net/showpo...91&postcount=8
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...)

Last edited by JocAnis; 09-26-2022 at 15:38.
JocAnis is offline
sebxx4
Member
Join Date: Feb 2013
Old 09-27-2022 , 13:13   Re: Make entity breakable
Reply With Quote #4

Well, I think in my case there is engine used, and yours is fakemeta.
Maybe could someone have a look at the original plugin? I totally dont know how to deal with entities and it's the last one thing left me to do.
Attached Files
File Type: sma Get Plugin or Get Source (killstreak-bez.sma - 11 views - 37.6 KB)

Last edited by sebxx4; 09-27-2022 at 13:14.
sebxx4 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-27-2022 , 16:38   Re: Make entity breakable
Reply With Quote #5

Set entity <model>
Set entity <size>
Set entity <takedamage>
Set entity <Health>
__________________
@Jailbreak Main Mod v2.6.6 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
sebxx4
Member
Join Date: Feb 2013
Old 09-29-2022 , 04:39   Re: Make entity breakable
Reply With Quote #6

So, first I tried to rip out the missle code to another plugin, this is what I got:
PHP Code:
#include <amxmodx>
#include <engine>

new user_controll[33];

public 
plugin_init() 
{
    
register_plugin("test""1.0""Sebxx");
    
register_touch("predator""*""touchedpredator");
    
register_clcmd("say /test""CreatePredator");
}

public 
plugin_precache()
{
    
precache_model("models/cod_predator.mdl");
}

public 
CreatePredator(id)
{
    new 
Float:Origin[3], Float:Angle[3], Float:Velocity[3], ent;
    
    
velocity_by_aim(id700Velocity);

    if ( !
is_valid_ent(id) )
        return;

    
entity_get_vector(idEV_VEC_originOrigin);
    
entity_get_vector(idEV_VEC_v_angleAngle);
    
    
Angle[0] *= -1.0;
    
    
ent create_entity("func_breakable");
    
DispatchKeyValue(ent"health"1);
    
DispatchKeyValue(ent"material""6");
    
entity_set_string(entEV_SZ_classname"predator");
    
entity_set_model(ent"models/cod_predator.mdl");
    
entity_set_float(entEV_FL_takedamageDAMAGE_YES);
    
entity_set_int(entEV_INT_solidSOLID_SLIDEBOX);
    
entity_set_int(entEV_INT_movetypeMOVETYPE_TOSS);
    
entity_set_edict(entEV_ENT_ownerid);
    
entity_set_origin(entOrigin);
    
    
entity_set_vector(entEV_VEC_velocityVelocity);
    
entity_set_vector(entEV_VEC_anglesAngle);
    
    
attach_view(ident);
    
user_controll[id] = ent;


public 
touchedpredator(entid)
{
    new 
owner entity_get_edict(entEV_ENT_owner);
    
attach_view(ownerowner);
    
user_controll[owner] = 0;

    return 
PLUGIN_CONTINUE;
}

public 
client_PreThink(id)
{   
    if(
user_controll[id])
    {
        new 
ent2 user_controll[id];

        if(
is_valid_ent(ent2))
        {
            new 
Float:Velocity[3], Float:Angle[3];
            
velocity_by_aim(id500Velocity);

            if ( !
is_valid_ent(id) )
                return 
PLUGIN_CONTINUE;

            
entity_get_vector(idEV_VEC_v_angleAngle);
            
            
entity_set_vector(ent2EV_VEC_velocityVelocity);
            
entity_set_vector(ent2EV_VEC_anglesAngle);
        }
        else
            
attach_view(idid);
    }

    return 
PLUGIN_CONTINUE;

It basicly works, I can control the missle and view is attached back to player after collision with something. I tried to change a few things, set it's HP to 1, but still cannot shoot this missle down :/
Could somebody have a look at it?
Attached Files
File Type: zip model.zip (67.3 KB, 8 views)
sebxx4 is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 09-29-2022 , 05:36   Re: Make entity breakable
Reply With Quote #7

you haven't set size
__________________
My plugin:
Celena Luna is offline
sebxx4
Member
Join Date: Feb 2013
Old 09-29-2022 , 06:50   Re: Make entity breakable
Reply With Quote #8

Yeah, right. So, what size to set? Or how can I check model size?

Last edited by sebxx4; 09-29-2022 at 11:06.
sebxx4 is offline
sebxx4
Member
Join Date: Feb 2013
Old 09-29-2022 , 12:00   Re: Make entity breakable
Reply With Quote #9

EDIT:
Well, I changed something and now it seems to work. But there's another problem.
I can destory this entity, but only when shooting in one specific point of this model. I think it's "bone"? Just look at the model I attached before. There are no hitboxes, just some dot in the place I have to shoot to destroy entity.

How can I deal with it?
sebxx4 is offline
sebxx4
Member
Join Date: Feb 2013
Old 10-01-2022 , 02:46   Re: Make entity breakable
Reply With Quote #10

Nobody?
sebxx4 is offline
Reply


Thread Tools
Display Modes

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 22:52.


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