Datguy5
Senior Member
Posts: 629
Threads: 25
Joined: Dec 2011
Reputation:
12
|
RE: Help,multiple scripts in one map!
(01-01-2012, 07:48 PM)stokesie95 Wrote: yes you would
ok
EDIT:I cant hear anything when the statue appears D:
(This post was last modified: 01-02-2012, 01:50 PM by Datguy5.)
|
|
01-02-2012, 01:46 PM |
|
flamez3
Posting Freak
Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation:
57
|
RE: Help,multiple scripts in one map!
Post the script.
|
|
01-02-2012, 03:28 PM |
|
Datguy5
Senior Member
Posts: 629
Threads: 25
Joined: Dec 2011
Reputation:
12
|
RE: Help,multiple scripts in one map!
Heres the script
////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "key_1", "door1", "KeyOnDoor", true);
SetEntityCallbackFunc("key_1", "OnPickup");
AddEntityCollideCallback("Player", "InYourFace", "Woho", true, 1);
}
void Woho(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Untrustable_1", true);
PlaySoundAtEntity("", "04_scream.snt", "Untrustable_1", 0, false);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
GiveSanityDamage(10.0f, true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
|
|
01-02-2012, 06:28 PM |
|
flamez3
Posting Freak
Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation:
57
|
RE: Help,multiple scripts in one map!
I know this sounds silly, but have you tired to quit the story and reload it?
|
|
01-03-2012, 12:52 AM |
|
Datguy5
Senior Member
Posts: 629
Threads: 25
Joined: Dec 2011
Reputation:
12
|
RE: Help,multiple scripts in one map!
(01-03-2012, 12:52 AM)flamez3 Wrote: I know this sounds silly, but have you tired to quit the story and reload it?
Hmm no actually but ill give it a try now.
EDIT:Yay it worked!Thank you!
(This post was last modified: 01-03-2012, 06:52 AM by Datguy5.)
|
|
01-03-2012, 06:50 AM |
|
Datguy5
Senior Member
Posts: 629
Threads: 25
Joined: Dec 2011
Reputation:
12
|
RE: Help,multiple scripts in one map!
But now i have another problem D: I am trying to make another key that opens another door,but it doesnt work Heres the hps file
////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "key_1", "door1", "KeyOnDoor", true);
AddUseItemCallback("", "Bigroomkey", "door2", "KeyOnDoor", true);
SetEntityCallbackFunc("key_1", "OnPickup");
AddEntityCollideCallback("Player", "InYourFace", "Woho", true, 1);
}
void Woho(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Untrustable_1", true);
PlaySoundAtEntity("", "scare_ghost.snt", "Untrustable_1", 0, false);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
GiveSanityDamage(10.0f, true);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Bigroomkey", false, true);
PlaySoundAtEntity("", "unlock_door", "door2", 0, false);
RemoveItem("Bigroomkey");
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
The crash report says something about same parameters and stuff.
|
|
01-03-2012, 05:47 PM |
|
MrBigzy
Senior Member
Posts: 616
Threads: 18
Joined: Mar 2011
Reputation:
8
|
RE: Help,multiple scripts in one map!
You can't have two functions with the same name and parameters; rename one of the key functions.
(This post was last modified: 01-03-2012, 06:23 PM by MrBigzy.)
|
|
01-03-2012, 06:22 PM |
|
Datguy5
Senior Member
Posts: 629
Threads: 25
Joined: Dec 2011
Reputation:
12
|
RE: Help,multiple scripts in one map!
(01-03-2012, 06:22 PM)MrBigzy Wrote: You can't have two functions with the same name and parameters; rename one of the key functions.
What should i change?I just want that the door opens when key is used to it.
(This post was last modified: 01-03-2012, 07:34 PM by Datguy5.)
|
|
01-03-2012, 07:23 PM |
|
MrBigzy
Senior Member
Posts: 616
Threads: 18
Joined: Mar 2011
Reputation:
8
|
RE: Help,multiple scripts in one map!
Just rename one of the KeyOnDoor functions to KeyOnDoor2 or something like that, for example:
////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "key_1", "door1", "KeyOnDoor", true);
AddUseItemCallback("", "Bigroomkey", "door2", "KeyOnDoor2", true);
SetEntityCallbackFunc("key_1", "OnPickup");
AddEntityCollideCallback("Player", "InYourFace", "Woho", true, 1);
}
void Woho(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Untrustable_1", true);
PlaySoundAtEntity("", "scare_ghost.snt", "Untrustable_1", 0, false);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
GiveSanityDamage(10.0f, true);
}
void KeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Bigroomkey", false, true);
PlaySoundAtEntity("", "unlock_door", "door2", 0, false);
RemoveItem("Bigroomkey");
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
|
|
01-03-2012, 07:42 PM |
|
Datguy5
Senior Member
Posts: 629
Threads: 25
Joined: Dec 2011
Reputation:
12
|
RE: Help,multiple scripts in one map!
(01-03-2012, 07:42 PM)MrBigzy Wrote: Just rename one of the KeyOnDoor functions to KeyOnDoor2 or something like that, for example:
////////////////////////////
// Run when the map starts
void OnStart()
{
AddUseItemCallback("", "key_1", "door1", "KeyOnDoor", true);
AddUseItemCallback("", "Bigroomkey", "door2", "KeyOnDoor2", true);
SetEntityCallbackFunc("key_1", "OnPickup");
AddEntityCollideCallback("Player", "InYourFace", "Woho", true, 1);
}
void Woho(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Untrustable_1", true);
PlaySoundAtEntity("", "scare_ghost.snt", "Untrustable_1", 0, false);
}
void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key_1");
}
void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("grunt_1", true);
GiveSanityDamage(10.0f, true);
}
void KeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Bigroomkey", false, true);
PlaySoundAtEntity("", "unlock_door", "door2", 0, false);
RemoveItem("Bigroomkey");
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
Ohh i see.Thank you mister!
Well now the key goes to the door,but the door stays locked
(This post was last modified: 01-03-2012, 08:12 PM by Datguy5.)
|
|
01-03-2012, 08:06 PM |
|
|