Frictional Games Forum (read-only)

Full Version: New Editor looking for help.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello Frictional Games Forum!
I've been working on my very first custom story for a week now.
So far it's looking pretty good. Smile

I have some problems though, with scripting! Confused











1.
I've made a wake-up script. It works wonderful. The player wakes up in the middle of a forest and has no clue why he's there.
A message is displayed: "Oh god... My head... Wha-... What happened?"

Basic story...

Anyways: I'm trying to make a Screen Message show when he LEAVES the first area (PlayerStartArea is inside this bigger area, which i named).
The message that i want displayed is as following: "I... I remember seeing someone. In the forest."

My .lang file currently looks like this:

Code:
<LANGUAGE>    <CATEGORY Name="CustomStoryMain">        <Entry Name="Description">Dark approaches.[br][br]Your camp's bonfire is beginning to fade. You will need help if you'd like to stay alive out here.[br]Who are you? How did you get here? You don't have the answers. They've faded with the dusk...</Entry>    </CATEGORY>        <CATEGORY Name="Journal">        <Entry Name="Note_theletter_Name">Familiar Note...</Entry>        <Entry Name="Note_theletter_Text">I know. You can't remember. I can't give you any answers. I've set up a camp here, in a cleft of the woods, but this forest... [br]It is a cursed one. [br]You're going to need to get out of here, there are no-...[br][br]The rest of the note is covered with spilled ink.</Entry>    </CATEGORY>        <CATEGORY Name="Messages">        <Entry Name="WakeUp">Oh god... My head... Wha-... What happened?</Entry>        <Entry Name="Where">I... I remember seeing someone. In the forest.</Entry>        <Entry Name="GetOut">I should probably get out of here.</Entry>    </CATEGORY>    </LANGUAGE>

and i reckon that's all good.

Here is my .hps file:
Code:
void OnStart()    {    CollideForestArea();    PlaySoundAtEntity("WakeUp", "flashback_flash.snt", "ForestArea", 10, false);    SetPlayerLampOil(0.0f);    SetMessage("Messages", "WakeUp", 6);    AddEntityCollideCallback("Player", "ForestArea_1", "LeaveCamp", false, -1);    AddEntityCollideCallback("Player", "ScriptArea_1", "CollideForest", false, 0);    PlaySoundAtEntity("WakeUp_1", "react_breath_slow.snt", "ForestArea", 4, false);}
void LeaveCamp(){    SetMessage("Messages", "Where", 5.0f);}
void CollideForest(){    PlaySoundAtEntity("ForestScare00", "scare_ghost.snt", "ScripArea_1", 10, false);    PlaySoundAtEntity("ForestScare01", "react_scare.snt", "ScripArea_1", 10, false);}void CollideForestArea() {    FadeOut(0);    FadeIn(20);    FadeImageTrailTo(2, 2);    FadeSepiaColorTo(100, 4);    SetPlayerActive(false);    FadePlayerRollTo(80, 220, 220);    FadeRadialBlurTo(0.15, 2);    SetPlayerCrouching(true);    AddTimer("trig1", 6.0f, "beginStory");}
void beginStory(string &in asTimer){    ChangePlayerStateToNormal();    SetPlayerActive(true);    FadePlayerRollTo(0, 50, 50);    FadeRadialBlurTo(0.0, 1);    FadeSepiaColorTo(0, 4);    SetPlayerCrouching(false);    FadeImageTrailTo(0,1);}


void OnEnter(){AddTimer("timer1", 0, "what");}

void OnLeave(){
}


I've messed around with it a bit, but I can't get it to work.
Please, tell me what I'm doing wrong. I suspect there's something wrong in the .hps file, as I am kind of new to scripting.
The weird thing is, when I load the map in Amnesia, the game doesn't give me any kind of error in script file.















2.
When the player moves on in to the forest, a scare sound is supposed to be played, and also a react sound. It's also supposed to be triggered by an area.
Here's the part i put into the onStart block:

Code:
AddEntityCollideCallback("Player", "ScriptArea_1", "CollideForest", false, 0);

And here is the new void I created further down the script:

Code:
void CollideForest(){    PlaySoundAtEntity("ForestScare00", "scare_ghost.snt", "ScripArea_1", 10, false);    PlaySoundAtEntity("ForestScare01", "react_scare.snt", "ScripArea_1", 10, false);}

It does NOT WORK. I was playing around with the script for about half an hour, but I just can't get it to work.
I'm also going to display a message here saying: "I should probably get out of here."
And I'm also going to make the player look into the forest.
I need help, please ! Huh

If you see any other errors in my script file, please tell me!
Thanks for your support! Shy
1. Adding string &in asParent, string &in asChild, int alState after your collide callback functions (I'm bad with these terms) should do the trick. Like this:

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

I can't explain it well, but when calling the thing that happens after the collide. When using CollideCallback, you need that stuff (Callback syntax?) behind your function (the void thing)

2. Same thing:
void CollideForest(string &in asParent, string &in asChild, int alState)


edit. btw your code seems to be pretty mess, is it just because of copying or aren't you using similar program to notepad++ for editing text?
About the second part, you're missing something:

PHP Code:
void CollideForest(string &in asParentstring &in asChildint alState)//You were missing this function's parameters.
{
PlaySoundAtEntity("ForestScare00""scare_ghost.snt",  "ScriptArea_1"10false);//I suppose this is ScriptArea and not ScripArea
PlaySoundAtEntity("ForestScare01",  "react_scare.snt""ScriptArea_1"10false);


And please use [php] code brackets when writting code in the forums. As Web Devs didn't create syntax highlighting for AngelScript, you can use php which is similar.
(10-21-2011, 11:43 PM)Khyrpa Wrote: [ -> ]1. Adding string &in asParent, string &in asChild, int alState after your collide callback functions (I'm bad with these terms) should do the trick. Like this:

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

I can't explain it well, but when calling the thing that happens after the collide. When using CollideCallback, you need that stuff (Callback syntax?) behind your function (the void thing)

2. Same thing:
void CollideForest(string &in asParent, string &in asChild, int alState)


edit. btw your code seems to be pretty mess, is it just because of copying or aren't you using similar program to notepad++ for editing text?
It's all in order in my notepad++ document! something must have gone wrong copy pasting... Smile Thanks so much for the response!
(10-21-2011, 11:49 PM)nemesis567 Wrote: [ -> ]About the second part, you're missing something:

PHP Code:
void CollideForest(string &in asParentstring &in asChildint alState)//You were missing this function's parameters.
{
PlaySoundAtEntity("ForestScare00""scare_ghost.snt",  "ScriptArea_1"10false);//I suppose this is ScriptArea and not ScripArea
PlaySoundAtEntity("ForestScare01",  "react_scare.snt""ScriptArea_1"10false);


And please use [php] code brackets when writting code in the forums. As Web Devs didn't create syntax highlighting for AngelScript, you can use php which is similar.
I'm sorry about the messy code Smile It's in order on my pc. Thanks for response! I did spell wrong on "ScriptArea_1", thanks for letting me know Smile



Also, How do I increase the volume of scripted sounds?
Try tweaking the afFadeTime (0 does not fade the sound at all) or just move the area where the sound comes from closer to the player
(10-22-2011, 01:45 AM)Khyrpa Wrote: [ -> ]Try tweaking the afFadeTime (0 does not fade the sound at all) or just move the area where the sound comes from closer to the player
Changing afFadeTime worked like a charm! Thank you alot! Smile