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 Moving shelf via button
Quotentote Offline
Member

Posts: 118
Threads: 23
Joined: Dec 2011
Reputation: 11
#1
Moving shelf via button

i created an area (on the button) where the player has to interact with (like pushing this button)

PHP Code: (Select All)
void OnStart()
{
AddEntityCollideCallback("Player""shelfarea""rotate"true1);
}

void rotate(string &in asEntityint 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 Sad

(yes i connected the shelf with the angular offset area//all names are correct etc)

greetings
01-21-2012, 05:19 AM
Find
Tripication Offline
Member

Posts: 172
Threads: 19
Joined: Dec 2011
Reputation: 6
#2
RE: Moving shelf via button

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)

[Image: speedart__2___yoshimitsu_by_kamofudge-d4yo6kk.png]
(This post was last modified: 01-21-2012, 05:47 AM by Tripication.)
01-21-2012, 05:23 AM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#3
RE: Moving shelf via button

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;
}

(This post was last modified: 01-21-2012, 06:04 AM by flamez3.)
01-21-2012, 05:47 AM
Find
triadtimes Offline
Senior Member

Posts: 508
Threads: 16
Joined: Jan 2011
Reputation: 21
#4
RE: Moving shelf via button

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:

Spoiler below!
OnStart
{
//Functions go here //But we don't need one for this button
}

//Lines of code

void PressButton(string &in asEntity) //Entirely new callback
{
//Stuff you wanted to do when the button is pressed
}

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.

01-21-2012, 05:57 AM
Find
Quotentote Offline
Member

Posts: 118
Threads: 23
Joined: Dec 2011
Reputation: 11
#5
RE: Moving shelf via button

thanks dude, it finally works.
goddamn it was easier as i thought Big Grin
01-21-2012, 06:09 AM
Find




Users browsing this thread: 3 Guest(s)