Spelos
Banned
Posts: 231
Threads: 19
Joined: Sep 2014
|
RE: Script - Piano Music
There is a number of things wrong with what you just showed me.
But the truth is that this could just go on forever, so let's make it easy.
Post your full .hps content.
If you want it to look organized on the forum, make sure to use the PHP tags.
[php]Paste your .hps here[/php]
Explain what you want to happen
Briefly explain what is it that you want to achieve.
Explain what actually happens
What is happening when you launch the game?
Is there an error message? (if so, post it as well)
Is something not playing?
Is something not stopping playing?
|
|
02-27-2016, 03:16 PM |
|
Abihishi
Junior Member
Posts: 44
Threads: 8
Joined: Feb 2016
Reputation:
0
|
RE: Script - Piano Music
void OnStart()
{
FadeOut(0.01f);
AddTimer("", 2.1f, "awake2");
AddTimer("", 5.0f, "awake");
FadePlayerRollTo(90, 1, 2);
MovePlayerHeadPos(0, -1.5f, 0, 1, 0.1f);
PlayMusic("00_event_gallery", true, 1, 0.1, 10, false);
StopMusic(1.0f, 1);
PreloadSound("general_piano01.snt");
SetEntityPlayerInteractCallback("ScriptArea_001", "PianoFunc", false);
AddEntityCollideCallback("Player", "Script001", "Script001", true, 1);
AddEntityCollideCallback("Player", "kappa33", "kappa33", true, 1);
AddUseItemCallback("", "key01", "door01", "UseKeyOnDoor", true);
AddUseItemCallback("", "key02", "door02", "UseKeyOnDoor", true);
AddEntityCollideCallback("Player", "ScryptArea1_1", "Scrypt2", true, 1);
AddEntityCollideCallback("Player", "Jumpperro", "Jumpscare2", true, 1);
AddEntityCollideCallback("Player", "jumperro022", "Jumpscare3", true, 1);
AddUseItemCallback("", "KeyDesc01", "level_hub_1", "FUNCTION", true);
}
void PianoFunc(string &in asEntity)
{
StopSound("PianoSound", 2.5f);
PlaySoundAtEntity("PianoSound", "general_piano01.snt", "Script001", 0.5f, false);
}
void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false);
RemoveItem(asItem);
}
void FUNCTION(string &in item, string &in door)
{
SetLevelDoorLocked("level_hub_1", false);
PlayGuiSound("unlock_door.snt", 100);
RemoveItem("KeyDesc01");
}
void Scrypt2(string &in asParent, string &in asChild, int alState)
{
SetMessage("MessageCategory2", "MessageEntry2", 0);
}
void kappa33(string &in asParent, string &in asChild, int alState)
{
SetMessage("MessageCategory3", "MessageEntry3", 0);
}
void Jumpscare2(string &in asParent, string &in asChild, int alState)
{
PlayGuiSound("15_the_big_scream.snt", 1.0f);
SetEntityActive("portret1", true);
SetEntityActive("portret2", true);
SetEntityActive("portret3", true);
SetEntityActive("portret4", true);
SetEntityActive("portret5", true);
SetEntityActive("portret6", true);
SetEntityActive("portret7", true);
SetEntityActive("redlamp1", true);
SetEntityActive("redlamp2", true);
SetEntityActive("redlamp3", true);
SetEntityActive("redlamp4", true);
SetEntityActive("redlamp5", true);
SetEntityActive("redlamp6", true);
SetEntityActive("redlamp7", true);
SetEntityActive("redlamp8", true);
AddTimer("", 2.5f, "JumpscareEntity_Gone");
}
void Jumpscare3(string &in asParent, string &in asChild, int alState)
{
PlayGuiSound("15_body_impact.snt", 1.0f);
SetEntityActive("rycerz1", true);
SetEntityActive("rycerz2", true);
SetEntityActive("rycerz3", true);
SetEntityActive("rycerz4", true);
SetEntityActive("rycerz5", true);
SetEntityActive("rycerz6", true);
SetEntityActive("rycerz7", true);
SetEntityActive("rycerz8", true);
AddTimer("", 2.5f, "JumpscareEntity_Gone");
}
void awake2(string asTimer)
{
FadeIn(5.0f);
}
void awake(string asTimer)
{
FadePlayerRollTo(0, 1, 2);
MovePlayerHeadPos(0, 0.0f, 0, 0.5, 0.1f);
}
When i launch game nothing but when i start in CS music in piano not work and music in intro play the infinity.
No, this is not error message
I want play a music when my character wake up with floor. And stop this music after 15 second, would not play in infinity.
Piano similarly, when my character touch script area it has piano music in room which just we had the intention to enter. And too stop music, when music comes to an end.
|
|
02-27-2016, 03:50 PM |
|
Spelos
Banned
Posts: 231
Threads: 19
Joined: Sep 2014
|
RE: Script - Piano Music
void OnStart() { FadeOut(0.01f); AddTimer("", 2.1f, "awake2"); AddTimer("", 5.0f, "awake"); FadePlayerRollTo(90, 1, 2); MovePlayerHeadPos(0, -1.5f, 0, 1, 0.1f); PlayMusic("00_event_gallery", true, 1, 0.1, 10, false); AddTimer("StopMusicTimer", 15.0f, "StopMusicFunc"); PreloadSound("general_piano01.snt"); SetEntityPlayerInteractCallback("ScriptArea_001", "PianoFunc", false); AddEntityCollideCallback("Player", "Script001", "Script001", true, 1); AddEntityCollideCallback("Player", "kappa33", "kappa33", true, 1); AddUseItemCallback("", "key01", "door01", "UseKeyOnDoor", true); AddUseItemCallback("", "key02", "door02", "UseKeyOnDoor", true); AddEntityCollideCallback("Player", "ScryptArea1_1", "Scrypt2", true, 1); AddEntityCollideCallback("Player", "Jumpperro", "Jumpscare2", true, 1); AddEntityCollideCallback("Player", "jumperro022", "Jumpscare3", true, 1); AddUseItemCallback("", "KeyDesc01", "level_hub_1", "FUNCTION", true); } void StopMusicFunc(string &in asTimer) { StopMusic(1.0f, 10); } void PianoFunc(string &in asEntity) { StopSound("PianoSound", 2.5f); PlaySoundAtEntity("PianoSound", "general_piano01.snt", "Script001", 0.5f, false); }
void UseKeyOnDoor(string &in asItem, string &in asEntity) { SetSwingDoorLocked(asEntity, false, true); PlaySoundAtEntity("", "unlock_door.snt", asEntity, 0, false); RemoveItem(asItem); }
void FUNCTION(string &in item, string &in door) { SetLevelDoorLocked("level_hub_1", false); PlayGuiSound("unlock_door.snt", 100); RemoveItem("KeyDesc01"); } void Scrypt2(string &in asParent, string &in asChild, int alState) { SetMessage("MessageCategory2", "MessageEntry2", 0); }
void kappa33(string &in asParent, string &in asChild, int alState) { SetMessage("MessageCategory3", "MessageEntry3", 0); }
void Jumpscare2(string &in asParent, string &in asChild, int alState) { PlayGuiSound("15_the_big_scream.snt", 1.0f); SetEntityActive("portret1", true); SetEntityActive("portret2", true); SetEntityActive("portret3", true); SetEntityActive("portret4", true); SetEntityActive("portret5", true); SetEntityActive("portret6", true); SetEntityActive("portret7", true);
SetEntityActive("redlamp1", true); SetEntityActive("redlamp2", true); SetEntityActive("redlamp3", true); SetEntityActive("redlamp4", true); SetEntityActive("redlamp5", true); SetEntityActive("redlamp6", true); SetEntityActive("redlamp7", true); SetEntityActive("redlamp8", true); AddTimer("", 2.5f, "JumpscareEntity_Gone");
}
void Jumpscare3(string &in asParent, string &in asChild, int alState) { PlayGuiSound("15_body_impact.snt", 1.0f); SetEntityActive("rycerz1", true); SetEntityActive("rycerz2", true); SetEntityActive("rycerz3", true); SetEntityActive("rycerz4", true); SetEntityActive("rycerz5", true); SetEntityActive("rycerz6", true); SetEntityActive("rycerz7", true); SetEntityActive("rycerz8", true); AddTimer("", 2.5f, "JumpscareEntity_Gone"); }
void awake2(string asTimer) { FadeIn(5.0f); }
void awake(string asTimer) { FadePlayerRollTo(0, 1, 2); MovePlayerHeadPos(0, 0.0f, 0, 0.5, 0.1f); }
|
|
02-27-2016, 03:58 PM |
|
Abihishi
Junior Member
Posts: 44
Threads: 8
Joined: Feb 2016
Reputation:
0
|
RE: Script - Piano Music
Mhm i copy that but in game i not hear. I dont know why Name script in editor is same, perhaps script can not find that sound file?
|
|
02-27-2016, 06:37 PM |
|
Spelos
Banned
Posts: 231
Threads: 19
Joined: Sep 2014
|
RE: Script - Piano Music
You said the music is playing infinitely...
Well if the music file is not playing, then you obviously need to include ".ogg" with the file name.
|
|
02-27-2016, 07:21 PM |
|
Abihishi
Junior Member
Posts: 44
Threads: 8
Joined: Feb 2016
Reputation:
0
|
RE: Script - Piano Music
Ok.
You know how make script when start Custom story my character musnt move, but only after 6-7 seconds?
|
|
02-28-2016, 12:11 PM |
|
Spelos
Banned
Posts: 231
Threads: 19
Joined: Sep 2014
|
RE: Script - Piano Music
Makes the player unable to move or look around.
You put that into a function that runs as you want it to happen.
That means that if you want player to NOT be able to move as the custom story starts, you put that command into an OnStart() function.
AddTimer("", 7.0f, "MyTimerFunc");
Adds a timer that will run MyTimerFunc function after 7.0f Seconds.
You put that into a function that runs as you want the timer to start.
That means that if you want "MyTimerFunc" to happen after 7 seconds FROM the beginning of your custom story, you put that command into an OnStart() function.
void MyTimerFunc(string &in asTimer) {
}
Is a FUNCTION that the previous Timer will call.
Everything in this function will happen after 7.0f Second specified in the Timer command.
If you want player to start moving at this point, put
command in this function.
Full script should look something like this:
void OnStart() { SetPlayerActive(false); AddTimer("", 7.0f, "MyTimerFunc"); }
void MyTimerFunc(string &in asTimer) { SetPlayerActive(true); }
|
|
02-28-2016, 12:45 PM |
|
Abihishi
Junior Member
Posts: 44
Threads: 8
Joined: Feb 2016
Reputation:
0
|
RE: Script - Piano Music
You are amazing!
Do you know yet how to add the effect of the blue flash when eg . open the door key ? And do you know perhaps how to add the blue glow to better visible key or note .
|
|
02-28-2016, 12:51 PM |
|
Spelos
Banned
Posts: 231
Threads: 19
Joined: Sep 2014
|
RE: Script - Piano Music
All entities that are labeled as
"Item" "Note" "Oil" "tinderbox"
in Model Editor have that glow by default.
So only items and things you can pickup have it.
|
|
02-28-2016, 01:04 PM |
|
Mudbill
Muderator
Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation:
179
|
RE: Script - Piano Music
You can use to give that "blue flash" effect. Put that in the event that unlocks the door with the key (for example right after SetSwingDoorLocked)
(This post was last modified: 02-28-2016, 06:03 PM by Mudbill.)
|
|
02-28-2016, 06:02 PM |
|
|