The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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
Beginning Scripting, Requesting a [More thorough] Tutorial
ErichK Offline
Junior Member

Posts: 2
Threads: 1
Joined: Sep 2010
Reputation: 0
#1
Beginning Scripting, Requesting a [More thorough] Tutorial

Hi there! Long time fan, first time poster.

Anyway, I've been searching around and trying countless different things, but I have finally given up and resorted to posting on here.

I was trying to refer to this thread:

http://www.frictionalgames.com/forum/thread-4425.html

In order to make a "scary door." However, I have a few issues that the HPL2 tutorial didn't seem to want to go over.

Firstoff, here is my .hps file:

//The Waking Up Feature that starts as soon as map loads.
void wakeUp () {
    FadeOut(0);     // Instantly fades the screen out. (Good for starting the game)
    FadeIn(20);      // Amount of seconds the fade in takes
    FadeImageTrailTo(2, 2);
    FadeSepiaColorTo(100, 4);
    SetPlayerActive(false);    
    FadePlayerRollTo(50, 220, 220);                 // "Tilts" the players head
    FadeRadialBlurTo(0.15, 2);
    SetPlayerCrouching(true);              // Simulates being on the ground
    AddTimer("trig1", 11.0f, "beginStory");            // Change '11.0f' to however long you want the 'unconciousness' to last
}

void beginStory(string &in asTimer){
    ChangePlayerStateToNormal();
    SetPlayerActive(true);
    FadePlayerRollTo(0, 33, 33);        // Change all settings to defaults
    FadeRadialBlurTo(0.0, 1);
    FadeSepiaColorTo(0, 4);
    SetPlayerCrouching(false);
    FadeImageTrailTo(0,1);
}

////////////////////////////
// Run first time starting map
void OnStart()
{  
    //Allows you to wake up
    wakeUp();

    //Add the Lantern and 10 Tinderboxes when in Debug mode, always good to have light!
    if(ScriptDebugOn())
    {
        GiveItemFromFile("lantern", "lantern.ent");

        for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
    }
}

////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

Everything on there works perfectly, but when I try to add the "scary door" code from the above link, all hell breaks loose.

I was wondering if anyone could please help me with the following issues:

1. Could you please provide a completed example of how the code would look in finished form, i.e. adding it to what code I posted here?

2. Elaborate on what needs to go where (in terms of in the script itself - for example, in:

SetEntityPlayerInteractCallback("name_of_door_here", "FunctionToCall", true);

Does "FunctionToCall" mean "insert text here," and if so, are these the functions?:

void FunctionToCall(string &in entity)
{
    PlaySoundAtEntity("instance_name", "soundfile.ogg/snt", "name_of_entity_to_play_sound_from", 0, false);
    SetEntityActive("name_of_grunt_or_brute", true); //Spawn monster
}

3. And lastly, what snippets of code do I put in the entity tab of the door, under the Callback function boxes?

Thanks for any help. I've been trying to pull up the developer code as well as examples from other custom stories, but I'm still too new at it to be able to figure it out on my own. I'm sure, however, that if I get an example of a finished (or close to finished) product, I can get the rest on my own. Thanks!

-Erich
09-21-2010, 08:13 PM
Find


Messages In This Thread
Beginning Scripting, Requesting a [More thorough] Tutorial - by ErichK - 09-21-2010, 08:13 PM



Users browsing this thread: 1 Guest(s)