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
Help,multiple scripts in one map!
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#11
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
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#12
RE: Help,multiple scripts in one map!

Post the script.

01-02-2012, 03:28 PM
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#13
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
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#14
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
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#15
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 Big Grin 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
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#16
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 Sad 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
Find
MrBigzy Offline
Senior Member

Posts: 616
Threads: 18
Joined: Mar 2011
Reputation: 8
#17
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
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#18
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
Find
MrBigzy Offline
Senior Member

Posts: 616
Threads: 18
Joined: Mar 2011
Reputation: 8
#19
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
Find
Datguy5 Offline
Senior Member

Posts: 629
Threads: 25
Joined: Dec 2011
Reputation: 12
#20
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 Sad
(This post was last modified: 01-03-2012, 08:12 PM by Datguy5.)
01-03-2012, 08:06 PM
Find




Users browsing this thread: 1 Guest(s)