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
Need help, again :P
Zaapeer Offline
Junior Member

Posts: 32
Threads: 9
Joined: Dec 2011
Reputation: 0
#1
Need help, again :P

I have another problem... In one part of my cs, you are supposed to put coal in a furnace and then pull a lever to make a machine start working. I made it so that when you pull the lever it creates a particle system (steam) and also the sound for the steam. But if you pull the lever again, it creates more steam and more sound, wich is not supposed to happen. How do I fix this? And also, I made a jump scare, and made it so that when it happens the sound of the player reacting scared is supposed to play, but it doesn't...
Here's the script for the jump scare:


void OnStart()
{
AddEntityCollideCallback("Player", "GhostArea", "GhostFunc", true, 1);
}


void GhostFunc(string &in asParent, string &in asChild, int alState)
{
AddPropForce("vase01_1", 0, 0, -2000, "world");
StartPlayerLookAt("vase01_1", 5, 10, "");
AddTimer("StopLookTimer1", 0.2f, "StopLookFunc1");
PlaySoundAtEntity("", "react_scare.snt", "player", 0.1f, true);
}

void StopLookFunc1(string &in asTimer)
{
StopPlayerLookAt();
}

Does someone know how to fix this? [Image: confused.gif]
10-25-2012, 03:08 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#2
RE: Need help, again :P

You could set the lever stuck when the coal is inside, so it can't make more stuff.

void GhostFunc(string &in asParent, string &in asChild, int alState)

{

AddPropForce("vase01_1", 0, 0, -2000, "world");

StartPlayerLookAt("vase01_1", 5, 10, "");

AddTimer("StopLookTimer1", 0.2f, "StopLookFunc1");

PlaySoundAtEntity("", "react_scare.snt", "Player", 0.1f, true);

}

Try this script, maybe it fixes it.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
10-25-2012, 03:12 PM
Find
Zaapeer Offline
Junior Member

Posts: 32
Threads: 9
Joined: Dec 2011
Reputation: 0
#3
RE: Need help, again :P

(10-25-2012, 03:12 PM)The chaser Wrote: You could set the lever stuck when the coal is inside, so it can't make more stuff.

void GhostFunc(string &in asParent, string &in asChild, int alState)

{

AddPropForce("vase01_1", 0, 0, -2000, "world");

StartPlayerLookAt("vase01_1", 5, 10, "");

AddTimer("StopLookTimer1", 0.2f, "StopLookFunc1");

PlaySoundAtEntity("", "react_scare.snt", "Player", 0.1f, true);

}

Try this script, maybe it fixes it.
I made it so that the lever was suck after it had been pulled, but it still created more steam just from touching it...

Hey that script actualy worked, what did you change? Thanks Smile
10-25-2012, 03:29 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#4
RE: Need help, again :P

(10-25-2012, 03:29 PM)Zaapeer Wrote:
(10-25-2012, 03:12 PM)The chaser Wrote: You could set the lever stuck when the coal is inside, so it can't make more stuff.

void GhostFunc(string &in asParent, string &in asChild, int alState)

{

AddPropForce("vase01_1", 0, 0, -2000, "world");

StartPlayerLookAt("vase01_1", 5, 10, "");

AddTimer("StopLookTimer1", 0.2f, "StopLookFunc1");

PlaySoundAtEntity("", "react_scare.snt", "Player", 0.1f, true);

}

Try this script, maybe it fixes it.
I made it so that the lever was suck after it had been pulled, but it still created more steam just from touching it...

Hey that script actualy worked, what did you change? Thanks Smile
You've put "player" instead of "Player". "Player" is always this way, never forget it.
And, by the lever, you could do this:

if (alState==1) //When lever is used
{
if(GetLocalVarInt("Var_coals")==3)//////This is a counter. Every coal should add 1 to it. This represents that there's a missing coal.
{
///Stuff like saying there isn't enough coal.
}
if(GetLocalVarInt("Var_coals")==4)//If the number of coals is 4, of course
{
//Create particles, sounds and stuff.
SetLocalVarInt("Var_coals", 0);///This will put the coals variable to 0, and it will make the lever unuseful another time. +, the coals couldn't collapse another time with the area, so the variable would be this way forever.
}

Hope that helped. Smile

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
(This post was last modified: 10-25-2012, 04:29 PM by The chaser.)
10-25-2012, 04:27 PM
Find
ZodiaC Offline
Member

Posts: 120
Threads: 8
Joined: Oct 2012
Reputation: 2
#5
RE: Need help, again :P

(10-25-2012, 04:27 PM)The chaser Wrote: You've put "player" instead of "Player". "Player" is always this way, never forget it.
And, by the lever, you could do this:

if (alState==1) //When lever is used
{
if(GetLocalVarInt("Var_coals")==3)//////This is a counter. Every coal should add 1 to it. This represents that there's a missing coal.
{
///Stuff like saying there isn't enough coal.
}
if(GetLocalVarInt("Var_coals")==4)//If the number of coals is 4, of course
{
//Create particles, sounds and stuff.
SetLocalVarInt("Var_coals", 0);///This will put the coals variable to 0, and it will make the lever unuseful another time. +, the coals couldn't collapse another time with the area, so the variable would be this way forever.
}

Hope that helped. Smile
Wait a Sec!How did you know that there is 3 coals inside already???(if(GetLocalVarInt("Var_coals")==3))
I would prefer instead of (if(GetLocalVarInt("Var_coals")==3)//////This is a counter. Every coal
should add 1 to it. This represents that there's a missing coal.
{
///Stuff like saying there isn't enough coal.
}
if(GetLocalVarInt("Var_coals")==4)//If the number of coals is 4, of course
{
//Create particles, sounds and stuff.
SetLocalVarInt("Var_coals",
0);///This will put the coals variable to 0, and it will make the lever
unuseful another time. +, the coals couldn't collapse another time with
the area, so the variable would be this way forever.
}
)
Something like that:

if(GetLocalVarInt("Var_coals")<3)//////This is a counter. Every coal
should add 1 to it. This represents that there's a missing coal.

{
///Stuff like saying there isn't enough coal.
}
else if(GetLocalVarInt("Var_coals")==4) //If the number of coals is 4, of course

{
SetLeverInteractionDisablesStuck(string& asName, bool abX);//Make the appropriate changes
//Create particles, sounds and stuff.
}
else
{
//Type a message saying that there is too many coals
}

I prefer this way but correct me if I'm wrong or my way isn't good enough

[Image: 2H1Mc.jpg]
10-25-2012, 06:48 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#6
RE: Need help, again :P

(10-25-2012, 06:48 PM)belikov Wrote:
(10-25-2012, 04:27 PM)The chaser Wrote: You've put "player" instead of "Player". "Player" is always this way, never forget it.
And, by the lever, you could do this:

if (alState==1) //When lever is used
{
if(GetLocalVarInt("Var_coals")==3)//////This is a counter. Every coal should add 1 to it. This represents that there's a missing coal.
{
///Stuff like saying there isn't enough coal.
}
if(GetLocalVarInt("Var_coals")==4)//If the number of coals is 4, of course
{
//Create particles, sounds and stuff.
SetLocalVarInt("Var_coals", 0);///This will put the coals variable to 0, and it will make the lever unuseful another time. +, the coals couldn't collapse another time with the area, so the variable would be this way forever.
}

Hope that helped. Smile
Wait a Sec!How did you know that there is 3 coals inside already???(if(GetLocalVarInt("Var_coals")==3))
I would prefer instead of (if(GetLocalVarInt("Var_coals")==3)//////This is a counter. Every coal
should add 1 to it. This represents that there's a missing coal.
{
///Stuff like saying there isn't enough coal.
}
if(GetLocalVarInt("Var_coals")==4)//If the number of coals is 4, of course
{
//Create particles, sounds and stuff.
SetLocalVarInt("Var_coals",
0);///This will put the coals variable to 0, and it will make the lever
unuseful another time. +, the coals couldn't collapse another time with
the area, so the variable would be this way forever.
}
)
Something like that:

if(GetLocalVarInt("Var_coals")<3)//////This is a counter. Every coal
should add 1 to it. This represents that there's a missing coal.

{
///Stuff like saying there isn't enough coal.
}
else if(GetLocalVarInt("Var_coals")==4) //If the number of coals is 4, of course

{
SetLeverInteractionDisablesStuck(string& asName, bool abX);//Make the appropriate changes
//Create particles, sounds and stuff.
}
else
{
//Type a message saying that there is too many coals
}

I prefer this way but correct me if I'm wrong or my way isn't good enough
I think it's ok. You've just put a "SetLeverInteractionDisablesStuck". And, the coals: The number of coals are usually put in are four, so I thought that maybe you did the same Big Grin

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
10-25-2012, 08:23 PM
Find
ZodiaC Offline
Member

Posts: 120
Threads: 8
Joined: Oct 2012
Reputation: 2
#7
RE: Need help, again :P

(10-25-2012, 08:23 PM)The chaser Wrote: I think it's ok. You've just put a "SetLeverInteractionDisablesStuck". And, the coals: The number of coals are usually put in are four, so I thought that maybe you did the same Big Grin
Yea prety much that's the difference but one more question:
I use 3 if: One for coals_put<4 (this will tell the user to put more coals), One for coals_put==4 (This will continue the process) and the final coals_put>4 (To tell the user that he put too many coals Not necessary)
On the other hand you use this if(GetLocalVarInt("Var_coals")==3) (But This will work only when the user has put 3 coals) and this if(GetLocalVarInt("Var_coals")==4) (Well this has been already explained)
So question time!
I) What will happen when the user puts 2 or 1 coal (Absolutly nothing I guess..)?
II) What will happen when the user puts 5,6,7,8,.......(Again Nothing?)?
So I believe your script would work pretty good only if there would be a message before the player starts to put coals...
Tell me if I am wrong. Smile

[Image: 2H1Mc.jpg]
10-25-2012, 08:51 PM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#8
RE: Need help, again :P

I should do the same script but repeated. Maybe I could use a for loop, but I'm not really sure how it would be.

Sorry for my laziness right now, but an If should be used all the time, with different values.

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
10-25-2012, 09:27 PM
Find
ZodiaC Offline
Member

Posts: 120
Threads: 8
Joined: Oct 2012
Reputation: 2
#9
RE: Need help, again :P

(10-25-2012, 09:27 PM)The chaser Wrote: I should do the same script but repeated. Maybe I could use a for loop, but I'm not really sure how it would be.

Sorry for my laziness right now, but an If should be used all the time, with different values.
No need to worry Smile
So you want to combine if with for..Hmm too many commands for my style but should do the trick!

[Image: 2H1Mc.jpg]
10-25-2012, 10:17 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#10
RE: Need help, again :P

How about having 3 different vars? And then just check if all 3 vars == 1? If they are, start the machine.
And an else { PutMoreCoal }

Trying is the first step to success.
(This post was last modified: 10-25-2012, 10:50 PM by FlawlessHappiness.)
10-25-2012, 10:49 PM
Find




Users browsing this thread: 2 Guest(s)