Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help [unsolved]Lantern use script problem.
Red Offline
Posting Freak

Posts: 1,757
Threads: 49
Joined: Feb 2012
Reputation: 54
#1
[unsolved]Lantern use script problem.

I have a problem with this script piece:
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
(This post was last modified: 11-03-2012, 06:04 PM by Red.)
11-03-2012, 03:08 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: Lantern use script problem.

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);
}
}
}

Trying is the first step to success.
(This post was last modified: 11-03-2012, 03:31 PM by FlawlessHappiness.)
11-03-2012, 03:31 PM
Find
Red Offline
Posting Freak

Posts: 1,757
Threads: 49
Joined: Feb 2012
Reputation: 54
#3
RE: Lantern use script problem.

(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@)'"
(This post was last modified: 11-03-2012, 03:40 PM by Red.)
11-03-2012, 03:34 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
RE: Lantern use script problem.

My fault!! I forgot a capital: GetlocalVarInt should be GetLocalVarInt

Trying is the first step to success.
11-03-2012, 03:41 PM
Find
Red Offline
Posting Freak

Posts: 1,757
Threads: 49
Joined: Feb 2012
Reputation: 54
#5
RE: Lantern use script problem.

(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.
11-03-2012, 03:45 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#6
RE: Lantern use script problem.

How does it crash?
Any error?

Trying is the first step to success.
(This post was last modified: 11-03-2012, 03:56 PM by FlawlessHappiness.)
11-03-2012, 03:56 PM
Find
Red Offline
Posting Freak

Posts: 1,757
Threads: 49
Joined: Feb 2012
Reputation: 54
#7
RE: Lantern use script problem.

(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?
(This post was last modified: 11-03-2012, 04:09 PM by Red.)
11-03-2012, 03:57 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#8
RE: Lantern use script problem.

Are the names correct?

Trying is the first step to success.
11-03-2012, 04:16 PM
Find
Red Offline
Posting Freak

Posts: 1,757
Threads: 49
Joined: Feb 2012
Reputation: 54
#9
RE: Lantern use script problem.

(11-03-2012, 04:16 PM)beecake Wrote: Are the names correct?
Yes they are.
11-03-2012, 04:24 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#10
RE: Lantern use script problem.

Oh! It isn't calling because you missed this: if(HasItem("lantern_1") == true)


That is my guess...

Trying is the first step to success.
(This post was last modified: 11-03-2012, 04:31 PM by FlawlessHappiness.)
11-03-2012, 04:30 PM
Find




Users browsing this thread: 1 Guest(s)