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
I need help with creating more than 1 scripts for my custom story
ironman0001 Offline
Member

Posts: 53
Threads: 8
Joined: Sep 2012
Reputation: 0
#1
I need help with creating more than 1 scripts for my custom story

I am new to scripting and this is my first custom story! i know each script needs a void but i don't know what void to add! besides void onstart and onenter and onleave But i wanna create a bunch of scripts and iv'e seen scripts that had more than just those! Here is my script so far void OnStart()
{
AddEntityCollideCallback("Player", "TeleportScript", "PoopedYaPants", true, 1);
}

void PoopedYaPants(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Jesus", true);
AddPropForce("Jesus", 0, 0, 10000, "world");
PlaySoundAtEntity("", "24_iron_maiden.snt", "Jesus", 0, false);

PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false);
}

void OnEnter()
{
AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1);
}


void Message1(string &in asChild, string &in asParent, int alState)
{
SetMessage("Messages", "Popup1", 0); //This stands for ("Name of category", "Name of entry", time to be displayed on the screen);.
}

I want a message to pop up as soon as you spawn! Then when you go down stairs, A dead guy teleports and flies in your face! Big Grin Can i replace void OnEnter with anything?
09-27-2012, 11:32 PM
Find
i3670 Offline
Posting Freak

Posts: 1,308
Threads: 74
Joined: Oct 2011
Reputation: 36
#2
RE: I need help with creating more than 1 scripts for my custom story

Why would you need any more than OnStart, OnEnter and OnLeave? They pretty much cover all you need.

As for the "message pop-up" just put the ShowMessage in the OnStart

"What you think is irrelevant" - A character of our time

A Christmas Hunt
(This post was last modified: 09-28-2012, 12:56 AM by i3670.)
09-28-2012, 12:55 AM
Find
ironman0001 Offline
Member

Posts: 53
Threads: 8
Joined: Sep 2012
Reputation: 0
#3
RE: I need help with creating more than 1 scripts for my custom story

(09-28-2012, 12:55 AM)i3670 Wrote: Why would you need any more than OnStart, OnEnter and OnLeave? They pretty much cover all you need.

As for the "message pop-up" just put the ShowMessage in the OnStart
Cause those aren't the only two i'm adding! And put "ShowMessage" in the OnStart? Where on it? In between ()?
09-28-2012, 02:43 AM
Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#4
RE: I need help with creating more than 1 scripts for my custom story

Have you looked at other scripts to get an idea of how they work? It may help a bit.
09-28-2012, 03:58 AM
Find
ironman0001 Offline
Member

Posts: 53
Threads: 8
Joined: Sep 2012
Reputation: 0
#5
RE: I need help with creating more than 1 scripts for my custom story

(09-28-2012, 03:58 AM)Statyk Wrote: Have you looked at other scripts to get an idea of how they work? It may help a bit.
Yeah, But it's pretty confusing though
09-28-2012, 04:17 AM
Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#6
RE: I need help with creating more than 1 scripts for my custom story

Have it like this:

void OnStart()
{
AddEntityCollideCallback("Player", "TeleportScript", "PoopedYaPants", true, 1);
SetMessage("Messages", "Popup1", 0);
}

void PoopedYaPants(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Jesus", true);
AddPropForce("Jesus", 0, 0, 10000, "world");
PlaySoundAtEntity("", "24_iron_maiden.snt", "Jesus", 0, false);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
}

void OnEnter()
{
AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1);
}
(This post was last modified: 09-28-2012, 04:20 AM by Statyk.)
09-28-2012, 04:20 AM
Find
ironman0001 Offline
Member

Posts: 53
Threads: 8
Joined: Sep 2012
Reputation: 0
#7
RE: I need help with creating more than 1 scripts for my custom story

(09-28-2012, 04:20 AM)Statyk Wrote: Have it like this:

void OnStart()
{
AddEntityCollideCallback("Player", "TeleportScript", "PoopedYaPants", true, 1);
SetMessage("Messages", "Popup1", 0);
}

void PoopedYaPants(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Jesus", true);
AddPropForce("Jesus", 0, 0, 10000, "world");
PlaySoundAtEntity("", "24_iron_maiden.snt", "Jesus", 0, false);
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
}

void OnEnter()
{
AddEntityCollideCallback("Player", "Message_1", "Message1", true, 1);
}
Thanks for the help! But how do i know how to do that for when i wanna create more scripts?
09-28-2012, 04:41 AM
Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#8
RE: I need help with creating more than 1 scripts for my custom story

depends if you want it to happen when you walk into a script area or a timer. Read up on the wiki. should help =]

http://wiki.frictionalgames.com/hpl2/amnesia/start

Tabs on the left should help you with what you're looking for.
09-28-2012, 04:47 AM
Find
ironman0001 Offline
Member

Posts: 53
Threads: 8
Joined: Sep 2012
Reputation: 0
#9
RE: I need help with creating more than 1 scripts for my custom story

(09-28-2012, 04:47 AM)Statyk Wrote: depends if you want it to happen when you walk into a script area or a timer. Read up on the wiki. should help =]

http://wiki.frictionalgames.com/hpl2/amnesia/start

Tabs on the left should help you with what you're looking for.
But they would all say void OnStart () At the beginning... But if i wanna make alot of scripts, I can't keep using void onstart...
09-28-2012, 04:54 AM
Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#10
RE: I need help with creating more than 1 scripts for my custom story

No, all your scripts start from there. You should never have more than one OnStart, OnLeave, or OnEnter.
09-28-2012, 05:08 AM
Find




Users browsing this thread: 1 Guest(s)