Frictional Games Forum (read-only)

Full Version: Scripting Help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
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
Does the player see it move, or does the player only notice that it HAS moved?
(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)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!
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
(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
ಠ_ಠ Umm...
(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
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
(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.
Pages: 1 2