Raised This Month: $51 Target: $400
 12% 

Proper explosion dammage


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Author Message
urban_ninja
Senior Member
Join Date: Feb 2009
Old 07-21-2011 , 12:48   Proper explosion dammage
#1

Hey, I need help making explosion damage. Not just some generic damage method found through out these forums. I'm trying to make a serious game play plugin for team fortress classic that adds new unique class weapons. Could someone give me an example of how to make explosion damage that wont count as a suicide death and wont hurt teammates?

[Edit]Need some help here. Why is everyone ignoring this post. I see everyone elses posts in this help forum today are getting answered as I type this so why is this one getting skipped?
__________________

Last edited by urban_ninja; 07-21-2011 at 16:35.
urban_ninja is offline
Aykay
Senior Member
Join Date: Jul 2009
Location: Australia
Old 07-22-2011 , 04:03   Re: Proper explosion dammage
#2

This is a fake bomb code, maybe you can see how it's done?

PHP Code:
#include <hamsandwich>
#include <engine>
#include <cstrike>


public PlantFakeC4(id)
{
    if (!
has_fakec4_player[id])
    {
        
client_print(idprint_center"You only get 1 Fake Bomb!");
        return 
PLUGIN_CONTINUE;
    }
    
has_fakec4_player[id]--;
    
    new 
Float:origin[3];
    
entity_get_vector(idEV_VEC_originorigin);
        
    new 
ent create_entity("info_target");
    
entity_set_string(ent ,EV_SZ_classname"FakeC4");
    
entity_set_edict(ent ,EV_ENT_ownerid);
    
entity_set_int(entEV_INT_movetypeMOVETYPE_TOSS);
    
entity_set_origin(entorigin);
    
entity_set_int(entEV_INT_solidSOLID_BBOX);
    
entity_set_model(ent"models/w_backpack.mdl");
    
entity_set_size(ent,Float:{-16.0,-16.0,0.0},Float:{16.0,16.0,2.0});
    
    
drop_to_floor(ent);

    
entity_set_float(ent,EV_FL_nextthink,halflife_time() + 0.01) ;
    
    
set_rendering(ent,kRenderFxNone0,0,0kRenderTransTexture,255);
    
    return 
PLUGIN_CONTINUE;
}

public 
ExplodeFakeC4(entid)
{
    new 
attacker entity_get_edict(entEV_ENT_owner);
    if (
get_user_team(attacker) != get_user_team(id)) // this is the line you're looking for - it wont hurt himself or teammates.
    
{
        new 
Float:fOrigin[3], iOrigin[3];
        
entity_get_vectorentEV_VEC_originfOrigin);
        
iOrigin[0] = floatround(fOrigin[0]);
        
iOrigin[1] = floatround(fOrigin[1]);
        
iOrigin[2] = floatround(fOrigin[2]);
        
        
message_begin(MSG_BROADCAST,SVC_TEMPENTITYiOrigin);
        
write_byte(TE_EXPLOSION);
        
write_coord(iOrigin[0]);
        
write_coord(iOrigin[1]);
        
write_coord(iOrigin[2]);
        
write_short(sprite_blast);
        
write_byte(32); // scale
        
write_byte(20); // framerate
        
write_byte(0);// flags
        
message_end();
        new 
entlist[33];
        new 
numfound find_sphere_class(ent,"player"400.0 ,entlist32);
        
        for (new 
i=0numfoundi++)
        {        
            new 
pid entlist[i];
            
            if (!
is_user_alive(pid) || get_user_team(attacker) == get_user_team(pid))
                continue;
            
            
ExecuteHam(Ham_TakeDamagepidentattacker350.01);
        }
        
remove_entity(ent);
    }

__________________

Aykay is offline
Send a message via MSN to Aykay
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 07-22-2011 , 06:39   Re: Proper explosion dammage
#3

Not sure if it's gonna count as suicide or team kill but you can easily test it.
http://forums.alliedmods.net/showthread.php?t=142412
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
urban_ninja
Senior Member
Join Date: Feb 2009
Old 07-23-2011 , 20:44   Re: Proper explosion dammage
#4

PHP Code:
#include <cstrike> 
I appreciate you guys trying to help but how is counter strike functions going to be valid in team fortress classic as they are 2 totally different game mods?
__________________
urban_ninja is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 07-23-2011 , 22:14   Re: Proper explosion dammage
#5

Cstrike isn't required in the code above.
You can safely remove it.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
urban_ninja
Senior Member
Join Date: Feb 2009
Old 07-23-2011 , 22:57   Re: Proper explosion dammage
#6

Ok I'm getting compiler errors with that code.
Quote:
undefined symbol "has_fakec4_player"
So I added
PHP Code:
new has_fakec4_player 
Even more compiler errors follow:
Quote:
invalid subscript<not an array or too many subscripts>"has_fakec4_player"
expected token ";" but found "]"
fatal error too many errors on one line
invalid expression assumed as zero
All errors had to do with
PHP Code:
if (!has_fakec4_player[id]) 
__________________
urban_ninja is offline
Aykay
Senior Member
Join Date: Jul 2009
Location: Australia
Old 07-23-2011 , 23:52   Re: Proper explosion dammage
#7

Quote:
Originally Posted by urban_ninja View Post
Ok I'm getting compiler errors with that code.
So I added
PHP Code:
new has_fakec4_player 
Even more compiler errors follow:
All errors had to do with
PHP Code:
if (!has_fakec4_player[id]) 
It's definitely an array, but it might be a bool.

Try
PHP Code:
new bool:has_fakec4_player[32];

;OR

new 
has_fakec4_player[32]; 
I can't find the code, so can't confirm.
__________________

Aykay is offline
Send a message via MSN to Aykay
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 07-24-2011 , 01:04   Re: Proper explosion dammage
#8

The plugin above is not entirely what you're looking for. It provides an example for the explosion itself and the damage it deals, however it is also managing the concept of having a fake bomb. The code you're having problems with is not needed in your case because it is related to that concept.

The only thing you should be taking from that is code within ExplodeFakeC4(). The planting function has little to no involvement with your new weapons idea.
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
urban_ninja
Senior Member
Join Date: Feb 2009
Old 07-24-2011 , 01:27   Re: Proper explosion dammage
#9

Ok that fix that error and a few others but now theres yet an other compiler error saying this is an empty statement.
PHP Code:
if (!has_fakec4_player[id]); 
And its alos giving a "warning <unreachable code>" for this
PHP Code:
has_fakec4_player[id]--; 
__________________
urban_ninja is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 07-24-2011 , 01:28   Re: Proper explosion dammage
#10

You don't need either of those lines.

Like I said, you only need the code snippets used within ExplodeFakeC4().
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Closed Thread



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 08:03.


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