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

Improving WeaponMod


Post New Thread Reply   
 
Thread Tools Display Modes
SeriousSam
Senior Member
Join Date: Aug 2009
Location: Bulgaria
Old 09-04-2010 , 09:34   Re: Improving WeaponMod
Reply With Quote #21

I changed the part in the damage_user function that checks if the victim is a teammate to check if the victim is different from the attacker as well, thus enabling you to cause damage to yourself, then I tested it with the grenade launcher, shooting a grenade at my legs. The first grenade left me to 40 hp / 70 armor, but the second and all after that didn't cause any damage to me. I'm also wondering why do explosives kill in one direct hit an enemy that has 100 hp, when I've set them do to 96.0 damage.

EDIT: I edited the kill_user function the same way, and now finally I can kill myself with a grenade in the feet, yet still I'm not happy with the way explosion damage is calculated. As I said, I've set all my explosive weapons to do 96 damage in 200.0 radius, which I think is about the same as the original HE grenades. Yet, a direct hit to the enemy or a grenade exactly at my feet is a one hit kill, and if it is a bit further it does exactly 60 damage, something's not right here. I'll update on the first page that now explosions cause damage to the user as well

@Arkshine:Why do bullets in your code go through that thick pile of crates? In my code, I check for StartSolid on the third traceline to see if the point, that in my case is 32 units not 8, so that I know if that point is outside a wall or inside, and if it's outside, I proceed with the 4th traceline and bullet hit, if not, the bullet doesn't pierce the wall I first tried to make it with AllSolid on the 2nd traceline as you told me, but it seems to not work this way, so I guess I'll keep it like that. I like your compact optimised code, it probably takes less resources than mine I think I'll use the same method for my .50 cal sniper rifle to pierce through 3 enemies like the awp, it should work I think. But first I want to fix the explosion damage bug
__________________

Last edited by SeriousSam; 09-04-2010 at 10:12.
SeriousSam is offline
Send a message via Skype™ to SeriousSam
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-04-2010 , 10:29   Re: Improving WeaponMod
Reply With Quote #22

It's a bad idea to do like you say because you don't know what is behind the wall nor how the map structure is. That's why it's better to start inside the wall and see if the trace got out of the wall, if so it means there is some space.
__________________

Last edited by Arkshine; 09-04-2010 at 10:41.
Arkshine is offline
Brreaker
Senior Member
Join Date: Oct 2009
Location: Constanta, Romania
Old 09-04-2010 , 11:10   Re: Improving WeaponMod
Reply With Quote #23

Because, AFAIK, if behind that wall is nothing(end of map) you mai get an error by getting an entity out of bounderies...
Also a sniper that could go through 5 persons, but with very high recoil and low fire speed would be nice, like Barrett M-107 that fires 50 caliber bullets, and it's able to see over 2 000 meters...I will look after the model
__________________
There are 10 kinds of people.Those who understand binary, and those who don't.
Also, for those who understand binary, there is a donation tab too!
No steam || PM support!
Brreaker is offline
Send a message via MSN to Brreaker Send a message via Yahoo to Brreaker
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 09-04-2010 , 12:50   Re: Improving WeaponMod
Reply With Quote #24

Quote:
Well I have merged few w_ models into 1, hooked FM_SetModel and setted right w_ model body using EV_INT_body.But how to do the same with p_ models(I already merged them, but I dont know how set right model bodypart ) ? I cant do entity_set_int( Player, EV_INT_body, ? ), right ?
Any help would be appreciated
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
SeriousSam
Senior Member
Join Date: Aug 2009
Location: Bulgaria
Old 09-04-2010 , 13:16   Re: Improving WeaponMod
Reply With Quote #25

Quote:
Originally Posted by Brreaker View Post
Because, AFAIK, if behind that wall is nothing(end of map) you mai get an error by getting an entity out of bounderies...
Also a sniper that could go through 5 persons, but with very high recoil and low fire speed would be nice, like Barrett M-107 that fires 50 caliber bullets, and it's able to see over 2 000 meters...I will look after the model
I think that if I check the trace begining at 32 units behind the start of the wall for startsolid, that will tell if there is space or not, and that way I also decide if it's thin enough for the bullet to go through - 1 shot, 2 hits
I wrote somewhere in this topic about it, but I already have an 10x zoom Barett M82A1 .50cal semi-automatic sniper, it's faster than awp as it is semi-automatic, but I've added a lot of recoil so you can't really fire it at its highest speed if you actually want to score a hit. I'm already thinking of making it shoot a few victims in a row, and I already made it to gib victims, although I can't make the gibs stay till the end of the round. Check the video on the first page if you haven't yet
__________________
SeriousSam is offline
Send a message via Skype™ to SeriousSam
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-04-2010 , 14:40   Re: Improving WeaponMod
Reply With Quote #26

@NiHiLaNTh : http://forums.alliedmods.net/showpos...2&postcount=86

@SS : Did you read what I said ? It seems not.
__________________
Arkshine is offline
SeriousSam
Senior Member
Join Date: Aug 2009
Location: Bulgaria
Old 09-06-2010 , 19:12   Re: Improving WeaponMod
Reply With Quote #27

I got the server running online a few minutes ago, you can now come check out how the weapons behave so that you have a better idea where I need help. You can find the server on my signature. I have some exams now, so I don't have time to work on improvements for the time being.

@Arkshine: I think I finally start to get what you mean, the first time you explained in the previous thread I understood it in another way, after the exams I'll try implementing your code.

EDIT: I think my final buysystem menu will be like this:
Code:
WeaponMod Menu:

1.SIDEARMS
2.SHOTGUNS
3.SUB-MACHINE GUNS
4.ASSAULT RIFLES
5.SNIPER RIFLES
6.BIG GUNS

8.REFILL AMMO

0.EXIT

Counter-Terrorists-------------------------------

SIDEARMS
1.akimbo Colt M1911
2.akimbo Glock 18
3.akimbo Taurus Raging Bull

SHOTGUNS
1.Franchi SPAS-12
2.USAS-12

SUB-MACHINE GUNS
1.akimbo TMP
2.akimbo HK MP-5KA4
3.HK MP-5SD5
4.HK MP-7A1 PDW

ASSAULT RIFLES
1.GIAT FA-MAS G2
2.Colt M16A1/M203
3.Colt M4A1 CQB
4.Steyr Aug A3
5.FN SCAR-GH
6.XM-29 OICW
7.IMI Tavor CTAR-21

SNIPER RIFLES
1.HK PSG-1
2.HK 417 Sniper
3.CheyTac M-200 Intervention

BIG GUNS
1.XM-8 LMG
2.M60 PIG
3.M-134 Minigun
4.Barett M82A3
5.RG-6 grenade launcher
6.M72 LAW

Terrorists--------------------------------------

SIDEARMS
1.Beretta M92FS Inox
2.akimbo Glock 18
3.akimbo Taurus Raging Bull

SHOTGUNS
1.Franchi SPAS-12
2.Saiga 12k

SUB-MACHINE GUNS
1.akimbo Scorpion
2.akimbo IMI MiniUZI
3.TDI Vector
4.HK MP-7A1 PDW

ASSAULT RIFLES
1.AK-74/GP30
2.FN FAL
3.FN SCAR-GH
4.FN F2000/EGPL
5.HK G11
6.HK G36
7.XM-8

SNIPER RIFLES
1.IMI GALATZ
2.Снайперская Винтовка Драгунова
3.CheyTac M-200 Intervention

BIG GUNS
1.XM-8 LMG
2.M60 PIG
3.M-134 Minigun
4.Barett M82A3
5.RG-6 grenade launcher
6.M72 LAW
38 new guns + the 26 original firearms = 64 guns in cs !!! You get now why I want to make this, don't you
I wonder if I should just use a separate function for each submenu, it might be a little bit faster this way and easier for me My exams end in 3 days, then I'm gonna work hard to make this work
__________________

Last edited by SeriousSam; 09-08-2010 at 20:57.
SeriousSam is offline
Send a message via Skype™ to SeriousSam
SeriousSam
Senior Member
Join Date: Aug 2009
Location: Bulgaria
Old 09-09-2010 , 03:18   Re: Improving WeaponMod
Reply With Quote #28

I'm bumping to announce that I'll be working again on this. My last exam is tomorrow, so I want to ask something now, so that I might have an answer already when I return.

As you can see, I'm adding a XM-29 O.I.C.W. It is an assault rifle and airburst grenade launcher combined with a 6x sight, that as well acts as night vision and thermal sight. Cool, eh? I've desided that bullet fire will be on primary attack event, and zoom will be on secondary attack event. I also think about adding a console command, that can be binded to a key, for example V, that changes fire modes - auto, burst, semi-auto and grenade launcher. I also think about adding 2 commands that can be binded to - and = keys for example for setting the airburst range (from 3m to -3m). I want to add a laser point on the wall I'm aiming with the airburst launcher, so I want to ask how to do it, and I want to ask how to make the night vision turn on when I zoom in and off when I zoom out, if possible without buying nvg. And I want to ask if there is a way and if so how to make it a thermal scope as well (black and white picture only, all living things colored in bright white, see them through smoke). Thanks.
__________________
SeriousSam is offline
Send a message via Skype™ to SeriousSam
SeriousSam
Senior Member
Join Date: Aug 2009
Location: Bulgaria
Old 09-11-2010 , 12:20   Re: Improving WeaponMod
Reply With Quote #29

Check this out:
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <weaponmod>
#include <weaponmod_stocks>
#include <wmodimprov>

#define PLUGIN "HK 417 Sniper"
#define VERSION "1.0"
#define AUTHOR "SeriousSamBG"

// Weapon information
new WPN_NAME[] = "HK 417 Sniper";
new 
WPN_SHORT[] = "hk417";

// Model information
new P_MODEL[] = "models/CS17/p_hk417.mdl";
new 
V_MODEL[] = "models/CS17/v_hk417.mdl";
new 
W_MODEL[] = "models/CS17/w_hk417.mdl";

new 
s_FIRE_1[] = "weapons/CS17/hk417-fire.wav";
new 
s_ZOOM[] = "weapons/zoom.wav";

// Weapon's defines
#define RELOAD_TIME 3.0
#define RECOIL1 16.0
#define REFIRE1_RATE 0.25
#define REFIRE2_RATE 0.06
#define RUN_SPEED 210.0
#define CLIP_AMMO 20
#define TOTAL_AMMO 100
#define WPN_COST 5500
#define BULLET_PER_SHOT 1
#define DMG_PER_BULLET_MAX 77
#define DMG_PER_BULLET_MIN 74
#define ACCURACY 2.0
#define ACCURACY_MIN 0.2
#define ARMOR_PENETRATION 1.21
#define DISTANCE_MULTIPLIER 1.16

// Sequences
enum
{
    
anim_idle_unsil,
    
anim_shoot1_unsil,
    
anim_shoot2_unsil,
    
anim_reload_unsil,
    
anim_deploy_unsup
}

// Variables
new g_wpnid;
new 
g_MaxPlayers;
new 
Float:gtime[33] = 0.0;
new 
g_ZoomACT[33];
new 
g_ZoomPercent[33];
new 
ponter[33];
new 
Float:prev_shots[8][33];

public 
plugin_precache()
{
    
precache_model(P_MODEL);
    
precache_model(V_MODEL);
    
precache_model(W_MODEL);
    
    
precache_sound(s_FIRE_1);
    
precache_sound(s_ZOOM);
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
create_weapon();
}

create_weapon()
{
    new 
wpnid wpn_register_weapon(WPN_NAME,WPN_SHORT);
    if(!
wpnid) return PLUGIN_CONTINUE;
    
    
wpn_set_string(wpnidwpn_viewmodelV_MODEL);
    
wpn_set_string(wpnidwpn_weaponmodelP_MODEL);
    
wpn_set_string(wpnidwpn_worldmodelW_MODEL);
    
    
wpn_register_event(wpnidevent_attack1"ev_attack1");
    
wpn_register_event(wpnidevent_attack2"ev_attack2");
    
wpn_register_event(wpnidevent_draw"ev_draw");
    
wpn_register_event(wpnidevent_reload"ev_reload");
    
    
wpn_set_float(wpnidwpn_refire_rate1REFIRE1_RATE);
    
wpn_set_float(wpnidwpn_refire_rate2REFIRE2_RATE);
    
wpn_set_float(wpnidwpn_reload_timeRELOAD_TIME);
    
wpn_set_float(wpnidwpn_run_speedRUN_SPEED);
    
    
wpn_set_integer(wpnidwpn_ammo1CLIP_AMMO);
    
wpn_set_integer(wpnidwpn_ammo2TOTAL_AMMO);
    
wpn_set_integer(wpnidwpn_bullets_per_shot1BULLET_PER_SHOT);
    
wpn_set_integer(wpnidwpn_bullets_per_shot20);
    
wpn_set_integer(wpnidwpn_costWPN_COST);
    
    
g_wpnid wpnid;
    return 
PLUGIN_CONTINUE;
}

public 
ev_attack1(id)

    if (
gtime[id] < (get_gametime() - 0.5))
    { 
        
wpn_playanim(idrandom_num(anim_shoot1_unsilanim_shoot2_unsil));
        
emit_sound(idCHAN_WEAPONs_FIRE_11.0ATTN_NORM0PITCH_NORM);
        if (
g_ZoomACT[id] == 0)
        {
            
wpn_bullet_shot2(g_wpnidid0,random_num(DMG_PER_BULLET_MINDMG_PER_BULLET_MAX),ACCURACYACCURACY_MIN*6ARMOR_PENETRATIONDISTANCE_MULTIPLIER);
            
custom_recoil(id);
            
client_cmd(id"-attack");
        }
        else
        {
            
wpn_bullet_shot2(g_wpnidid0,random_num(DMG_PER_BULLET_MINDMG_PER_BULLET_MAX),ACCURACYACCURACY_MINARMOR_PENETRATIONDISTANCE_MULTIPLIER);
            
custom_recoil(id);
            
client_cmd(id"-attack");
        }
    }
    else
    {
        new 
usrwpn wpn_has_weapon(id,g_wpnid);
        
wpn_set_userinfo(id,usr_wpn_ammo1,usrwpn,wpn_get_userinfo(id,usr_wpn_ammo1,usrwpn)+1);
    }
    return 
PLUGIN_CONTINUE;
}

public 
ev_attack2(id)
{
    if(((
g_ZoomACT[id]==0) || (g_ZoomACT[id]==1)) && (g_ZoomPercent[id] > 18))
    {    
        
g_ZoomPercent[id] = (g_ZoomPercent[id] <= 18) ? 18 g_ZoomPercent[id]-3;
        
wpn_set_user_zoom(idg_ZoomPercent[id]);
        
ShowZoomPercent(id);
        
emit_sound(idCHAN_WEAPONs_ZOOM1.0ATTN_NORM0PITCH_NORM);
        
g_ZoomACT[id] = 1;
    }
    else if((
g_ZoomACT[id]==1) && (g_ZoomPercent[id] <= 18))
    {
        
g_ZoomACT[id] = 2;
        
emit_sound(idCHAN_WEAPONs_ZOOM1.0ATTN_NORM0PITCH_NORM);
        
client_cmd(id"-attack2");
    }
    else
    {
        
emit_sound(idCHAN_WEAPONs_ZOOM1.0ATTN_NORM0PITCH_NORM);
        
wpn_set_user_zoom(id90);
        
ShowNoZoomPercent(id);
        
g_ZoomACT[id] = 0;
        
g_ZoomPercent[id] = 45;
        
client_cmd(id"-attack2");
    }
    
    return 
PLUGIN_CONTINUE;
}

ShowZoomPercent(id)

    new 
zoom[51]; 
    
formatex(zoom50"Zoom: %.1fx"90.0/float(g_ZoomPercent[id]));

    
message_begin(MSG_ONEget_user_msgid("StatusText"), {0,0,0}, id);
    
write_byte(0);
    
write_string(zoom);
    
message_end();


ShowNoZoomPercent(id)

    
message_begin(MSG_ONEget_user_msgid("StatusText"), {0,0,0}, id);
    
write_byte(0);
    
message_end();


custom_recoil(id)
{
    static 
Float:recoil[3];
    static 
Float:ctime;
    static 
Float:hk_recoil[33];
    static 
indx;
    static 
shotsCount[33];
    
    
ctime get_gametime();
    if(
ponter[id] == 8ponter[id] = 0;
    
prev_shots[ponter[id]++][id] = ctime;
    
shotsCount[id] = 0;
    for (
indx 0indx 8; ++ indx)
    {
        if (
prev_shots[indx][id] == 0.0) break;
        if (
prev_shots[indx][id] > (ctime 1.0)) ++shotsCount[id];
    }
    
hk_recoil[id] = RECOIL1*(shotsCount[id]/8.0);
                    
    
recoil[0] = -hk_recoil[id];    // up - down
    
recoil[1] = random_float(hk_recoil[id]/4.0, - (hk_recoil[id]/4.0));    // right - left
    
recoil[2] = 0.0// Screen rotation
                    
    
set_pev(idpev_punchanglerecoil);
}

public 
ev_draw(id)
{
    
wpn_playanim(idanim_deploy_unsup);
    
wpn_set_user_zoom(id90);
    
g_ZoomACT[id] = 0;
    
g_ZoomPercent[id] = 45;
    
gtime[id] = get_gametime();
    
    return 
PLUGIN_CONTINUE;
}

public 
ev_reload(id)
{
    
wpn_playanim(idanim_reload_unsil);
    
wpn_set_user_zoom(id90);
    
g_ZoomPercent[id] = 45;
    
g_ZoomACT[id] = 0;
    
    return 
PLUGIN_CONTINUE;
}

public 
client_connect(id)
{
    
wpn_set_user_zoom(id90);
    
g_ZoomACT[id] = 0;
    
g_ZoomPercent[id] = 45;
    
    return 
PLUGIN_CONTINUE;

This is the code of my semi-automatic sniper. I've set it to zoom-in smoothly, but, if I don't zoom to the max 5x zoom and release the secondary attack button, the next time I press it, it continues to zoom-in, but I want it to reset the zoom. Right now, when it zooms-in to the max 5x zoom it stops zooming-in, and the next button press resets the zoom.
How to make it to reset the zoom before it zooms-in to the max 5x zoom if I release the button and press it again? (Hint: look at ev_attack2 function)
__________________

Last edited by SeriousSam; 09-11-2010 at 12:25.
SeriousSam is offline
Send a message via Skype™ to SeriousSam
Storas1337
Senior Member
Join Date: Apr 2009
Location: Lithuania
Old 09-14-2010 , 15:50   Re: Improving WeaponMod
Reply With Quote #30

maybe you know how to make clases with created weapons?
Storas1337 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 17:29.


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