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 for Scripting Rotating Bookshelf
zTizzle Offline
Junior Member

Posts: 1
Threads: 1
Joined: Aug 2012
Reputation: 0
#1
Need Help for Scripting Rotating Bookshelf

Im trying to script my custom map so that when you pull a lever it rotates a bookshelf so the player can advance, but it isnt working.
Here is my code:
PHP Code: (Select All)
    SetEntityConnectionStateChangeCallback("lever_book""shelf");
void shelf(string &in asEntityint alState){     if (alState == 1)     {     SetMoveObjectState("books",1.0f);     PlaySoundAtEntity("""quest_completed.snt""shelf_move_1"0false);          return;     }} 

books is the name of the bookshelf, and lever_book is the name of the lever. Any ideas?

sorry the code looks really bad, this is my first post on this forum,
(This post was last modified: 08-28-2012, 03:13 AM by zTizzle.)
08-28-2012, 03:12 AM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#2
RE: Need Help for Scripting Rotating Bookshelf

Can you please specify what isn't working? Does it not have the desired effect in game, or is it crashing and giving you a message of what is causing it?

I rate it 3 memes.
08-28-2012, 03:23 AM
Find
johnbox Offline
Member

Posts: 138
Threads: 5
Joined: Aug 2012
Reputation: 4
#3
RE: Need Help for Scripting Rotating Bookshelf

(08-28-2012, 03:12 AM)zTizzle Wrote: Im trying to script my custom map so that when you pull a lever it rotates a bookshelf so the player can advance, but it isnt working.
Here is my code:
Spoiler below!
PHP Code: (Select All)
    SetEntityConnectionStateChangeCallback("lever_book""shelf");
void shelf(string &in asEntityint alState){     if (alState == 1)     {     SetMoveObjectState("books",1.0f);     PlaySoundAtEntity("""quest_completed.snt""shelf_move_1"0false);          return;     }} 

books is the name of the bookshelf, and lever_book is the name of the lever. Any ideas?

sorry the code looks really bad, this is my first post on this forum,
first, congratulations, i have no idea how, but you managed to confuse my android browser completely with this script. i'm not sure, if i'm the only one with this problem, but maybe you cut put the code into a spoiler, so this thread isn't messed up the whole time.
(you can do spoiler with [spoi ler] your text [/spoi ler] (obviously without the spaces^^)

but ok, first, i would recommend to make use of the lovely enter-key, makes it easier to work with, and sometimes, for example in python, you have to do it. if it's just because of the mixed up forum-post, then... this doens't matter, excuse me.

and could you tell us, what specifically is wrong? what happens in the cs, does the switch simply not work? crashing?


edit: and andy was faster, as always. sorry for the doubled question.

Working on a full conv.-mod, first pictures coming soon...


Working with Blender and other Stuff since 2009.
Using HPL-Engine since 2012 (learning..)
(This post was last modified: 08-28-2012, 03:35 AM by johnbox.)
08-28-2012, 03:29 AM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#4
RE: Need Help for Scripting Rotating Bookshelf

Here's how your script should look:


void OnStart()
{
SetEntityConnectionStateChangeCallback("lever_book", "shelf");
}


void shelf(string &in asEntity, int alState)
{
if(alState == 1)
{
SetMoveObjectState("books", 1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "Player", 0, false);
}
}

And here's a quick tutorial for secret shelves (just follow the top portion labeled "The Bookshelf"):

http://wiki.frictionalgames.com/hpl2/tut...cretshelfs


Hope that helped.

I rate it 3 memes.
08-28-2012, 03:34 AM
Find




Users browsing this thread: 1 Guest(s)