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
#2
RE: i need some help

(05-28-2012, 04:24 AM)TheIcyPickle Wrote:
ok so, I receive an error upon making your corrections in the hps file. I want a sound to be made when a player walks past a script box thing, called "popout1" but it only plays once the player has a key called "scarykey_1" Also, if possible , add at the same time, that naked penis figure flys in. (that part may be a pain, so if you can't explain it, its fine.)


here is my entire script.


////////////////////////////

// Run first time starting map

void OnStart()

{

GiveItemFromFile("lantern", "lantern.ent");


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


AddUseItemCallback("", "scarykey_1", "door_1", "KeyOnDoor", true);

AddEntityCollideCallback("popout1", string& "Player", "PlaySoundAtEntity", true);

}




void KeyOnDoor(string &in asItem, string &in asEntity)

{

SetSwingDoorLocked("door_1", false, true);

PlaySoundAtEntity("", "unlock_door", "door_1", 0, false);

RemoveItem("scarykey_1");

}


void PlaySoundAtEntity(string &in asplayer, string &in aspopout1, bool HasItem("scarykey_1")

{

PlaySoundAtEntity1("", "21_screams", "popout1", 0, false);

}


thanks for the help
No flying naked man. Absolutely not. Get that crap out of your custom story, and never implement it. Or get laughed at. Your choice.

Anywho.

void PlaySoundAtEntity(string &in asplayer, string &in aspopout1, bool HasItem("scarykey_1"){
PlaySoundAtEntity1("", "21_screams", "popout1", 0, false);}

What is this? Can you please brush up on how functions work... In fact, just remove this stuff, it's worthless.

You want to play a sound when passing an entity? Use an AddEntityCollideCallback

So:

//place in OnStart
AddEntityCollideCallback("Player', "scriptareathingy", "PlaySound", false, 0);

void PlaySound(string &in asParent, string &in asChild, int alState)
{
  if(HasItem("keyname") == false) return;

  PlaySoundAtEntity("sound", "soundname.snt", "soundarea", 0, false);
}

That is the code basics. Replace wherever I wrote obvious placeholders with the names of your objects.

And never implement a flying naked body. Get out with that stuff. It's sickening.

05-28-2012, 04:34 AM
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)