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
Script Help Broken Script
Manbearpig116 Offline
Junior Member

Posts: 9
Threads: 4
Joined: Apr 2012
Reputation: 0
#1
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
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#2
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 Smile

(This post was last modified: 04-26-2012, 03:15 PM by SilentStriker.)
04-26-2012, 03:12 PM
Find




Users browsing this thread: 1 Guest(s)