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!
Clear Offline
Junior Member

Posts: 19
Threads: 4
Joined: May 2012
Reputation: 0
#1
Script help!

Hey guys!
I was working on a custom story when i had this idea of adding a sound that is activated Every time you touch a certain object, wich on this case is a Pig.
I have the .ogg sound in the folder and all, i'd appreciate any help! =D
06-10-2012, 10:09 AM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#2
RE: Script help!

Well rename all the pigs with the same name for example pig_1, pig_2 etc then use this script

The bolded 10 is how many pigs you have so if you have 5 change it to 5 if you have 15 then change the 10 to 15 etc Smile
PHP Code: (Select All)
void OnStart()
{
for(
int i=0;i<10;i++) SetEntityPlayerInteractCallback("Pig_"+i"PigSound"false);
}

void PigSound(string &in asEntity)
{
PlaySoundAtEntity("""NAMEOFSOUND"asEntity0false);
//Put other things here if you want


This is the code pretty much Smile

06-10-2012, 10:23 AM
Find
Clear Offline
Junior Member

Posts: 19
Threads: 4
Joined: May 2012
Reputation: 0
#3
RE: Script help!

(06-10-2012, 10:23 AM)SilentStriker Wrote: Well rename all the pigs with the same name for example pig_1, pig_2 etc then use this script

The bolded 10 is how many pigs you have so if you have 5 change it to 5 if you have 15 then change the 10 to 15 etc Smile
PHP Code: (Select All)
void OnStart()
{
for(
int i=0;i<10;i++) SetEntityPlayerInteractCallback("Pig_"+i"PigSound"false);
}

void PigSound(string &in asEntity)
{
PlaySoundAtEntity("""NAMEOFSOUND"asEntity0false);
//Put other things here if you want


This is the code pretty much Smile



Thank you so much for the help! =D
I'm new at all the scripting parts, so just a few more questions,
Where do i put this code?
How come there is "PigSound" and "NAMEOFSOUND" Do i put the same sound ".ogg" in there?
That's it! Big Grin
Thanks again! Smile
06-10-2012, 10:26 AM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#4
RE: Script help!

the PigSound is the name of the function and NAMEOFSOUND is where you put the name of your pig squeal or what ever it's called Smile

Have you ever scripted before?

06-10-2012, 10:45 AM
Find
Clear Offline
Junior Member

Posts: 19
Threads: 4
Joined: May 2012
Reputation: 0
#5
RE: Script help!

(06-10-2012, 10:45 AM)SilentStriker Wrote: the PigSound is the name of the function and NAMEOFSOUND is where you put the name of your pig squeal or what ever it's called Smile

Have you ever scripted before?
Nope xD
06-10-2012, 04:01 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#6
RE: Script help!

Ok... xD So then look around here Smile http://wiki.frictionalgames.com/

06-10-2012, 04:13 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#7
RE: Script help!

Instead of renaming it, why not just use the name it has? If you have a lot of pigs, then it's a waste of time. The level editor itself changes the number _1, _2, _3 etc.

Trying is the first step to success.
06-10-2012, 04:22 PM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#8
RE: Script help!

(06-10-2012, 04:22 PM)beecake Wrote: Instead of renaming it, why not just use the name it has? If you have a lot of pigs, then it's a waste of time. The level editor itself changes the number _1, _2, _3 etc.
True Smile

06-10-2012, 04:25 PM
Find
Clear Offline
Junior Member

Posts: 19
Threads: 4
Joined: May 2012
Reputation: 0
#9
RE: Script help!

(06-10-2012, 04:25 PM)SilentStriker Wrote:
(06-10-2012, 04:22 PM)beecake Wrote: Instead of renaming it, why not just use the name it has? If you have a lot of pigs, then it's a waste of time. The level editor itself changes the number _1, _2, _3 etc.
True Smile
Hey man, the idea you gave me doesn't work, i've tried many times but nothing happens.
Maybe you could re create the code for me? Big Grin
Heres the info you need:
Pig's name - Piggeh1
Sound file name - Yeah

I'd love you forever if it works *^*
06-12-2012, 04:02 PM
Find
CorinthianMerchant Offline
Posting Freak

Posts: 2,876
Threads: 84
Joined: Nov 2011
Reputation: 131
#10
RE: Script help!

Please not another pewdiepie map. Why not something more serious and yummy like an atmospheric map, I'm sure that will be more appreciated! Big Grin

Still hasn't gotten over the loss of wubwub...
06-12-2012, 04:11 PM
Find




Users browsing this thread: 4 Guest(s)