Raised This Month: $ Target: $400
 0% 

[bug] t-800 + darth maul


Post New Thread Reply   
 
Thread Tools Display Modes
vittu
SuperHero Moderator
Join Date: Oct 2004
Location: L.A. County, CA
Old 03-11-2011 , 14:23   Re: [bug] t-800 + darth maul
Reply With Quote #21

Well I originally thought of doing it that way, but then thought with multiple weapons a it would be better to check in switch_model. But then again there aren't really many of those so which would you guys prefer?

Use pawn or small tags to display entire code, ie:
[PAWN]code...[/PAWN]
[SMALL]code...[/SMALL]

Code:
// DARTH MAUL! evil Sith apprentice from Star Wars - Episode I: The Phantom Menace. Double Bladed Lightsaber is his trademark. /* CVARS - copy and paste to shconfig.cfg //Darth Maul darth_level 6 darth_healpoints 10     // the #of HP healed per second darth_knifespeed 400        // speed of Darth Maul in knife mode darth_knifemult 2.70        // multiplier for knife damage... */ /* * v1.4 - vittu - 3/10/11 *      - Changed model change method to use Ham_Item_Deploy instead of the CurWeapon event. * * v1.3 - vittu - 3/8/11 *      - Updated to SH 1.2.0.14 or above. *      - Added define to disable use of weapon models. * * v1.2 - vittu - 6/19/05 *      - Minor code clean up. *      - Added p_ knife model. * * v1.1 - vittu - 12/21/04 *      -SH mod 1.17.6 and up only *      -Model name and location changed (to follow new standard) *      -Also only needed one of the models not both (deleted useless second model) *      -Now heals past 100hp if you have more *      -Fixed extra speed to use knife * *   Darth Maul based on {HOJ}Batman's wolverine hero which is where most of the credit should go */ //---------- User Changeable Defines --------// // Comment out to force not using the model, will result in a very small reduction in code/checks // Note: If you change anything here from default setting you must recompile the plugin #define USE_WPN_MODEL //------- Do not edit below this point ------// #include <superheromod> // GLOBAL VARIABLES new gHeroID new bool:gHasDarthMaul[SH_MAXSLOTS+1] new gPcvarHealPoints #if defined USE_WPN_MODEL     new const gModelKnifeV[] = "models/shmod/darthmaul_knife.mdl"     new const gModelKnifeP[] = "models/shmod/darthmaul_p_knife.mdl"     new bool:gModelLoaded #endif //---------------------------------------------------------------------------------------------- public plugin_init() {     // Plugin Info     register_plugin("SUPERHERO Darth Maul", "1.4", "Chivas2973")     // DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG     new pcvarLevel = register_cvar("darth_level", "6")     new pcvarKnifeSpeed = register_cvar("darth_knifespeed", "400")     new pcvarKnifeMult = register_cvar("darth_knifemult", "2.70")     gPcvarHealPoints = register_cvar("darth_healpoints", "10")     // FIRE THE EVENT TO CREATE THIS SUPERHERO!     gHeroID = sh_create_hero("Darth Maul", pcvarLevel)     sh_set_hero_info(gHeroID, "Sith Lightsaber & Regen", "Get a Sith Double Bladed Lightsaber with more Damage and Speed, also regenerate HP")     sh_set_hero_speed(gHeroID, pcvarKnifeSpeed, {CSW_KNIFE})     sh_set_hero_dmgmult(gHeroID, pcvarKnifeMult, CSW_KNIFE) #if defined USE_WPN_MODEL     // REGISTER EVENTS THIS HERO WILL RESPOND TO!     if ( gModelLoaded ) {         RegisterHam(Ham_Item_Deploy, "weapon_knife", "Ham_Knife_Deploy_Post", 1)     } #endif     // HEAL LOOP     set_task(1.0, "darth_loop", _, _, _, "b") } //---------------------------------------------------------------------------------------------- #if defined USE_WPN_MODEL public plugin_precache() {     // Method servers 2 purposes, moron check and optional way to not use the model     // Seperate checks so the model that is missing can be reported     gModelLoaded = true     if ( file_exists(gModelKnifeV) ) {         precache_model(gModelKnifeV)     }     else {         sh_debug_message(0, 0, "Aborted loading ^"%s^", file does not exist on server", gModelKnifeV)         gModelLoaded = false     }     if ( file_exists(gModelKnifeP) ) {         precache_model(gModelKnifeP)     }     else {         sh_debug_message(0, 0, "Aborted loading ^"%s^", file does not exist on server", gModelKnifeP)         gModelLoaded = false     } } #endif //---------------------------------------------------------------------------------------------- public sh_hero_init(id, heroID, mode) {     if ( gHeroID != heroID ) return     switch(mode) {         case SH_HERO_ADD: {             gHasDarthMaul[id] = true #if defined USE_WPN_MODEL             if ( gModelLoaded && get_user_weapon(id) == CSW_KNIFE ) {                 switch_model_knife(id)             } #endif         }         case SH_HERO_DROP: {             gHasDarthMaul[id] = false         }     } } //---------------------------------------------------------------------------------------------- public darth_loop() {     if ( !sh_is_active() ) return     static players[SH_MAXSLOTS], playerCount, player, i, healPoints     get_players(players, playerCount, "ah")     healPoints = get_pcvar_num(gPcvarHealPoints)     for ( i = 0; i < playerCount; i++ ) {         player = players[i]         if ( gHasDarthMaul[player] ) {             sh_add_hp(player, healPoints)         }     } } //---------------------------------------------------------------------------------------------- #if defined USE_WPN_MODEL public Ham_Knife_Deploy_Post(wpnEntId) {     // Who is the owner of this weapon entity?     new owner = pev(wpnEntId, pev_owner)     switch_model_knife(owner)     return HAM_IGNORED } //---------------------------------------------------------------------------------------------- switch_model_knife(id) {     if ( !sh_is_active() || !is_user_alive(id) || !gHasDarthMaul[id] ) return     // If user has a shield do not change model, since we don't have one with a shield     if ( cs_get_user_shield(id) ) return     set_pev(id, pev_viewmodel2, gModelKnifeV)     set_pev(id, pev_weaponmodel2, gModelKnifeP) } //---------------------------------------------------------------------------------------------- #endif

This thread has gone offtopic, should really be a separate thread.

Last edited by vittu; 03-11-2011 at 14:27.
vittu is offline
Send a message via AIM to vittu Send a message via MSN to vittu Send a message via Yahoo to vittu
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 03-11-2011 , 15:20   Re: [bug] t-800 + darth maul
Reply With Quote #22

Oh, thanks

Multiple weapons as in several weapons in the same hero? Because otherwise I dont see the need :p I prefer the use of get_user_weapon in sh_hero_init() because it is simpler and it looks better lol XD
__________________
The Art of War is offline
Zakardo
Junior Member
Join Date: Jul 2009
Old 03-14-2011 , 09:06   Re: [bug] t-800 + darth maul
Reply With Quote #23

Thank you a lot
Zakardo is offline
vittu
SuperHero Moderator
Join Date: Oct 2004
Location: L.A. County, CA
Old 03-15-2011 , 17:20   Re: [bug] t-800 + darth maul
Reply With Quote #24

Quote:
Originally Posted by The Art of War View Post
Oh, thanks

Multiple weapons as in several weapons in the same hero? Because otherwise I dont see the need :p I prefer the use of get_user_weapon in sh_hero_init() because it is simpler and it looks better lol XD
Since no one else really had an opinion, I'll update the hero with the second method and do so in the core too.
vittu is offline
Send a message via AIM to vittu Send a message via MSN to vittu Send a message via Yahoo to vittu
Fr33m@n
Veteran Member
Join Date: May 2008
Location: France Marne
Old 03-15-2011 , 18:16   Re: [bug] t-800 + darth maul
Reply With Quote #25

if second method is post 21, it's ok for me.
Fr33m@n is offline
vittu
SuperHero Moderator
Join Date: Oct 2004
Location: L.A. County, CA
Old 03-16-2011 , 21:39   Re: [bug] t-800 + darth maul
Reply With Quote #26

Darth Maul main post updated...

Now I remember why I didn't go any further with a "best practice" method. Other heroes use CurWeapon for more than just a model change (ie reload mode) and would probably need altering as well.
vittu is offline
Send a message via AIM to vittu Send a message via MSN to vittu Send a message via Yahoo to vittu
The Art of War
Veteran Member
Join Date: Dec 2009
Location: Sweden Rock Festival
Old 03-17-2011 , 08:53   Re: [bug] t-800 + darth maul
Reply With Quote #27

Quote:
Originally Posted by vittu View Post
Darth Maul main post updated...

Now I remember why I didn't go any further with a "best practice" method. Other heroes use CurWeapon for more than just a model change (ie reload mode) and would probably need altering as well.
Hence you use punisher and no heroes such as those lol.
__________________
The Art of War 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 07:34.


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