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
Problem
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#21
RE: Problem

Darkshadowz is wrong.You dont need the .snt to the end of the unlock_door because mine works perfectly without it.

05-10-2012, 11:53 AM
Find
maitalr Offline
Junior Member

Posts: 16
Threads: 3
Joined: May 2012
Reputation: 0
#22
RE: Problem

(05-10-2012, 07:34 AM)DarkShadowz Wrote: dont worry about this dude, we all get stuck sometime. we'll get through it though, so dont worry ^^.


can you give me your current script?
By the way, every time when i have to edit the script i need to cut the file out of c folder, (cuz it wont let me edit it there), and then on desktop i'm edit it and then i put it back.
i'ts relevant?


/////////////////////////////////
// Run when entering map
void OnStart()
{
AddUseItemCallback("", "key_1", "Door_3", "KeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door_3", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "Door_3", 0, false);
RemoveItem("key_1");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}
(05-10-2012, 11:53 AM)Datguy5 Wrote: Darkshadowz is wrong.You dont need the .snt to the end of the unlock_door because mine works perfectly without it.
maybe in every computer its different. when i checked other scripts from other custom storys its different. (my computer probable just hates me)
05-10-2012, 12:35 PM
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#23
RE: Problem

Yea maybe Big Grin

05-10-2012, 01:29 PM
Find
darkadders Offline
Junior Member

Posts: 44
Threads: 1
Joined: Mar 2012
Reputation: 3
#24
RE: Problem

/////////////////////////////////
// Run when entering map
void OnStart()
{
AddUseItemCallback("", "key_1", "Door_3", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door_3", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "Door_3", 0, false);
RemoveItem("key_1");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}




copy this over to your script file. it SHOULD work now.

also, make sure you have named the door and the key correctly in the .map file.




Datguy5. im not sure what you do to make it work without the extention, but i assure you, it is highly recommended to put an extention into your script. just because it works on your computer, doesnt mean it works on others.

EDIT: its quite normal that you cant save stuff into the programfiles folder in your computer if you dont have administrative rights over your pc. i have to do the same thing too ^^

*insert creative signature here*
(This post was last modified: 05-10-2012, 02:35 PM by darkadders.)
05-10-2012, 02:26 PM
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#25
RE: Problem

(05-10-2012, 11:53 AM)Datguy5 Wrote: Darkshadowz is wrong.You dont need the .snt to the end of the unlock_door because mine works perfectly without it.
As far as I understand it, if you are referencing a sound file (.ogg) then you need to include the extension. If you are referencing an HPL2 sound file (.snt) which in turn references the .ogg, then you don't need to include the file extension. Any 'sound' should have a .snt, wheras background music files do not have a .snt file.

This is how it works for me as well, when using PlaySoundAtEntity I don't inlude the extension and it works. However... 'asSoundFile - the sound to use + extension .snt' ...it what it says on the engine scripts page. Perhaps there is some hidden clauses to how this system works, as there seem to be quite a few undocumented clauses to how some functions work
05-10-2012, 02:38 PM
Find
darkadders Offline
Junior Member

Posts: 44
Threads: 1
Joined: Mar 2012
Reputation: 3
#26
RE: Problem

(05-10-2012, 02:38 PM)Adrianis Wrote:
(05-10-2012, 11:53 AM)Datguy5 Wrote: Darkshadowz is wrong.You dont need the .snt to the end of the unlock_door because mine works perfectly without it.
Perhaps there is some hidden clauses to how this system works, as there seem to be quite a few undocumented clauses to how some functions work
i really wouldnt recommend trying to cut corners when it comes to scripting in hpl tho. its a twitchy engine

*insert creative signature here*
(This post was last modified: 05-10-2012, 02:45 PM by darkadders.)
05-10-2012, 02:43 PM
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#27
RE: Problem

(05-10-2012, 02:43 PM)DarkShadowz Wrote:
(05-10-2012, 02:38 PM)Adrianis Wrote:
(05-10-2012, 11:53 AM)Datguy5 Wrote: Darkshadowz is wrong.You dont need the .snt to the end of the unlock_door because mine works perfectly without it.
Perhaps there is some hidden clauses to how this system works, as there seem to be quite a few undocumented clauses to how some functions work
i really wouldnt recommend trying to cut corners when it comes to scripting in the hpl engine tho. its a twitchy engine
Certainly not. But try it, perhaps it only work on some .snt's. There must be a reason for it working sometimes and not others, if we can figure out why it works for some people and not others, or on some files and not others, then everyone benefits.

Last night I used "break_glass_bottle" as the name of the sound file to use, and it played when it should. Try using that one, if that particular .snt works without the extension for you, where others clearly don't, then we have something to investigate. If you could provide an example where you tried using it without the extension and it didn't work, then I'll try that out. This should help show whether it is related to PC or file.
05-10-2012, 02:52 PM
Find
maitalr Offline
Junior Member

Posts: 16
Threads: 3
Joined: May 2012
Reputation: 0
#28
RE: Problem

(05-10-2012, 02:26 PM)DarkShadowz Wrote: /////////////////////////////////
// Run when entering map
void OnStart()
{
AddUseItemCallback("", "key_1", "Door_3", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Door_3", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "Door_3", 0, false);
RemoveItem("key_1");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}




copy this over to your script file. it SHOULD work now.

also, make sure you have named the door and the key correctly in the .map file.
it didn't work. and, by the way, its the same script as my.
is there any chance the game doesn't recognize the HPS file?

I know its too much to ask, but, maybe, you can build a simple room - just a door with a key on the floor, and behind it the exit. really simple, without wells and ceiling. and with that script of the key that needed to open the door. then sent it to me and i'll try to figure it out.
(This post was last modified: 05-10-2012, 03:24 PM by maitalr.)
05-10-2012, 03:22 PM
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#29
RE: Problem

maitalr, make sure that the .hps file is named exactly the same as your .map file, and that it is in the same folder.

For example, test_map.map would have a script file called test_map.hps
corridor.map
would have a script file called corridor.hps

As long as they are named correctly and in the same folder the game will definately recognise the file

Also, whenever something doesn't work, please tell us exactly how it doesn't work, i.e. say if you are receiving an error running the game, or if you can get into the game use the key on the door, if the door isnt opening etc.

Also also, there is no need to have the 'void OnLeave()' function in your script if you're not using it Smile
05-10-2012, 03:31 PM
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#30
RE: Problem

Try adding OnEnter and dont remove the OnLeave.If that doesnt work then remove OnLeave.

(This post was last modified: 05-10-2012, 03:36 PM by Datguy5.)
05-10-2012, 03:36 PM
Find




Users browsing this thread: 1 Guest(s)