I am trying change the ambience sound on my map when the player crosses a certain line.
For that I have two Ambient Sound Things (14001 and 14002).
I have the following scripts local to the map (ie in UDB i press F10 and typed this stuff in):
Code: Select all
#include "zcommon.acs"
script 1 (void)
{
PlaySound(0, "BushRustling");
}
script "Ambience_Toggle" (void)
{
if(CheckActorProperty(38,APROP_Dormant,0))
{
Thing_Activate(39);
Thing_Deactivate(38);
}
else
{
Thing_Activate(38);
Thing_Deactivate(39);
}
}
Script 2 toggles the ambience (the two objects are TID 38 and 39). The toggle itself (i.e., activate and deactivate) works, the if statement is, however, broken because neither Get nor CheckActorProperty returns a working value.
I was unsure what value Check and GetActorProperty return, so I worked through them in another script:
Code: Select all
script 3 (void)
{
//print(s:CheckActorProperty(38,APROP_Dormant,"false")); //"BushRustling" & "Bushrustling"
//print(i:CheckActorProperty(38,APROP_Dormant,"false")); // 0 & 0
//print(s:CheckActorProperty(38,APROP_Dormant, false)); // Nothing & Nothing
//print(i:CheckActorProperty(38,APROP_Dormant, false)); // 1 & 1
//print(s:CheckActorProperty(38,APROP_Dormant,0)); // Nothing & Nothing
//print(i:CheckActorProperty(38,APROP_Dormant,0)); // 1 & 1
//print(s:GetActorProperty(38,APROP_Dormant)); //"BushRustling" & "Bushrustling"
//print(i:GetActorProperty(38,APROP_Dormant)); // 0 & 0
}
I am sure I am doing something wrong. Given that "BushRustling" (which is in no way related to the AmbienceSound actors) should not be bleeding over into the output of Script3. Then again, I am not sure if it is maybe the "print" statement that does not properly print the Get/CheckActorProperty output given that I could not figure out from the docs what the return value would be for the dormant flag (therefore all the i: and s:)
Can anyone spot my mistake? Is it maybe because bools not really being a thing?
The map is in UDMF (DOOM2) format.
Alternatively, if anyone knows a better way to to either toggle actors or change ambience sound within a single map, I would be grateful for pointers^^
Thanks!