So, I have just recently scripted the electric cherry perk and no I don't need help with the electric cherry script itself at all. I added all the stuff that is required to add a perk, I copy and pasted from zombiemode_perks.gsc into an emtpy gsc where I will have all my BO2 perks. And I have pasted my electric cherry script as well.
The problem is that I can't buy the perk. Yes, the hintstring at the perk says, "you need to turn the power on" and when I turn on the power, the hintstring doesn't change to "Press &&1 to buy Electric Cherry". But when I hit the trigger anyway, I get that sound that means that I can't afford the perk, even if I have 10000 points or something.
If you have time and read my _zombiemode_perks_black_ops2.gsc then here it is. And yes, this is my first time at implimenting a custom perk into waw. So the problem itself I have here is to set up the perk system itself.
if ( cheat != true ) { //player iprintln( "Already using Perk: " + perk ); self playsound("deny"); player thread play_no_money_perk_dialog();
continue; } }
if ( player.score < cost ) { //player iprintln( "Not enough points to buy Perk: " + perk ); self playsound("deny"); player thread play_no_money_perk_dialog(); continue; }
//sound = "bottle_dispense3d"; player achievement_notify( "perk_used" ); //playsoundatposition(sound, self.origin); player maps\_zombiemode_score::minus_to_player_score( cost ); ///bottle_dispense switch( perk ) { case "specialty_detectexplosive": //sound = "mx_jugger_sting"; break;
default: //sound = "mx_jugger_sting"; break; }
//self thread play_vendor_stings(sound);
//self waittill("sound_done");
// do the drink animation gun = player perk_give_bottle_begin(perk); player.is_drinking = 1; player waittill_any( "fake_death", "gungame_death", "death", "player_downed", "weapon_change_complete" );
// restore player controls and movement player perk_give_bottle_end( gun, perk); player.is_drinking = undefined; // TODO: race condition? if ( player maps\_laststand::player_is_in_laststand() ) { continue; }
//TUEY We need to eventually store the dialog in an array so you can add multiple variants...but we only have 1 now anyway. switch(type) { case "specialty_armorvest": sound_to_play = "vox_perk_jugga_0"; break; case "specialty_fastreload": sound_to_play = "vox_perk_speed_0"; break; case "specialty_quickrevive": sound_to_play = "vox_perk_revive_0"; break; case "specialty_rof": sound_to_play = "vox_perk_doubletap_0"; break; default: sound_to_play = "vox_perk_jugga_0"; break; }
wait(1.0); self maps\_zombiemode_spawner::do_player_playdialog(player_index, sound_to_play, 0.25); } machine_watcher() { //PI ESM - support for two level switches for Factory if (isDefined(level.DLC3.perksNeedPowerOn) && level.DLC3.perksNeedPowerOn) { level thread machine_watcher_factory("juggernog_on"); level thread machine_watcher_factory("sleight_on"); level thread machine_watcher_factory("doubletap_on"); level thread machine_watcher_factory("revive_on"); level thread machine_watcher_factory("Pack_A_Punch_on"); } else { level waittill("master_switch_activated"); //array_thread(getentarray( "zombie_vending", "targetname" ), ::perks_a_cola_jingle);
}
}
//PI ESM - added for support for two switches in factory machine_watcher_factory(vending_name) { level waittill(vending_name); switch(vending_name) { case "juggernog_on": temp_script_sound = "mx_jugger_jingle"; break;
case "sleight_on": temp_script_sound = "mx_speed_jingle"; break;
case "doubletap_on": temp_script_sound = "mx_doubletap_jingle"; break;
case "revive_on": temp_script_sound = "mx_revive_jingle"; break;
case "Pack_A_Punch_on": temp_script_sound = "mx_packa_jingle"; break;
dist = 128 * 128; while(true) { players = get_players(); for( i = 0; i < players.size; i++ ) { if(DistanceSquared( players[i].origin, self.origin ) < dist) { if(!players[i] hasperk(perk) && !(players[i] in_revive_trigger())) { //PI CHANGE: this change makes it so that if there are multiple players within the trigger for the perk machine, the hint string is still // visible to all of them, rather than the last player this check is done for if (IsDefined(level.script) && level.script == "nazi_zombie_theater") self setinvisibletoplayer(players[i], false); else self setvisibletoplayer(players[i]); //END PI CHANGE //iprintlnbold("turn it off to player");
And everything works with it I think, the problem is just that I can't buy it. And I have tried to find the problem but I am out of ideas. Thanks in advance.
"Deleted code is debugged code." - Jeff Sickel "Mathematicians stand on each others' shoulders and computer scientists stand on each others' toes." - Richard Hamming
And I tried to copy and paste my electric cherry stuff in the regular _zombiemode_perks.gsc instead now and it does the same thing, it doesn't change hintstring after turning on the power and I can't buy it even though I can afford it.
Has to be something I have missed to copy and paste but that?
I had this before and I forgot to change the KVP for the specialty on the perk machine in Radiant. Maybe this is it?
Which are all the KVP's required for the perk machine in radiant more than that? Is the perk machine model itself required to have the perks working? Can't I just test it with the trigger?
The problem is that I can't buy the perk. Yes, the hintstring at the perk says, "you need to turn the power on" and when I turn on the power, the hintstring doesn't change to "Press &&1 to buy Electric Cherry". But when I hit the trigger anyway, I get that sound that means that I can't afford the perk, even if I have 10000 points or something.
I used your script above, then I placed a trigger into my test map and gave it these kvps:
Once power was on, the hint string changed. I don't think your issue is this script as far as the hintstring is concerned...
I suggest adding many, many
Code Snippet
Plaintext
iprintlnbold("This just happened");
to walk you through your script and maybe point out where your issues are?
I did run into other issues though and went through and left comments and what I did to fix most of them.. If you search the following code for the word problem, you will find a small explanation of what I did. It is working for me, except for the shock_fx FX. I guess I just don't have it or something, I don't know, I'm not currently on my developer computer where all my stuff is.
level thread turn_electric_cherry_on(); //problem players is empty here if players haven't connected yet thread electrc_cherry_for_all();
} //problem added a function to wait for the players to connect first, then thread cherry electrc_cherry_for_all(){ flag_Wait("all_players_connected"); players = Get_players(); for( i = 0; i < players.size; i++ ) { players[i] thread electric_cherry(); } }
for( i = 0; i < machine.size; i++ ) { machine[i] vibrate((0,-100,0), 0.3, 0.4, 3); machine[i] playsound("perks_power_on"); machine[i] thread perk_fx("revive_light"); } //problem should have _power_on at the end for line 99, but you are not using line 101 so... level notify( "specialty_boost_power_on" ); }
perk_fx( fx ) { wait(3); playfxontag( level._effect[ fx ], self, "tag_origin" ); }
if ( cheat != true ) { //player iprintln( "Already using Perk: " + perk ); self playsound("deny"); player thread play_no_money_perk_dialog();
continue; } }
if ( player.score < cost ) { //player iprintln( "Not enough points to buy Perk: " + perk ); self playsound("deny"); player thread play_no_money_perk_dialog(); continue; }
//sound = "bottle_dispense3d"; player achievement_notify( "perk_used" ); //playsoundatposition(sound, self.origin); player maps\_zombiemode_score::minus_to_player_score( cost ); ///bottle_dispense switch( perk ) { case "specialty_detectexplosive": //sound = "mx_jugger_sting"; break;
default: //sound = "mx_jugger_sting"; break; }
//self thread play_vendor_stings(sound);
//self waittill("sound_done");
// do the drink animation gun = player perk_give_bottle_begin(perk); player.is_drinking = 1; player waittill_any( "fake_death", "gungame_death", "death", "player_downed", "weapon_change_complete" );
// restore player controls and movement player perk_give_bottle_end( gun, perk); player.is_drinking = undefined; // TODO: race condition? if ( player maps\_laststand::player_is_in_laststand() ) { continue; }
//TUEY We need to eventually store the dialog in an array so you can add multiple variants...but we only have 1 now anyway. switch(type) { case "specialty_armorvest": sound_to_play = "vox_perk_jugga_0"; break; case "specialty_fastreload": sound_to_play = "vox_perk_speed_0"; break; case "specialty_quickrevive": sound_to_play = "vox_perk_revive_0"; break; case "specialty_rof": sound_to_play = "vox_perk_doubletap_0"; break; default: sound_to_play = "vox_perk_jugga_0"; break; }
wait(1.0); self maps\_zombiemode_spawner::do_player_playdialog(player_index, sound_to_play, 0.25); } machine_watcher() { //PI ESM - support for two level switches for Factory if (isDefined(level.DLC3.perksNeedPowerOn) && level.DLC3.perksNeedPowerOn) { level thread machine_watcher_factory("juggernog_on"); level thread machine_watcher_factory("sleight_on"); level thread machine_watcher_factory("doubletap_on"); level thread machine_watcher_factory("revive_on"); level thread machine_watcher_factory("Pack_A_Punch_on"); } else { level waittill("master_switch_activated"); //array_thread(getentarray( "zombie_vending", "targetname" ), ::perks_a_cola_jingle);
}
}
//PI ESM - added for support for two switches in factory machine_watcher_factory(vending_name) { level waittill(vending_name); switch(vending_name) { case "juggernog_on": temp_script_sound = "mx_jugger_jingle"; break;
case "sleight_on": temp_script_sound = "mx_speed_jingle"; break;
case "doubletap_on": temp_script_sound = "mx_doubletap_jingle"; break;
case "revive_on": temp_script_sound = "mx_revive_jingle"; break;
case "Pack_A_Punch_on": temp_script_sound = "mx_packa_jingle"; break;
switch( perk ) { case "specialty_detectexplosive": weapon = "zombie_perk_bottle_revive"; break;
case "specialty_longersprint": weapon = "zombie_perk_bottle_doubletap"; break;
case "specialty_extraammo": weapon = "zombie_perk_bottle_sleight"; break;
case "specialty_bulletaccuracy": weapon = "zombie_perk_bottle_doubletap"; break; //problem You didn't have a default here or what to do and was keeping my knife! case "specialty_boost": weapon = "zombie_perk_bottle_revive"; break; default: break; }
dist = 128 * 128; while(true) { players = get_players(); for( i = 0; i < players.size; i++ ) { if(DistanceSquared( players[i].origin, self.origin ) < dist) { if(!players[i] hasperk(perk) && !(players[i] in_revive_trigger())) { //PI CHANGE: this change makes it so that if there are multiple players within the trigger for the perk machine, the hint string is still // visible to all of them, rather than the last player this check is done for if (IsDefined(level.script) && level.script == "nazi_zombie_theater") self setinvisibletoplayer(players[i], false); else self setvisibletoplayer(players[i]); //END PI CHANGE //iprintlnbold("turn it off to player");
while(1) { //problem you need a wait here for the while loop when player doesn't hve perk wait(.1); if(self HasPerk("specialty_boost")) { //if( self GetWeaponAmmoClip == 0 ) //{ self waittill( "reload_start" ); //problem assume you were adjusting height? self.fx = Spawn( "script_model", self.origin + (0,0,0)); self.fx SetModel( "tag_origin" ); self.fx.angles = self.angles; self.fx LinkTo( self ); //problem but still not working, I don't have shock_fx FX, maybe it works for you? //I used other fx and it was working so I didn't change this PlayFxOnTag( level._effect["shock_fx"], self.fx, "tag_origin" ); //problem the way needs to be after the shock //wait 1.5; self playsound( "imp_tesla" );
zombs = getaispeciesarray("axis","all");
for(k=0;k<zombs.size;k++) { //changed 50 to 75 if(distance(zombs[k].origin, self.origin) <= 75) { zombs[k].deathanim = random( level._zombie_tesla_death[zombs[k].animname] ); zombs[k] maps\_zombiemode_tesla::tesla_play_death_fx(1); self maps\_zombiemode_score::add_to_player_score(20); zombs[k] DoDamage( zombs[k].health + 666, zombs[k].origin ); playfxontag( level._effect["elec_eye_fx"], zombs[k], "J_Eyeball_LE" ); playfxontag( level._effect["shock_fx"], zombs[k], "J_SpineUpper" ); zombs[k] playsound( "imp_tesla" ); } } //problem put wait here then delete the fx wait 1.5; self.fx delete();
} } }
Good Luck
Last Edit: June 21, 2014, 07:57:27 pm by MakeCents
Once power was on, the hint string changed. I don't think your issue is this script as far as the hintstring is concerned...
I suggest adding many, many
Code Snippet
Plaintext
iprintlnbold("This just happened");
to walk you through your script and maybe point out where your issues are?
I did run into other issues though and went through and left comments and what I did to fix most of them.. If you search the following code for the word problem, you will find a small explanation of what I did. It is working for me, except for the shock_fx FX. I guess I just don't have it or something, I don't know, I'm not currently on my developer computer where all my stuff is.
level thread turn_electric_cherry_on(); //problem players is empty here if players haven't connected yet thread electrc_cherry_for_all();
} //problem added a function to wait for the players to connect first, then thread cherry electrc_cherry_for_all(){ flag_Wait("all_players_connected"); players = Get_players(); for( i = 0; i < players.size; i++ ) { players[i] thread electric_cherry(); } }
for( i = 0; i < machine.size; i++ ) { machine[i] vibrate((0,-100,0), 0.3, 0.4, 3); machine[i] playsound("perks_power_on"); machine[i] thread perk_fx("revive_light"); } //problem should have _power_on at the end for line 99, but you are not using line 101 so... level notify( "specialty_boost_power_on" ); }
perk_fx( fx ) { wait(3); playfxontag( level._effect[ fx ], self, "tag_origin" ); }
if ( cheat != true ) { //player iprintln( "Already using Perk: " + perk ); self playsound("deny"); player thread play_no_money_perk_dialog();
continue; } }
if ( player.score < cost ) { //player iprintln( "Not enough points to buy Perk: " + perk ); self playsound("deny"); player thread play_no_money_perk_dialog(); continue; }
//sound = "bottle_dispense3d"; player achievement_notify( "perk_used" ); //playsoundatposition(sound, self.origin); player maps\_zombiemode_score::minus_to_player_score( cost ); ///bottle_dispense switch( perk ) { case "specialty_detectexplosive": //sound = "mx_jugger_sting"; break;
default: //sound = "mx_jugger_sting"; break; }
//self thread play_vendor_stings(sound);
//self waittill("sound_done");
// do the drink animation gun = player perk_give_bottle_begin(perk); player.is_drinking = 1; player waittill_any( "fake_death", "gungame_death", "death", "player_downed", "weapon_change_complete" );
// restore player controls and movement player perk_give_bottle_end( gun, perk); player.is_drinking = undefined; // TODO: race condition? if ( player maps\_laststand::player_is_in_laststand() ) { continue; }
//TUEY We need to eventually store the dialog in an array so you can add multiple variants...but we only have 1 now anyway. switch(type) { case "specialty_armorvest": sound_to_play = "vox_perk_jugga_0"; break; case "specialty_fastreload": sound_to_play = "vox_perk_speed_0"; break; case "specialty_quickrevive": sound_to_play = "vox_perk_revive_0"; break; case "specialty_rof": sound_to_play = "vox_perk_doubletap_0"; break; default: sound_to_play = "vox_perk_jugga_0"; break; }
wait(1.0); self maps\_zombiemode_spawner::do_player_playdialog(player_index, sound_to_play, 0.25); } machine_watcher() { //PI ESM - support for two level switches for Factory if (isDefined(level.DLC3.perksNeedPowerOn) && level.DLC3.perksNeedPowerOn) { level thread machine_watcher_factory("juggernog_on"); level thread machine_watcher_factory("sleight_on"); level thread machine_watcher_factory("doubletap_on"); level thread machine_watcher_factory("revive_on"); level thread machine_watcher_factory("Pack_A_Punch_on"); } else { level waittill("master_switch_activated"); //array_thread(getentarray( "zombie_vending", "targetname" ), ::perks_a_cola_jingle);
}
}
//PI ESM - added for support for two switches in factory machine_watcher_factory(vending_name) { level waittill(vending_name); switch(vending_name) { case "juggernog_on": temp_script_sound = "mx_jugger_jingle"; break;
case "sleight_on": temp_script_sound = "mx_speed_jingle"; break;
case "doubletap_on": temp_script_sound = "mx_doubletap_jingle"; break;
case "revive_on": temp_script_sound = "mx_revive_jingle"; break;
case "Pack_A_Punch_on": temp_script_sound = "mx_packa_jingle"; break;
switch( perk ) { case "specialty_detectexplosive": weapon = "zombie_perk_bottle_revive"; break;
case "specialty_longersprint": weapon = "zombie_perk_bottle_doubletap"; break;
case "specialty_extraammo": weapon = "zombie_perk_bottle_sleight"; break;
case "specialty_bulletaccuracy": weapon = "zombie_perk_bottle_doubletap"; break; //problem You didn't have a default here or what to do and was keeping my knife! case "specialty_boost": weapon = "zombie_perk_bottle_revive"; break; default: break; }
dist = 128 * 128; while(true) { players = get_players(); for( i = 0; i < players.size; i++ ) { if(DistanceSquared( players[i].origin, self.origin ) < dist) { if(!players[i] hasperk(perk) && !(players[i] in_revive_trigger())) { //PI CHANGE: this change makes it so that if there are multiple players within the trigger for the perk machine, the hint string is still // visible to all of them, rather than the last player this check is done for if (IsDefined(level.script) && level.script == "nazi_zombie_theater") self setinvisibletoplayer(players[i], false); else self setvisibletoplayer(players[i]); //END PI CHANGE //iprintlnbold("turn it off to player");
while(1) { //problem you need a wait here for the while loop when player doesn't hve perk wait(.1); if(self HasPerk("specialty_boost")) { //if( self GetWeaponAmmoClip == 0 ) //{ self waittill( "reload_start" ); //problem assume you were adjusting height? self.fx = Spawn( "script_model", self.origin + (0,0,0)); self.fx SetModel( "tag_origin" ); self.fx.angles = self.angles; self.fx LinkTo( self ); //problem but still not working, I don't have shock_fx FX, maybe it works for you? //I used other fx and it was working so I didn't change this PlayFxOnTag( level._effect["shock_fx"], self.fx, "tag_origin" ); //problem the way needs to be after the shock //wait 1.5; self playsound( "imp_tesla" );
zombs = getaispeciesarray("axis","all");
for(k=0;k<zombs.size;k++) { //changed 50 to 75 if(distance(zombs[k].origin, self.origin) <= 75) { zombs[k].deathanim = random( level._zombie_tesla_death[zombs[k].animname] ); zombs[k] maps\_zombiemode_tesla::tesla_play_death_fx(1); self maps\_zombiemode_score::add_to_player_score(20); zombs[k] DoDamage( zombs[k].health + 666, zombs[k].origin ); playfxontag( level._effect["elec_eye_fx"], zombs[k], "J_Eyeball_LE" ); playfxontag( level._effect["shock_fx"], zombs[k], "J_SpineUpper" ); zombs[k] playsound( "imp_tesla" ); } } //problem put wait here then delete the fx wait 1.5; self.fx delete();