Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 3 Vote(s) - 4.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My problems
naseem142 Offline
Member

Posts: 153
Threads: 19
Joined: Oct 2012
Reputation: 0
#1
Information  My problems

From now on i will post all of my errors / helps / needs in here so i won't keep posting a thread every problem i get.
And also i will post the solution , so other newbies like me Shy , will know how to fix it if they got the same problem
Thank you.

Problem 1 : ( Playing a song ) *SOLVED*
Spoiler below!


Problem:How can i add a song/tune to play through the level all the time and keep rewinding?

Solution:

void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_Name", "Func_music", true, 1);
}

void Func_music(string &in asParent, string &in asChild, int alState)
{
PlayMusic("Music.ogg", true, 1, 1, 0, false);
}



Problem 2 : ( How to end the game when entering a level door ) *SOLVED*

Spoiler below!


Problem: How to end the game when entering a level door

Solution: Just read the posts on pages 2 - 4 Dodgy



Problem 3 : ( Giving a custom item function ) *SOLVED*

Spoiler below!


Basic: GiveItem(name, type, subType, image, amount);

Problem: How can i add a custom to be given to the player when using a knife item on another entity?

Here is my script , but i couldn't know how to make the player get an item when using the knife on the entity.


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

{

GiveItem(Key_0, puzzle, subType, image, amount); //<---- The problem

PlaySoundAtEntity("", "attack_claw_hit.snt", "piggy", 0, false);

SetSwingDoorLocked("Locked_door0", false, true);

RemoveItem("pig_knife");

}

Solution: GiveItem("stone_hammer_chipper", "Puzzle", "stone_hammer_chipper", "stone_hammer_chipper.tga", 0);

stone_hammer_chipper: Change it to you'r items name
stone_hammer_chipper.tga: The image of the item inside the inventory



Problem 4 : ( Playing music not working ) *SOLVED*

Spoiler below!

Problem: The function: PlaySoundAtEntity( Scream1 , Scream1.ogg, Deadbody_1 , 2.0f, false);
is not working , i get an error " Scream1 is not declared and Deadbody_1 is not declared.

Solution: Function: PlaySoundAtEntity( "Scream1" , "Scream1.snt", "Deadbody_1" , 2.0f, false);
Scream1: The sound's name
Scream1.snt: The sound file's .snt file
Deadbody_1: The entity to play the sound from
2.0f: Time til the sound fades

To play you'r .ogg files you need a .snt file so create a new text document and write this in:


<SOUNDENTITY>
<SOUNDS>
<Main>
<Sound File="Scream1" />
</Main>
</SOUNDS>
<PROPERTIES Volume="5" MinDistance="1" MaxDistance="20" Random="1" Interval="0" FadeEnd="False" FadeStart="False" Stream="False" Loop="False" Use3D="True" Blockable="True" BlockVolumeMul="0.5" Priority="0" />
</SOUNDENTITY>

Change Scream1 to the sound file's name from the script

And then save the file as Scream1.snt


(And Of course change scream1 to sound's name)





Problem 5 : ( How to add mementos ) *NOT SOLVED*

Spoiler below!

Problem: How do i add mementos when touching a script area?

Solution: x





Problem 6 : ( How to make entities disappear dramaticly ) *SOLVED*

Spoiler below!

Problem: How to make entities disappear dramaticly?

Solution: SetPropActiveAndFade("Nameofentity", false, 3);


(This post was last modified: 10-25-2012, 11:17 AM by naseem142.)
10-14-2012, 07:26 AM
Website Find
Robby Offline
Posting Freak

Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation: 47
#2
RE: My problems

PlayMusic("example.ogg", true, 1, 1, 0, false);

That's how you play a song.

Replace "example.ogg" with the music's name that you intend to use. Include the .ogg extension.

Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
10-14-2012, 08:34 AM
Website Find
naseem142 Offline
Member

Posts: 153
Threads: 19
Joined: Oct 2012
Reputation: 0
#3
RE: My problems

(10-14-2012, 08:34 AM)Nemet Robert Wrote: PlayMusic("example.ogg", true, 1, 1, 0, false);

That's how you play a song.

Replace "example.ogg" with the music's name that you intend to use. Include the .ogg extension.
Thanks , also is the music file is placed in a separate folder called "Music"?
(This post was last modified: 10-14-2012, 08:38 AM by naseem142.)
10-14-2012, 08:38 AM
Website Find
Robby Offline
Posting Freak

Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation: 47
#4
RE: My problems

Well, that's what I do with custom music. But you can play normal music from the game itself, without having to place it in a custom "Music" folder. Just be sure the name is correct.

Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
10-14-2012, 08:43 AM
Website Find
naseem142 Offline
Member

Posts: 153
Threads: 19
Joined: Oct 2012
Reputation: 0
#5
RE: My problems

(10-14-2012, 08:43 AM)Nemet Robert Wrote: Well, that's what I do with custom music. But you can play normal music from the game itself, without having to place it in a custom "Music" folder. Just be sure the name is correct.
I did what you told me , and i did it like this:




void OnStart()
{
AddEntityCollideCallback("Player", "Play_Music_Script_Area", "PlayMusic1", true, 1);
}

void PlayMusic1(string &in asParent, string &in asChild, int alState)
{
PlayMusic("Ambience.ogg", true, 1, 1, 0, false);
}

But it didn't play when i touched the script area Huh
10-14-2012, 08:49 AM
Website Find
Robby Offline
Posting Freak

Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation: 47
#6
RE: My problems

Is the music name correct? Are the script names within the editor correct?

Also, have you tried restarting Amnesia? If I add custom music to my CS, I have to restart Amnesia, because it wouldn't play.

And the script's ok, as I see.

Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
10-14-2012, 08:51 AM
Website Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#7
RE: My problems

Also, be sure the name is exactly the same. And maybe is ambience.ogg instead of Ambience.ogg?

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
10-14-2012, 09:34 AM
Find
Robby Offline
Posting Freak

Posts: 2,549
Threads: 38
Joined: Jun 2009
Reputation: 47
#8
RE: My problems

I keep forgetting. Yes, the names are case-sensitive.

Infrequently active. Don't expect an immediate response. Best to contact me at a different locale. If I create a thread, expect me to be quite active.
10-14-2012, 09:41 AM
Website Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#9
RE: My problems

If your music is custom, it should be ok, but Ambience doesn't exist. Put the name
(ex: "ambience_cave")

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
10-14-2012, 09:46 AM
Find
naseem142 Offline
Member

Posts: 153
Threads: 19
Joined: Oct 2012
Reputation: 0
#10
RE: My problems

When i clicked the "Music" Folder there was a new file called "Ambience_main.ogg.sfk" does that mean it worked?
10-14-2012, 09:54 AM
Website Find




Users browsing this thread: 1 Guest(s)