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
Question about scripting
Armored Cow Offline
Member

Posts: 72
Threads: 3
Joined: Sep 2010
Reputation: 0
#10
RE: Question about scripting

////////////////////////
// Run first time starting map
void OnStart()
{
    //Begin ambient music
    PlayMusic("04_amb.ogg", true, 0.5, 3, 0, true);
    
    //Callback to sound steps and door slam
    AddEntityCollideCallback("Player", "area_door_slam", "CollideDoorSlam", true, 1);
    
    //Callback to disable ambient music
    AddEntityCollideCallback("Player", "area_end", "CollideEnd", true, 1);
    
    //Callback to create smoke monster
    AddEntityCollideCallback("Player", "area_smoke_trigger", "CollideSmoke", true, 1);
    
    //Key1
    AddUseItemCallback("", "key_study", "door_1", "UseKey", true);
    
    //Key2
    AddUseItemCallback("", "key_study2", "door_2", "UseKey", true);

    //Free Lantern and Tinderboxes
    if(ScriptDebugOn())
    {
        GiveItemFromFile("lantern", "lantern.ent");
        
        for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
    }
}

////////////////////////
//Function called when using a key that unlocks the door
void UseKey(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked(asEntity, false, true);

    RemoveItem(asItem);
}

//This function is called when the player steps into area_smoke_trigger
void CollideSmoke(string &in asParent, string &in asChild, int alState)
{
    CreateParticleSystemAtEntity("", "ps_cloud_thing02.ps", "area_smoke", false);    
    
    PlaySoundAtEntity("", "13_machine_fail.snt", "area_smoke", 0, false);    
    
    PlaySoundAtEntity("", "sanity_pant1.snt, "Player", 0, false);    
    
    GiveSanityDamage(15.0f, true);
}

//This function is called when the player steps into area_door_slam
void CollideDoorSlam(string &in asParent, string &in asChild, int alState)
{
    PlaySoundAtEntity("walking", "04_big_feet.snt", "AreaSFX", 0, false);
    
    AddTimer("10_close_door.snt", 9.3f, "TimerSoundSequence");
}

void TimerSoundSequence(string &in asTimer)
{
    PlaySoundAtEntity("sound_1", "10_close_door.snt", "AreaSFX", 0, false);
}

//This function is called by area_end and disables ambient music
void CollideEnd(string &in asParent, string &in asChild, int alState)
{
    StopMusic(3, 0);
}

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

}

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

}
09-17-2010, 04:40 PM
Find


Messages In This Thread
Question about scripting - by w 1 z - 09-17-2010, 03:08 AM
RE: Question about scripting - by MulleDK19 - 09-17-2010, 03:21 AM
RE: Question about scripting - by w 1 z - 09-17-2010, 03:57 AM
RE: Question about scripting - by Armored Cow - 09-17-2010, 04:36 AM
RE: Question about scripting - by w 1 z - 09-17-2010, 04:50 AM
RE: Question about scripting - by jens - 09-17-2010, 07:11 AM
RE: Question about scripting - by w 1 z - 09-17-2010, 07:39 AM
RE: Question about scripting - by Armored Cow - 09-17-2010, 03:40 PM
RE: Question about scripting - by jens - 09-17-2010, 04:21 PM
RE: Question about scripting - by Armored Cow - 09-17-2010, 04:40 PM
RE: Question about scripting - by jens - 09-17-2010, 05:45 PM
RE: Question about scripting - by MulleDK19 - 09-17-2010, 05:55 PM
RE: Question about scripting - by Armored Cow - 09-17-2010, 07:02 PM



Users browsing this thread: 1 Guest(s)