Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 16 Vote(s) - 4.44 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scripts Recollection
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#71
RE: Scripts Recollection

(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.

(This post was last modified: 03-05-2011, 12:18 AM by Pandemoneus.)
03-05-2011, 12:16 AM
Find
Raymond Offline
Member

Posts: 126
Threads: 24
Joined: Feb 2011
Reputation: 0
#72
RE: Scripts Recollection

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.

One World To Another [DEMO] coming soon.
(This post was last modified: 03-05-2011, 08:17 AM by Raymond.)
03-05-2011, 08:14 AM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#73
RE: Scripts Recollection

You need to put it into quotation marks.
E.g.: "PlayerStartArea_2"

(This post was last modified: 03-05-2011, 05:38 PM by Pandemoneus.)
03-05-2011, 05:38 PM
Find
Raymond Offline
Member

Posts: 126
Threads: 24
Joined: Feb 2011
Reputation: 0
#74
RE: Scripts Recollection

(03-05-2011, 05:38 PM)Pandemoneus Wrote: You need to put it into quotation marks.
E.g.: "PlayerStartArea_2"

Works, thanks Smile.

One World To Another [DEMO] coming soon.
03-06-2011, 02:49 AM
Find
CrushedRaiD Offline
Member

Posts: 115
Threads: 10
Joined: Dec 2010
Reputation: 0
#75
RE: Scripts Recollection

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
03-07-2011, 10:07 AM
Find
wisecow Offline
Junior Member

Posts: 4
Threads: 1
Joined: Mar 2011
Reputation: 0
#76
RE: Scripts Recollection

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'{'"

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
04-17-2011, 08:05 PM
Find
wisecow Offline
Junior Member

Posts: 4
Threads: 1
Joined: Mar 2011
Reputation: 0
#77
RE: Scripts Recollection

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
(This post was last modified: 04-18-2011, 04:32 PM by wisecow.)
04-18-2011, 04:31 PM
Find
nkmol Offline
Senior Member

Posts: 252
Threads: 19
Joined: Feb 2011
Reputation: 4
#78
RE: Scripts Recollection

i'm trying to use the moveable_book, but it seems it doesn't work as a normal lever :S
i used this script :
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
04-18-2011, 05:42 PM
Find
Jahffax Offline
Junior Member

Posts: 7
Threads: 1
Joined: Apr 2011
Reputation: 0
#79
RE: Scripts Recollection

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!
(This post was last modified: 04-23-2011, 07:21 AM by Jahffax.)
04-23-2011, 07:05 AM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#80
RE: Scripts Recollection

(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.

04-23-2011, 10:48 PM
Find




Users browsing this thread: 3 Guest(s)