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
Script Help i need some help
Putmalk Offline
Senior Member

Posts: 290
Threads: 13
Joined: Apr 2012
Reputation: 15
#10
RE: i need some help

Here, try this, see if it works. I am pretty sure .ogg files are acceptable in PlaySoundAtEntity. If not, you might want to try PlayGuiSound or something (non-3D sound effect).

I edited around some of the script which should make it easier to code. I commented them so you know what I did.

////////////////////////////
// Run first time starting map
void OnStart()
{  
    GiveItemFromFile("lantern", "lantern.ent");

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

    AddUseItemCallback("key1ondoor", "scarykey_1", "door_1", "KeyOnDoor", true);
    AddEntityCollideCallback("Player", "popout1", "PlaySound", true, 0);
}

//instead of making 50 key on door scripts, just call this function with different items/doors and they should work
void KeyOnDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked(asEntity, false, true); //I choose asEntity because that's the door
    PlaySoundAtEntity("unlock", "unlock_door", asEntity, 0, false); //I choose asEntity because that's the door
    RemoveItem(asItem); //I choose asItem as that's the item
}

//should always be asParent, asChild, alState
void PlaySound(string &in asParent, string &in asChild, int alState)
{
    if(HasItem("scarykey_1") == false) return; //do nothing if no key

    //I"m pretty sure you can place .ogg's here and have them play fine???
    PlaySoundAtEntity("scream", "21_scream10.ogg", "popout1", 0, false);
}

(This post was last modified: 05-28-2012, 06:22 PM by Putmalk.)
05-28-2012, 06:21 PM
Find


Messages In This Thread
i need some help - by TheIcyPickle - 05-28-2012, 04:24 AM
RE: i need some help - by Putmalk - 05-28-2012, 04:34 AM
RE: i need some help - by TheIcyPickle - 05-28-2012, 06:12 AM
RE: i need some help - by Putmalk - 05-28-2012, 06:55 AM
RE: i need some help - by TheIcyPickle - 05-28-2012, 07:27 AM
RE: i need some help - by Putmalk - 05-28-2012, 04:23 PM
RE: i need some help - by TheIcyPickle - 05-28-2012, 05:13 PM
RE: i need some help - by Putmalk - 05-28-2012, 05:29 PM
RE: i need some help - by TheIcyPickle - 05-28-2012, 06:11 PM
RE: i need some help - by Putmalk - 05-28-2012, 06:21 PM
RE: i need some help - by TheIcyPickle - 05-28-2012, 06:53 PM
RE: i need some help - by Mine Turtle - 05-28-2012, 06:56 PM
RE: i need some help - by Putmalk - 05-28-2012, 07:06 PM



Users browsing this thread: 1 Guest(s)