i created an area (on the button) where the player has to interact with (like pushing this button)
PHP Code:
void OnStart()
{
AddEntityCollideCallback("Player", "shelfarea", "rotate", true, 1);
}
void rotate(string &in asEntity, int alState)
{
SetMoveObjectState("rotate_shelf_01",1.0f);
PlayMusic("10_puzzle01.ogg",false,0.7,0.1,10,false);
GiveSanityBoostSmall();
return;
}
why does it not work
(yes i connected the shelf with the angular offset area//all names are correct etc)
greetings
via button? why u use Collision Callback then?
use this
void OnStart()
{
SetEntityConnectionStateChangeCallback("BUTTONNAMEHERE", "func_shelf");
}
void func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("SHELFNAMEHERE",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
}
Editing the footage i got from the livestream btw XD
________________________________________________
Apparently this doesn't work ^^, so im stumped for answers. Statyk, russ, flames, anyone?
Unless its the no spaces after the commas...
Just figured it out, wrong syntax
void rotate(string &in asParent, string &in asChild, int alState)
Go into the level editor, click on the button. In the entity tab. Under PlayerInteractCallBack. Type ShelfMove
Hit enter and save. In your .hps put this in:
Quote:void ShelfMove(string &in asEntity)
{
SetMoveObjectState("Shelf_name",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
Okay, you ready for this? I'm gonna give y'all the low down on how buttons work in Amnesia. Let's gooo...
Go into your level editor and select the button you want to be press-able. From there go to Entities and go down to the box that says PlayerInteractCallback (d'ya see it?). Okay, type whatever you want into this box (let's say PressButton in this case). Now go and take your already developed script and make it look a little like this:
That's right, we don't need to have something in the OnStart for this, it's all LevelEditor & callback, baby.
Okay, hope that helped. See ya.
thanks dude, it finally works.
goddamn it was easier as i thought