Game Modding | Call of Duty: Black Ops 3 | Scripting
ModmeBot:
Thread By: Harry Bo21
ModmeBot:
Reply By: mathfag Don't forget to precache
ModmeBot:
Reply By: Harry Bo21
mathfag Don't forget to precache
...
everything in level._effect is precached already
precaching again wastes one of the available 800 fx
ModmeBot:
Reply By: mathfag You wrote "fx_path\fx_name" not level._effect["fx_path\fx_name"] therefore precache. :)
ModmeBot:
Reply By: Abnormal202
mathfag You wrote "fx_path\fx_name" not level._effect["fx_path\fx_name"] therefore precache. :)
oh c'mon you're just being nitpicky on purpose. people should know how FX works, and if not they should know this script is not the place to learn it, as FX isn't even related to the topic at hand.
ModmeBot:
Reply By: Harry Bo21 Detect damage on a model ( NO TRIGGERS )
Detect damage on a model
not
how to play a fx when a model is shot
i merely advised where to play a fx and how to delete the model - as OPTIONAL extra snippits of info, and the way to do it, not a full tutorial on playing fx
at least my code WORKS so do one
ModmeBot:
Reply By: eDeK Nice script, by the way, how i can change the "e_model" is a "zombie" and only count the "melee weapons"? How i can detect the player is knifing a zombie?
ModmeBot:
Reply By: ihmiskeho
eDeK Nice script, by the way, how i can change the "e_model" is a "zombie" and only count the "melee weapons"? How i can detect the player is knifing a zombie? function your_function_name() { zombies = level.zombie_team; while ( 1 ) { zombies waittill( "damage", damage, attacker, dir, point, mod, model, tag, part, weapon, flags, inflictor, chargeLevel ); if ( weapon.name == "MOD_MELEE" ) // Optional if you want a certain weapon only to count break; } } //my code }
Also you should check that the damager is actually a player
ModmeBot:
Reply By: eDeK Im doing a Powerup, this function is "when the player knife the zombie", but not work, i dont know how detect "the player is knifing a zombie".
Thanks for reply/help.
ModmeBot:
Reply By: tom5300
eDeK Im doing a Powerup, this function is "when the player knife the zombie", but not work, i dont know how detect "the player is knifing a zombie". function knife_me() { self endon( "disconnect" ); self endon( "death" ); self endon( "pyrotechnic_done" ); zombies = level.zombie_team; zombies waittill( "damage", damage, attacker, dir, point, mod, model, tag, part, weapon, flags, inflictor, chargeLevel ); { if ( mod == "MOD_MELEE" && IsPlayer(attacker) ) { self fire_works_summon( self ); } } WAIT_SERVER_FRAME; } Thanks for reply/help.
You cannot waittill on a variable containing the string "axis". You will have to iterate through each zombie, and thread a waittill on each zombie.
I'd try something like:
Note: I have not tested this code, hope it's error free.
ModmeBot:
Reply By: eDeK Thanks for reply Tom but dont work it. I need like <span style="color:#ffffff;">ihmiskeho</span> say "the damager is actually a player". Is something like that:
But this no work too. :(
ModmeBot:
Reply By: mathfag
ModmeBot:
Reply By: eDeK Works fine Mathfag, thanks for reply dude, the problem is when i grab the powerup the "Knifing effect (fireworks)" dont stop, still active after the powerup is over.
ModmeBot:
Reply By: mathfag Put this in __init__. It should only be activated once.
Remove
Replace
with
Replace function knife_dmg() with
Make sure
is set to false when the powerup is over
ModmeBot:
Reply By: eDeK I do all you say. When i spawn in the game (I shoot the zombies, i cant do points and the "Knife effect is active"). After this, i grab the powerup (I shoot the zombies, i can do points but the "Knife effect is no active" even after powerup is over."). Very weird all, i gonna still testing but at the moment i have this.
Thanks for your time Mathfag.
ModmeBot:
Reply By: mathfag in grab_pyrotechnic change
to
just incase.
The problem is that you set
immediately after setting it to true. Actually you did it before but im guessing since the cpu has to process a bunch of code it gets set after. anyway Move
to the end of
ModmeBot:
Reply By: eDeK
mathfag in grab_pyrotechnic change if( isdefined(player.pyrotechnic_active) ) to if( isdefined(player.pyrotechnic_active) && player.pyrotechnic_active == 1 ) just incase. The problem is that you set level.pyrotechnic_active = false; immediately after setting it to true. Actually you did it before but im guessing since the cpu has to process a bunch of code it gets set after. anyway Move level.pyrotechnic_active = false; to the end of function wait_til_timeout
I dont have words to describe my gratitude with you, seriously, thanks.
When i spawn in the game the "Knife effect" is active, i grab the powerup for the first time, the "Knife effect" still active, when the powerup is over, the "Knife effect" is over. (Everything goes back to normal)
I grab the powerup for the second time, the powerup is working perfect all the time.
ModmeBot:
Reply By: mathfag
eDeK mathfag in grab_pyrotechnic change if( isdefined(player.pyrotechnic_active) ) to if( isdefined(player.pyrotechnic_active) && player.pyrotechnic_active == 1 ) just incase. The problem is that you set level.pyrotechnic_active = false; immediately after setting it to true. Actually you did it before but im guessing since the cpu has to process a bunch of code it gets set after. anyway Move level.pyrotechnic_active = false; to the end of function wait_til_timeout I dont have words to describe my gratitude with you, seriously, thanks. When i spawn in the game the "Knife effect" is active, i grab the powerup for the first time, the "Knife effect" still active, when the powerup is over, the "Knife effect" is over. (Everything goes back to normal) I grab the powerup for the second time, the powerup is working perfect all the time. //POWERUP function __init__() { zm_powerups::register_powerup( "pyrotechnic", &grab_pyrotechnic ); if( ToLower( GetDvarString( "g_gametype" ) ) != "pyrotechnic" ) { zm_powerups::add_zombie_powerup( "pyrotechnic", "pyrotechnic_powerup_model", "", &zm_powerups::func_should_always_drop, POWERUP_ONLY_AFFECTS_GRABBER, !POWERUP_ANY_TEAM, !POWERUP_ZOMBIE_GRABBABLE ); zm_spawner::register_zombie_damage_callback( &knife_dmg ); } } function grab_pyrotechnic( player ) { player PlayLocalSound("vox_pyrotechnic"); skip = player add_powerup_hud( "pyrotechnic_material_hud", N_POWERUP_DEFAULT_TIME ); if( skip ) return; if( isdefined(player.pyrotechnic_active) && player.pyrotechnic_active == 1 ) return; player thread do_pyrotechnic(); } function do_pyrotechnic() { level.pyrotechnic_active = true; self notify( "pyrotechnic_done" ); self endon( "disconnect" ); self endon( "death" ); self endon( "pyrotechnic_done" ); } function knife_dmg(str_mod, str_hit_location, v_hit_origin, e_player, n_amount, w_weapon, direction_vec, tagName, modelName, partName, dFlags, inflictor, chargeLevel) { if(level.pyrotechnic_active == 0) return 0; if(str_mod == "MOD_MELEE") { self thread fire_works_summon( e_player, w_weapon ); } WAIT_SERVER_FRAME; } //HUD function wait_til_timeout( player, hud )//player = self; { while( hud.time > 0 ) { wait(1); hud.time--; } player notify( "pyrotechnic_done" ); player remove_powerup_hud( "pyrotechnic_material_hud" ); player.pyrotechnic_active = undefined; level.pyrotechnic_active = false; } function add_powerup_hud( powerup, timer ) { if ( !isDefined( self.powerup_hud ) ) self.powerup_hud = []; if( isDefined( self.powerup_hud[powerup] ) ) { self.powerup_hud[powerup].time = timer; return true; // tells to skip because powerup is already active } self endon( "disconnect" ); hud = NewClientHudElem( self ); hud.powerup = powerup; hud.foreground = true; hud.hidewheninmenu = true; hud.alignX = "center"; hud.alignY = "bottom"; hud.horzAlign = "center"; hud.vertAlign = "bottom"; hud.x = hud.x; hud.y = hud.y - 50; hud.alpha = 1; hud SetShader( powerup , 64, 64 ); hud scaleOverTime( .5, 32, 32 ); hud.time = timer; hud thread harrybo21_blink_powerup_hud(); thread wait_til_timeout( self, hud ); self.powerup_hud[ powerup ] = hud; a_keys = GetArrayKeys( self.powerup_hud ); for ( i = 0; i < a_keys.size; i++ ) self.powerup_hud[ a_keys] thread move_hud( .5, 0 - ( 24 * ( self.powerup_hud.size ) ) + ( i * 37.5 ) + 25, self.powerup_hud[ a_keys].y ); return false; // powerup is not already active } function move_hud( time, x, y ) { self moveOverTime( time ); self.x = x; self.y = y; } function harrybo21_blink_powerup_hud() { self endon( "delete" ); self endon( "stop_fade" ); while( isDefined( self ) ) { if ( self.time >= 20 ) { self.alpha = 1; wait .1; continue; } fade_time = 1; if ( self.time < 10 ) fade_time = .5; if ( self.time < 5 ) fade_time = .25; self fadeOverTime( fade_time ); self.alpha = !self.alpha; wait( fade_time ); } } function remove_powerup_hud( powerup ) { self.powerup_hud[ powerup ] destroy(); self.powerup_hud[ powerup ] notify( "stop_fade" ); self.powerup_hud[ powerup ] fadeOverTime( .2 ); self.alpha = 0; wait .2; self.powerup_hud[ powerup ] delete(); self.powerup_hud[ powerup ] = undefined; self.powerup_hud = array::remove_index( self.powerup_hud, self.powerup_hud[ powerup ], true ); a_keys = GetArrayKeys( self.powerup_hud ); for ( i = 0; i < a_keys.size; i++ ) self.powerup_hud[ a_keys] thread move_hud( .5, 0 - ( 24 * ( self.powerup_hud.size ) ) + ( i * 37.5 ) + 25, self.powerup_hud[ a_keys].y ); }
in function __init__ add
because if you do
when it's undefined it screws up
also the line
is pointless
ModmeBot:
Reply By: eDeK Yeah, the line is:
My fault writing, work perfect now, thanks again, the unique thing i need buff is the score "i cant do points, shooting or knifing, with the powerup active" i dont know why, i need to do a callback to the player/zombie?