Frictional Games Forum (read-only)

Full Version: Scripts Recollection
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12
(03-04-2011, 11:01 PM)TheGreatCthulhu Wrote: [ -> ]When is OnStart() called? When the level is first loaded? Just once?
And OnEnter() - is it called every time the player comes back to the level?
What?

It is as you guessed.
And btw, your explanation was fine, but I guess people, that can't see such a simple error (and there IS a scripting tutorial on the wiki) or do not even try to look for it and copy & paste their scripts directly to the forum so someone else takes a look, care about that. Angel
I have seen a lot of people here in the forums asking other people to make scripts for them, which makes me quite sad. Sleepy

Oh yeah, and my bad about forgetting that void.
What do i need to write in the "teleport_name" in the "Teleport player when he touches an area"? I put PlayerStartArea_2 but i got an error.
You need to put it into quotation marks.
E.g.: "PlayerStartArea_2"
(03-05-2011, 05:38 PM)Pandemoneus Wrote: [ -> ]You need to put it into quotation marks.
E.g.: "PlayerStartArea_2"

Works, thanks Smile.
I need help with a script Blush
When player touches the door, he will hear growling, 1 second after that he will turn around quickly and make the scared breath sound Big Grin
Then the monster will spawn behind the corner.. I'm not that good at scripting so.. If someone has the time to help me i would be pleased Blush
Hi, I'm new to the forums and not very good at scripting. I hope someone can help me out with something here, i made my map then i wanted some scripts so i added the "key-on-door" script and it worked fine. Then i added the "monster-activate" script and when i try to load my map it says:
"FATAL ERROR: Could not load script
file 'custom_stories/mymapname/maps/ch01/mymapname.hps'! main (14, 1) : ERR : Unexpected token'{'"

Code:
void OnStart()
{
    AddUseItemCallback("", "exitkey_1", "exitdoor_1", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("exitdoor_1", false, true);
    PlaySoundAtEntity("", "unlock_door", "exitdoor_1", 0, false);
    RemoveItem("exitkey_1");
}


{
  AddEntityCollideCallback("Player" , "ScriptArea_1" , "MonsterFunc1" , true , 1);
}
void MonsterFunc1(string &in asPraent , string &in asChild , int alState)
{
  SetEntityActive("servant_grunt_1" , true);
}
Plz help me out here Shy thanks! P.S: sorry for my bad english and sorry if someone already asked this Blush
edit: haha, silly me Tongue I just realised what was wrong so np ppl.
edit again: ops i accidently did a new reply srry Sad
i'm trying to use the moveable_book, but it seems it doesn't work as a normal lever :S
i used this script :
Code:
void OnStart()
{
SetEntityConnectionStateChangeCallback("book_moveable_1", "BookMoved");
}

void BookMoved(string &in EntityName, int alState)
{
    AddDebugMessage("book_moveable_1" + "'s current state: " + alState, false);
    
    if(alState == 1)
    {
        SetPropHealth("default_broken01_1", 0);
        StartScreenShake(0.07f, 0.3f, 1, 1);
        SetLeverStuckState("book_moveable_1", 1, true);
    }
}

even the DebugMessage doesn't work.
I don't get any error, think it has to do whith the OnStart line though. But i can't find a other script that works. And yes, i putted the callback in the level editor Big Grin
Hey!

I would want a script for screen effects. And for the situation where happens like this: I go to area I have marked and suddenly a locked door is unlocked.. (Monster in a closet will be activated and comes out, It's locked because I don't want player go open closet and see there no one and then monster just appears there.. unrealistic you know) Smile

Those would be nice.

I have tried to script those but I can't get them right.. :/ I specially want a screen effect which turns screen dark red!
(04-23-2011, 07:05 AM)Jahffax Wrote: [ -> ]Hey!

I would want a script for screen effects. And for the situation where happens like this: I go to area I have marked and suddenly a locked door is unlocked.. (Monster in a closet will be activated and comes out, It's locked because I don't want player go open closet and see there no one and then monster just appears there.. unrealistic you know) Smile

Those would be nice.

I have tried to script those but I can't get them right.. :/ I specially want a screen effect which turns screen dark red!

You don't need to lock the closet, just use this:

SetEntityInteractionDisabled(string& asName, bool abDisabled);

Example:

SetEntityInteractionDisabled("Closet", true);

That's all I can help at the moment.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12