AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [:3] TF2_CTFWeaponInfo (https://forums.alliedmods.net/showthread.php?t=136837)

Andersso 10-03-2010 05:34

Re: [:3] TF2_CTFWeaponInfo
 
It's C++, not SourcePawn. You could use SDKHooks to change the weapon damage.

CrancK 10-03-2010 05:54

Re: [:3] TF2_CTFWeaponInfo
 
how could i use sdkhooks?
I guess you're thinking of OnTakeDamage or OnTakeDamagepost, but they only provide a solution if the damage i want to do is within the limits the ctx's provide, thus rocketlauncher cant do more then about 120 damage, and stickys about 140.
I can reduce the damage perfectly with sdkhooks, but if i tell it to do 400damage with any gun, it won't...

(or am i missing something?)

Andersso 10-03-2010 06:54

Re: [:3] TF2_CTFWeaponInfo
 
You should be able to go over the damage limitations, I'm not 100% in TF2 but it works in all other games. I don't see any reason why it would not work in TF2.

CrancK 10-03-2010 08:27

Re: [:3] TF2_CTFWeaponInfo
 
ok, i tested it again with sdkhooks, and although my first results proved in my favor, not everything was as i remembered.

basically, if you shoot yourself, while in contact with the ground, it works.
but if i'm in the air and shoot myself it doesn't... since there's a 40% damage reduction... which i should be able to fix... if i check wether the person is touching the ground and such...(do have to check if it also works this way on others though)

thanks.. i think i'll be able to get it done now

EDIT:
actually, after some more testing, i was right, though my original question appears to not have anything to do with damage. you see, i wanted more knockback from explosions, which i figured would be calculated from damage done... which is true... uptill full damage, and then it somehow doesn't go higher, like setting tf_damageforce_self_soldier to 1.0 (no damagereduction) gives you the max boost, but anymore is not attainable by damage or by upping that cvar further (and/or some other cvars)

ahwell since my problem probably hasn't got anything to do with this snippet anymore, i'll stop :P

Swixel 10-14-2010 22:56

Re: [:3] TF2_CTFWeaponInfo
 
Quote:

Originally Posted by CrancK (Post 1314434)
how do i use this in/for a plugin?

like, add everything before the CON_COMMAND and then make my own CON_COMMAND? (it simply looks completely different from the sourcepawn i've been using, so it looks quite confusing to me) is it possible to explain it somewhat, so i could understand and adapt it myself?

This is C++ for use in a plugin. If you simply wish to hurt someone, buff their health then hit them with multiple point_hurts. That can be done in Pawn.

Tauphi 10-16-2010 06:46

Re: [:3] TF2_CTFWeaponInfo
 
Quote:

Originally Posted by Tauphi (Post 1300627)
thanks a lot ... worked, too ... but now i get this error when i try to compile:
PHP Code:

1>extension.obj error LNK2001unresolved external symbol "class CBaseEntityList * g_pEntityList" (?g_pEntityList@@3PAVCBaseEntityList@@A)
1>fatal error LNK11201 unresolved externals 

do you know how to solve this?

Quote:

Originally Posted by Seta00 (Post 1300712)
You're not linking properly to HL2SDK.
http://wiki.alliedmods.net/Writing_e...ons#Link_Paths

And don't forget to #define GAME_DLL 1 before including.

I am still unable to compile it. I tried to add all .lib files in my project. I tried it with the lib files from the default SDK, from the sourcemod SDKs.

added them in Project Properties -> Linker -> Input -> Additional Dependencies

and

Project Properties -> VC++ Directories -> Library Directories

Could you show me your VS link path configuration?
Or do I need a special .lib file or so which doesnt exist by default?

Swixel 10-16-2010 18:44

Re: [:3] TF2_CTFWeaponInfo
 
There are a couple of issues with this code and it's unlikely the detours will work from what Wazz said alone (when I say unlikely, I mean I haven't managed to make it work, even with asherkin's help).

I integrated the structures/classes into my code some time ago ...

From VS2010
C++ -> Additional Includes
Code:

..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn;$(SOURCEMOD13)\public;$(HL2SDKOBVALVE);$(HL2SDKOBVALVE)\public;$(HL2SDKOBVALVE)\public\engine;$(HL2SDKOBVALVE)\public\game\server;$(HL2SDKOBVALVE)\public\tier0;$(HL2SDKOBVALVE)\public\tier1;$(MMSOURCE17)\core;$(MMSOURCE17)\public;$(MMSOURCE17)\core\sourcehook;%(AdditionalIncludeDirectories)
Linker -> Input
Code:

$(HL2SDKOBVALVE)\lib\public\tier0.lib;$(HL2SDKOBVALVE)\lib\public\tier1.lib;%(AdditionalDependencies)

ProdigySim 12-13-2010 17:42

Re: [:3] TF2_CTFWeaponInfo
 
Updated FileWeaponInfo_t for L4D2, along with L4D2's CCSWeaponInfo and CTerrorWeaponInfo...

Patch for FileWeapoInfo_t on hl2sdk-l4d2:
https://bugs.alliedmods.net/show_bug.cgi?id=4744
CCSWeaponInfo + CTerrorWeaponInfo:
PHP Code:

class CCSWeaponInfo : public FileWeaponInfo_t // 866 bytes
public:
    
float m_fMaxPlayerSpeed// 2192
    
int m_nWeaponType;  // 2196
    
int m_nTeam// 2200 // ANY = 0, TR = 2, CT = 3
    
float m_fBotAudiblerange// 2204
    
float m_fWeaponArmorRatio// 2208
    
int m_nCrosshairMinDistance// 2212
    
int m_nCrosshariDeltaDistance// 2216
    
bool m_bCanEquipWithShield// 2220
    
char m_aWrongTeamMsg[32]; // 2221
    
char m_aPlayerAnimationExtension[16]; // 2253
    
char m_aShieldViewModel[64]; // 2269
    
char m_aAddonModel[80]; // 2333
    
char m_aAddonAttachment[80]; // 2413
    
int m_nMuzzleFlashStyle// 2496 (not confirmed)
    
float m_fMuzzleFlashScale// 2500
    
int m_nPenetration// 2504
    
int m_nDamage// 2508
    
float m_fRange// 2512
    
float m_fRangeModifier// 2516
    
int m_nBullets// 2520
    
float m_fCycleTime// 2524
    
int m_nAccuracyQuadratic// 2528
    
float m_fAccuracyDivisor// 2532
    
float m_fAccuracyOffset// 2536
    
float m_fMaxInaccuracy// 2540
    
float m_fTimeToIdle// 2544
    
float m_fIdleInterval// 2548
    
float m_fNoiseFactor// 2552
    
int m_nBlackMarketPrice// 2556
    
int m_nBlackMarketPrice2// 2560
    
int m_nBlackMarketPreviousPrice// 2564 (not confirmed)
    
char m_aResponseRulesName[80]; // 2568
    
char m_aMuzzleFlashEffect_1stPerson[80]; // 2648
    
char m_aMuzzleFlashEffect_3rdPerson[80]; // 2728
    
char m_aEjectBrassEffect[80]; // 2808
    
char m_aDisplayName[80]; // 2888
    
char m_aDisplayNameAllCaps[80]; // 2968
    
int m_iTier// 3048
    
float m_fMusicDynamicSpeed// 3052
    
bool m_bNewInL4D2// 3056
    
bool m_bCSWeapon// 3057
};  

class 
CTerrorWeaponInfo : public CCSWeaponInfo 
public:
    
int m_iLoadoutSlots// 3060
    
float m_fMaxAutoAimDeflection1// 3064
    
float m_fMaxAutoAimRange1// 3068
    
float m_fWeaponAutoAimScale// 3072
    
float m_fVerticalPunch// 3076
    
float m_fHorizontalPunch// 3080
    
float m_fHorizontalPunchDirChance// 3084
    
float m_fSpreadPerShot// 3088
    
float m_fMaxSpread// 3092
    
float m_fSpreadDecay// 3096
    
float m_fMinDuckingSpread// 3100
    
float m_fMinStandingSpread// 3104
    
float m_fMinInAirSpread// 3108
    
float m_fMaxMovementSpread// 3112
    
float m_fPelletScatterPitch// 3116
    
float m_fPelletScatterYaw// 3120
    
float m_fUnknown// 3124
    
float m_fReloadDuration// 3128
    
float m_fDualReloadDuration// 3132
    
float m_fDeployDuration// 3136
    
float m_fDualDeployDuration// 3140
    
float m_fPenetrationNumLayers// 3144
    
float m_fPenetrationPower// 3148
    
float m_fPenetrationMaxDistance// 3152
    
float m_fCharacterPenetrationMaxDistance// 3156
    
float m_fGainRange// 3160
    
CUtlDict<const char*, unsigned shortm_tCharacterViewmodelAddon// 3164
    
char m_aViewModelDual[80]; // 3192
    
char m_aPlayerModelDual[80]; // 3272
    
char m_aAddonAttachment2[80]; // 3352 Why is this duplicated from 2413
    
Vector m_vAddonOffest// 3432 vector
    
Vector m_vAddonAngles// 3444 vector
    
char m_aWorldModel[80]; // 3456
}; 

Wazz's code for finding the database should still work. The sig seems fine to me for l4d2. I can't seem to make it work in windows, though. I probably typo'd something in the gamedata.


All times are GMT -4. The time now is 18:14.

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