The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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
need help: if HasItem, spawn monster
Ghostblade Offline
Junior Member

Posts: 3
Threads: 1
Joined: Feb 2012
Reputation: 0
#1
need help: if HasItem, spawn monster

Hey guys.

I've got a bit of a scripting problem (or so it seems). What I want to have happen is the player picks up a key, walks into an area, and (since they have a key) the monster starts beaking down a door behind the player.

When I tested it, it didn't seem to work. Here's the whole .HPS file (it's not very big):

Spoiler below!

void OnStart()
{
SetEntityCallbackFunc("keytonextstage", "OnPickup");

AddUseItemCallback("", "keytostorageroomonedoor", "storageroomonedoor", "KeyOnDoorStorageRoomOneDoor", true);

AddEntityCollideCallback("Player", "furiousenemyspawn", "collidefuriousenemyspawn", true, 1);
}

void collidefuriousenemyspawn(string &in asParent, string &in asChild, int alState)
{
if(HasItem("keytostorageroomonedoor") == true)
{
SetEntityActive("furious_enemy", true);
ShowEnemyPlayerPosition("furious_enemy");
}
}


//void OnPickup(string &in asEntity, string &in type)
//{
// SetEntityActive("furious_enemy", true);
// ShowEnemyPlayerPosition("furious_enemy");
//}

void KeyOnDoorStorageRoomOneDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("storageroomonedoor", false, true);
PlaySoundAtEntity("", "unlock_door", "storageroomonedoor", 0, false);
RemoveItem("keytostorageroomonedoor");
}

void OnEnter()
{

}

void OnLeave()
{

}


The bolded parts are the key bits.

Is there any reason why this might not be working?
02-06-2012, 04:16 AM
Find


Messages In This Thread
need help: if HasItem, spawn monster - by Ghostblade - 02-06-2012, 04:16 AM



Users browsing this thread: 1 Guest(s)