Frictional Games Forum (read-only)

Full Version: [unsolved]Lantern use script problem.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I have a problem with this script piece:
Code:
void CollideLanternArea(string &in asParent,string &in asChild,int alState)
{    
    if(alState == 1){
    if(HasItem("lantern_1"))    
    SetLanternLitCallback("SlimeOff");
    }
}
void SlimeOff(bool abLit)
{    
    
    
    for(int i; i<8; i++)SetPropActiveAndFade("slime_"+i,false,1.5);
    
    PlayGuiSound("puzzle_acid",3);

    FadeLightTo("PointLight_18", 0,0, 0, 0, 0, 3);
}

The slimes won't disapear when i use my lantern and every time when i turn it on or off it makes that "puzzle_acid" sound.
I want the sound only heard once and the slimes disapear when i turn my lantern ON in the "LanternArea".

EDIT: and there appeared to be an another problem: When i turn the lantern off or on several times, the
game crahes.(in the "LanternArea")

Sorry for my bad english
I guess you have to use the "abLit" in an if-statement.
void SlimeOff(bool abLit)
{
if(abLit == true)
{
for(int i; i<8; i++)SetPropActiveAndFade("slime_"+i,false,1.5);
FadeLightTo("PointLight_18", 0,0, 0, 0, 0, 3);
if(GetlocalVarInt("PlayAcidSound") == 0)
{
PlayGuiSound("puzzle_acid",3);

SetLocalVarInt("PlayAcidSound", 1);
}
}
}
(11-03-2012, 03:31 PM)beecake Wrote: [ -> ]I guess you have to use the "abLit" in an if-statement.
void SlimeOff(bool abLit)
{
if(abLit == true)
{
for(int i; i<8; i++)SetPropActiveAndFade("slime_"+i,false,1.5);
FadeLightTo("PointLight_18", 0,0, 0, 0, 0, 3);
if(GetlocalVarInt("PlayAcidSound") == 0)
{
PlayGuiSound("puzzle_acid",3);

SetLocalVarInt("PlayAcidSound", 1);
}
}
}
Gonna try.
EDIT: That script is not working "No matching singatures to GetLocalVarInt(string@)'"
My fault!! I forgot a capital: GetlocalVarInt should be GetLocalVarInt
(11-03-2012, 03:41 PM)beecake Wrote: [ -> ]My fault!! I forgot a capital: GetlocalVarInt should be GetLocalVarInt
Yep, the sound is now working, but the slimes wont disapear and the game crashes etc.
How does it crash?
Any error?
(11-03-2012, 03:56 PM)beecake Wrote: [ -> ]How does it crash?
Any error?
wait i'll check.
EDIT: The game just freezes and the cursor appears. It happens when i turn off or on the lantern several times
in the "LanternArea" like i said before.
EDIT TO EDIT: I got the crash fixed, i don't know how but it just doesn't crash anymore.

But now the next problem why the slimes wont disapear?
Are the names correct?
(11-03-2012, 04:16 PM)beecake Wrote: [ -> ]Are the names correct?
Yes they are.
Oh! It isn't calling because you missed this: if(HasItem("lantern_1") == true)


That is my guess...
Pages: 1 2