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
Scripting Help
Clear Offline
Junior Member

Posts: 19
Threads: 4
Joined: May 2012
Reputation: 0
#1
Scripting Help

Hey guys,

I'm really new at Scripting and i had this idea this other day of making a statue that moves everytime you reach a certain spot. (Script Area and such)

I wanna make the statue to pretty much move multiple times at diffrent locations, The idea of the statue is going to cover the whole story so i think it's pretty advanced maybe,

For example, let's say the name of the statue is: Statue1
And the area script is: SArea1 (Wich will continue to SArea2, SArea3, etc)

So if any of you awesome people out there could tell me what's the code to make this work, I'd love you guys forever xD
Thanks for reading and i'd appreciate any response! Big Grin
06-12-2012, 04:08 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: Scripting Help

Does the player see it move, or does the player only notice that it HAS moved?

Trying is the first step to success.
06-12-2012, 04:11 PM
Find
Clear Offline
Junior Member

Posts: 19
Threads: 4
Joined: May 2012
Reputation: 0
#3
RE: Scripting Help

(06-12-2012, 04:11 PM)beecake Wrote: Does the player see it move, or does the player only notice that it HAS moved?
I was thinking the same thing, to make it like a Weeping angel or SCP-173 (You can google it) when you turn around it comes closer and closer and then Bam, you're dead.
But after a while of seeing most of the scripting options i could see it's not possible, but if it is, feel free to share Big Grin

The idea is that the player goes to a certain area wich activates the statue to teleport closer and closer, sorta like a script area, that red one that activates stuffs when you go by pass it, it doesn't really matter if he see it or not =D

Thanks for the reply
06-12-2012, 04:17 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#4
RE: Scripting Help

(06-12-2012, 04:17 PM)Clear Wrote:
(06-12-2012, 04:11 PM)beecake Wrote: Does the player see it move, or does the player only notice that it HAS moved?
I was thinking the same thing, to make it like a Weeping angel or SCP-173 (You can google it) when you turn around it comes closer and closer and then Bam, you're dead.
But after a while of seeing most of the scripting options i could see it's not possible, but if it is, feel free to share Big Grin

The idea is that the player goes to a certain area wich activates the statue to teleport closer and closer, sorta like a script area, that red one that activates stuffs when you go by pass it, it doesn't really matter if he see it or not =D

Thanks for the reply
You need to have a few of these statues set up, as well as multiple script areas. The easiest way to produce the effect you're looking for is to use the SetEntityActive function multiple times.

Imagine you have several statues lines up, the one in the back being active; when the player collides with a script area, set the one in the back inactive, and the set the one in front of it active, this will give the illusion that the statue's moving. Here's a script off the top of my head (so basically it might not be 100% accurate):


void OnStart()
{
AddEntityCollideCallback("Player", "AreaMoveStatue_1", "CollideAreaMoveStatue_1", true, 1);
AddEntityCollideCallback("Player", "AreaMoveStatue_2", "CollideAreaMoveStatue_2", true, 1);
}

void CollideAreaMoveStatue_1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Statue_1", false);
SetEntityActive("Statue_2", true);
}

void CollideAreaMoveStatue_2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Statue_2", false);
SetEntityActive("Statue_3", true);
}
////end script

To make this work, the Script (Red) areas will need to be called "AreaMoveStatue_1" and "AreaMoveStatue_2". The statues will need to be named "Statue_1" "Statue_2" & "Statue_3'. You can keep adding numbers and callbacks as long as you wish. Hope that helped!

I rate it 3 memes.
06-12-2012, 04:37 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#5
RE: Scripting Help

You could make an illusion so the player thinks that he is moving.

Use a lot of statues that are inactive and 1 that is active. Then to make him move:
First Statue (Active) => Inactive
Statue that is closer to player (Inactive) => Active

Then repeat repeat repeat

Trying is the first step to success.
06-12-2012, 04:38 PM
Find
Clear Offline
Junior Member

Posts: 19
Threads: 4
Joined: May 2012
Reputation: 0
#6
RE: Scripting Help

(06-12-2012, 04:38 PM)beecake Wrote: You could make an illusion so the player thinks that he is moving.

Use a lot of statues that are inactive and 1 that is active. Then to make him move:
First Statue (Active) => Inactive
Statue that is closer to player (Inactive) => Active

Then repeat repeat repeat


You're a GENIUS.
Thank you so much man, I'd find the code somewhere =D
Thankssss!!! <3
06-12-2012, 04:50 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#7
RE: Scripting Help

ಠ_ಠ Umm...

I rate it 3 memes.
(This post was last modified: 06-12-2012, 04:55 PM by Adny.)
06-12-2012, 04:55 PM
Find
Clear Offline
Junior Member

Posts: 19
Threads: 4
Joined: May 2012
Reputation: 0
#8
RE: Scripting Help

(06-12-2012, 04:37 PM)andyrockin123 Wrote:
(06-12-2012, 04:17 PM)Clear Wrote:
(06-12-2012, 04:11 PM)beecake Wrote: Does the player see it move, or does the player only notice that it HAS moved?
I was thinking the same thing, to make it like a Weeping angel or SCP-173 (You can google it) when you turn around it comes closer and closer and then Bam, you're dead.
But after a while of seeing most of the scripting options i could see it's not possible, but if it is, feel free to share Big Grin

The idea is that the player goes to a certain area wich activates the statue to teleport closer and closer, sorta like a script area, that red one that activates stuffs when you go by pass it, it doesn't really matter if he see it or not =D

Thanks for the reply
You need to have a few of these statues set up, as well as multiple script areas. The easiest way to produce the effect you're looking for is to use the SetEntityActive function multiple times.

Imagine you have several statues lines up, the one in the back being active; when the player collides with a script area, set the one in the back inactive, and the set the one in front of it active, this will give the illusion that the statue's moving. Here's a script off the top of my head (so basically it might not be 100% accurate):


void OnStart()
{
AddEntityCollideCallback("Player", "AreaMoveStatue_1", "CollideAreaMoveStatue_1", true, 1);
AddEntityCollideCallback("Player", "AreaMoveStatue_2", "CollideAreaMoveStatue_2", true, 1);
}

void CollideAreaMoveStatue_1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Statue_1", false);
SetEntityActive("Statue_2", true);
}

void CollideAreaMoveStatue_2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Statue_2", false);
SetEntityActive("Statue_3", true);
}
////end script

To make this work, the Script (Red) areas will need to be called "AreaMoveStatue_1" and "AreaMoveStatue_2". The statues will need to be named "Statue_1" "Statue_2" & "Statue_3'. You can keep adding numbers and callbacks as long as you wish. Hope that helped!
That is an amazing idea!
Really creative idea and I'm sure it'll work fine!
One last question if you can, What if i want to make a Moving Brick sound every time the statue "Moves" ?
I Allready have the sound file, .ogg.
Thanks again =D
06-12-2012, 04:57 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#9
RE: Scripting Help

You can also use "scrape_rock.snt"

But remember it needs an .snt file to be played

So everytime the 'active' script happens use:

PlaySoundAtEntity("RockScrape", "scrape_rock", "Player", 0.5f, false);

Make a script area around every statue (Both inactive or active).
Every inactive statue should have an inactive script around, and every active should be active.
The area should actually fill the hole width of the room so when the player turns around this happens:

void OnStart()
{

SetEntityPlayerLookAtCallback("ScriptArea_1", "StopScrapeSound", true);
///Do this with all the script areas
}
void StopScrapeSound(String &in asEntity, int alState)
{
if(alState == 1)
{
StopSound("RockScrape", 0.01);
}
}
I guess this should work.
Otherwise, try deleting the if-statement. Not sure if that will work

Trying is the first step to success.
(This post was last modified: 06-12-2012, 06:13 PM by FlawlessHappiness.)
06-12-2012, 06:10 PM
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#10
RE: Scripting Help

(06-12-2012, 04:38 PM)beecake Wrote: You could make an illusion so the player thinks that he is moving.

Use a lot of statues that are inactive and 1 that is active. Then to make him move:
First Statue (Active) => Inactive
Statue that is closer to player (Inactive) => Active

Then repeat repeat repeat
Andyrocking just explained that same >.< Also it doesnt have to be a snt sound file to be played.It can be ogg too.

(This post was last modified: 06-12-2012, 06:13 PM by Datguy5.)
06-12-2012, 06:13 PM
Find




Users browsing this thread: 1 Guest(s)