I'd like to request a global script that plays a sound effect when you dismiss a single message string, or at the end of a series of continued strings (not in between message strings), if possible.
SFX on Message Quit
Started by
Cukeman
, Jun 26 2016 04:01 AM
3 replies to this topic
#1
Posted 26 June 2016 - 04:01 AM
#2
Posted 26 June 2016 - 04:13 AM
It won't be exactly the same, but this string control code:
If it absolutely needs to be at the exact moment of dismissal, it would have to be through rather indirect means. ZQuest strings aren't accessible to ZScript, and if the quest rule "Messages Freeze All Action" is on, scripts won't even run while messages are up. One solution I can think of is to have all message ending strings give the player an equipment item (\16\X string control code), then the global script can detect that item, then play a sound and remove it from the inventory.
\20\X - Sound Effect. Argument 1 is the sound effect number.is close to what you want. It can play at the end of strings, so it won't exactly coincide with dismissing them, but maybe it's good enough?
If it absolutely needs to be at the exact moment of dismissal, it would have to be through rather indirect means. ZQuest strings aren't accessible to ZScript, and if the quest rule "Messages Freeze All Action" is on, scripts won't even run while messages are up. One solution I can think of is to have all message ending strings give the player an equipment item (\16\X string control code), then the global script can detect that item, then play a sound and remove it from the inventory.
- Cukeman and Timelord like this
#3
Posted 26 June 2016 - 06:20 AM
That idea, on using item removal to produce the sound, is priceless; and ZScript madness at its height.It won't be exactly the same, but this string control code:
\20\X - Sound Effect. Argument 1 is the sound effect number.is close to what you want. It can play at the end of strings, so it won't exactly coincide with dismissing them, but maybe it's good enough?If it absolutely needs to be at the exact moment of dismissal, it would have to be through rather indirect means. ZQuest strings aren't accessible to ZScript, and if the quest rule "Messages Freeze All Action" is on, scripts won't even run while messages are up. One solution I can think of is to have all message ending strings give the player an equipment item (\16\X string control code), then the global script can detect that item, then play a sound and remove it from the inventory.
It's sickeningly more effective than what I was going to suggest. 12/10.
As token, here's the code, for Cukeman:
const int I_MSGSFX = 255; //ID of dummy item to use to trigger a sound. const int SFX_MSG_END = 100; //Sound to play void MessageSound(int itm, int sfx){ if ( Link->Item[itm] ) { Link->Item[itm] = false; Game->PlaySound(sfx); } global script active_example_msgsfx{ void run(){ while(true){ MessageSound(I_MSGSFX,SFX_MSG_END); Waitdraw(); Waitframe(); } } }
Edited by ZoriaRPG, 26 June 2016 - 06:26 AM.
- Cukeman likes this
#4
Posted 26 June 2016 - 01:59 PM
That's great, thank you!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users