Manbearpig116
Junior Member
Posts: 9
Threads: 4
Joined: Apr 2012
Reputation:
0
|
Broken Script
I have two scripts that don't seem to be working right.
The first is trying to make a grunt spawn when walking into a specific area but when I run the map it doesn't work
This the script in full
////////////////////////////
// Run when entering map
void OnEnter()
{
AddUseItemCallback("", "Monsterdoorkey", "Monsterdoor", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Monsterdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "Monsterdoor", 0, false);
RemoveItem("Monsterdoorkey");
}
void OnLeave()
////////////////////////////
// Run when leaving map
{
AddEntityCollideCallback("Player", "PlayerCollide", "SpawnMonster", true, 1);
}
void SpawnMonster(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_3", true);
}
I'm also trying to make a key unlock a door on another map but when I try to unlock the door it says "cannot use item this way"
Here is the script in full
////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "RoomTwoArea", "CollideRoomTwo", true, 1);
}
void CollideRoomTwo(string &in asParent, string &in asChild, int alstate)
{
SetSwingDoorClosed("RoomTwoDoor", true, true);
GiveSanityDamage(90 , true);
PlayGuiSound("react_past", 1);
}
void OnEnter()
{
AddUseItemCallback("", "WaterDoorkey", "WaterDoor", "UsedKeyOnDoor", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("WaterDoor", false, true);
PlaySoundAtEntity("", "unlock_door", "WaterDoor", 0, false);
RemoveItem("WaterDoorKey");
}
If anyone can offer a solution, I would be glad to hear it.
|
|
04-26-2012, 02:39 PM |
|
SilentStriker
Posting Freak
Posts: 950
Threads: 26
Joined: Jul 2011
Reputation:
43
|
RE: Broken Script
wow your script is a chaos ^^
Let me rewrite it for you:
First Map:
////////////////////////////
// Run first time starting map
void OnStart()
{
AddUseItemCallback("", "Monsterdoorkey", "Monsterdoor", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player", "PlayerCollide", "SpawnMonster", true, 0);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
}
void SpawnMonster(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_3", true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "RoomTwoArea", "CollideRoomTwo", true, 0);
AddUseItemCallback("", "WaterDoorkey", "WaterDoor", "UsedKeyOnDoor", true);
}
void CollideRoomTwo(string &in asParent, string &in asChild, int alstate)
{
SetSwingDoorClosed("RoomTwoDoor", true, true);
GiveSanityDamage(90 , true);
PlayGuiSound("react_past", 1);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 0, false);
RemoveItem(asItem);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}
Check so everything is spelled right
(This post was last modified: 04-26-2012, 03:15 PM by SilentStriker.)
|
|
04-26-2012, 03:12 PM |
|
|