TGEA 1.7 soundtrigger issue
by DreamPharaoh · in Torque Game Engine Advanced · 03/22/2008 (12:20 pm) · 2 replies
This trigger works fine in TGEA prior to the beta, but now it does not work. I have changed the sound profile to sfxprofile and definitions to the sfxdefinition of the music files, but the console has an error for the alxplay and alxstop commands. Here is the trigger I am using.
Script: --------------------------------------------------------------------------------------------
//Note: tried to name profile as CaveofSticks, but couldn't load it?
//Had to name it CaveofSticksMusic.. not sure why yet
datablock TriggerData( MusicTrigger )
{
tickPeriodMS = 200;
};
function MusicTrigger::onEnterTrigger( %this, %trigger, %obj )
{
echo( "Music stopped.");
alxStop($triggermusic);
Parent::onLeaveTrigger( %this, %trigger, %obj );
echo( "Music started.");
Parent::onEnterTrigger( %this, %trigger, %obj );
}
function MusicTrigger::onLeaveTrigger( %this, %trigger, %obj )
{
echo( "Music stopped.");
alxStop($triggermusic);
Parent::onLeaveTrigger( %this, %trigger, %obj );
echo("Trigger has been exited");
%seed = getRandom(3);
if (%seed < 2) {
$triggermusic = alxPlay(%trigger.sound1);
}
else {
$triggermusic = alxPlay(%trigger.sound);
}
//Working code -- need if then, and random seed
//$triggermusic = alxPlay(%trigger.sound1);
//$triggermusic = alxPlay(%music);
echo(%seed);
}
---------------------------------------------------------------------------------------
Mission object with dynamic fields:
new Trigger(TheLand) {
canSaveDynamicFields = "1";
position = "555.424 851.979 -243.615";
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "MusicTrigger";
polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
sound = "OutdoorsMusic2";
sound1 = "OutdoorsMusic3";
};
Thank you
Script: --------------------------------------------------------------------------------------------
//Note: tried to name profile as CaveofSticks, but couldn't load it?
//Had to name it CaveofSticksMusic.. not sure why yet
datablock TriggerData( MusicTrigger )
{
tickPeriodMS = 200;
};
function MusicTrigger::onEnterTrigger( %this, %trigger, %obj )
{
echo( "Music stopped.");
alxStop($triggermusic);
Parent::onLeaveTrigger( %this, %trigger, %obj );
echo( "Music started.");
Parent::onEnterTrigger( %this, %trigger, %obj );
}
function MusicTrigger::onLeaveTrigger( %this, %trigger, %obj )
{
echo( "Music stopped.");
alxStop($triggermusic);
Parent::onLeaveTrigger( %this, %trigger, %obj );
echo("Trigger has been exited");
%seed = getRandom(3);
if (%seed < 2) {
$triggermusic = alxPlay(%trigger.sound1);
}
else {
$triggermusic = alxPlay(%trigger.sound);
}
//Working code -- need if then, and random seed
//$triggermusic = alxPlay(%trigger.sound1);
//$triggermusic = alxPlay(%music);
echo(%seed);
}
---------------------------------------------------------------------------------------
Mission object with dynamic fields:
new Trigger(TheLand) {
canSaveDynamicFields = "1";
position = "555.424 851.979 -243.615";
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "MusicTrigger";
polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
sound = "OutdoorsMusic2";
sound1 = "OutdoorsMusic3";
};
Thank you
About the author
If you want to learn more, please go to my website. GodsandNemesis.com.
#2
03/22/2008 (2:29 pm)
That is exactly what it was, thankyou. The awesome (much appreciated BTW) docs say that alxstop and alxplay are the console commands for this, just to let you know.
Torque 3D Owner Stephen Zepp