Game Modding | Call of Duty: Black Ops 3 | Scripting
ModmeBot:
Thread By: kingkenny
Hello!
I tried to make a script to play a sound/music when turning on the power but it doesn't work.
I tried this (the first line is in my function main)
thread init_power();
function init_power()
{
level flag::wait_till("power_on");
thread zm_utility::really_play_2D_sound("MY_SOUND_ALIAS");
}
ModmeBot:
Reply By: QuentinN33
kingkenny
Hello!I tried to make a script to play a sound/music when turning on the power but it doesn't work.I tried this (the first line is in my function main) thread init_power(); function init_power() { level flag::wait_till("power_on"); thread zm_utility::really_play_2D_sound("MY_SOUND_ALIAS"); } but it didn't work.can anyone help me with this?thank you very much!
ModmeBot:
Reply By: kingkenny
QuentinN33
self Playsound("aliases");
function init_power()
{
level flag::wait_till("power_on");
level util::set_lighting_state(2);
self PlaySound( "mus_gameover_intro" );
// thread zm_utility::really_play_2D_sound("MY_SOUND_ALIAS");
}
ModmeBot:
Reply By: mathfag
I have used this in the past so if it doesn't work it's on you
function sound_on_power()
{
level waittill("power_on");
foreach(player in GetPlayers())
{
player PlayLocalSound("power_on_mus");
IPrintLnBold("sound");
}
}
ModmeBot:
Reply By: QuentinN33
<ul>
<li style="font-style:italic;">mathfag</li>
</ul>
I have used this in the past so if it doesn't work it's on you function sound_on_power() { level waittill("power_on"); foreach(player in GetPlayers()) { player PlayLocalSound("power_on_mus"); IPrintLnBold("sound"); } }
ModmeBot:
Reply By: TheJaguarPlays
kingkenny
QuentinN33 self Playsound("aliases"); thank you for your reply. that didn't work. i tried self playsound("MY_SOUND_ALIAS") and self playlocalsound("MY_SOUND_ALIAS") but there is still no sound when turning on the power.i also tried a non-custom soundalias to make sure that it's not my file that doesn't work but no, even then i had no sound.this is my current function init_power() function init_power() { level flag::wait_till("power_on"); level util::set_lighting_state(2); self PlaySound( "mus_gameover_intro" ); // thread zm_utility::really_play_2D_sound("MY_SOUND_ALIAS"); }
ModmeBot:
Reply By: kingkenny
mathfag
I have used this in the past so if it doesn't work it's on you function sound_on_power() { level waittill("power_on"); foreach(player in GetPlayers()) { player PlayLocalSound("power_on_mus"); IPrintLnBold("sound"); } }
ModmeBot:
Reply By: kingkenny
One more thing,
I would like to take this thing a step further.
Is it possible to have a script that when a player joins the lobby (through server browser) after the game has already started will check if the power is on and if yes it will play a sound but only for the player that joined?
btw where do you guys find all these script functions?
is there a list or did you have to find everything out by yourself?
Thank you for any answer!
ModmeBot:
Reply By: mathfag
kingkenny
One more thing, I would like to take this thing a step further. Is it possible to have a script that when a player joins the lobby (through server browser) after the game has already started will check if the power is on and if yes it will play a sound but only for the player that joined?btw where do you guys find all these script functions?is there a list or did you have to find everything out by yourself?Thank you for any answer!
callback::on_connect(&power_func);
function power_func() //self = player
{
if(flag::get("power_on"))
{
self PlayLocalSound("power_on_mus");
}
}
ModmeBot:
Reply By: kingkenny
Awesome, thank you!
You will definitely be at the top of the credits of my next map.
And also thanks for the link, helps me a lot!
ModmeBot:
Reply By: kingkenny
mathfag
kingkenny One more thing, I would like to take this thing a step further. Is it possible to have a script that when a player joins the lobby (through server browser) after the game has already started will check if the power is on and if yes it will play a sound but only for the player that joined?btw where do you guys find all these script functions?is there a list or did you have to find everything out by yourself?Thank you for any answer! Put this somewhere so it runs when the map loads (function main()) callback::on_connect(&power_func); and this wherever function power_func() //self = player { if(flag::get("power_on")) { self PlayLocalSound("power_on_mus"); } } *didn't test* You can find functions here (click on the D-pad next to the search box and select bo3) or you can find a lot of useful functions in share\raw\scripts\zm\_zm_utility.gsc also you learn through experience
ModmeBot:
Reply By: mathfag
kingkenny
mathfag kingkenny One more thing, I would like to take this thing a step further. Is it possible to have a script that when a player joins the lobby (through server browser) after the game has already started will check if the power is on and if yes it will play a sound but only for the player that joined?btw where do you guys find all these script functions?is there a list or did you have to find everything out by yourself?Thank you for any answer! Put this somewhere so it runs when the map loads (function main()) callback::on_connect(&power_func); and this wherever function power_func() //self = player { if(flag::get("power_on")) { self PlayLocalSound("power_on_mus"); } } *didn't test* You can find functions here (click on the D-pad next to the search box and select bo3) or you can find a lot of useful functions in share\raw\scripts\zm\_zm_utility.gsc also you learn through experience so i tried this out now and it seems like it starts playing as soon as the map has loaded even though the power is not onany idea why that happens?
function sound_on_power()
function power_func() //self = player
{
if(level flag::exists("power_on") && level flag::get("power_on"))
{
self PlayLocalSound("kino_teleport_2d");
}
level waittill("power_on");
self PlayLocalSound("kino_teleport_2d");
}
ModmeBot:
Reply By: kingkenny
mathfag
kingkenny mathfag kingkenny One more thing, I would like to take this thing a step further. Is it possible to have a script that when a player joins the lobby (through server browser) after the game has already started will check if the power is on and if yes it will play a sound but only for the player that joined?btw where do you guys find all these script functions?is there a list or did you have to find everything out by yourself?Thank you for any answer! Put this somewhere so it runs when the map loads (function main()) callback::on_connect(&power_func); and this wherever function power_func() //self = player { if(flag::get("power_on")) { self PlayLocalSound("power_on_mus"); } } *didn't test* You can find functions here (click on the D-pad next to the search box and select bo3) or you can find a lot of useful functions in share\raw\scripts\zm\_zm_utility.gsc also you learn through experience so i tried this out now and it seems like it starts playing as soon as the map has loaded even though the power is not onany idea why that happens? You can remove all of function sound_on_power() update: function power_func() //self = player { if(level flag::exists("power_on") && level flag::get("power_on")) { self PlayLocalSound("kino_teleport_2d"); } level waittill("power_on"); self PlayLocalSound("kino_teleport_2d"); }
ModmeBot:
Reply By: xdferpc
try with this:
function power_func() //self = player
{
level.playSoundLocation PlaySound("kino_teleport_2d");
if(level flag::exists("power_on") && level flag::get("power_on"))
{
self PlayLocalSound("kino_teleport_2d");
}
level waittill("power_on");
self PlayLocalSound("kino_teleport_2d");
}
ModmeBot:
Reply By: kingkenny
i think the problem lies within the line:
if(level flag::exists("power_on") && level flag::get("power_on"))
function power_func() //self = player
{
if(level flag::exists("power_on") && level flag::get("power_on"))
{
IPrintLnBold("AAAAAAAAAAAAAAAAA");
self PlayLocalSound("MY_SOUND_ALIAS");
}
level waittill("power_on");
self PlayLocalSound("MY_SOUND_ALIAS");
}