Frictional Games Forum (read-only)

Full Version: Scripts Recollection
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12
(01-10-2011, 11:04 PM)Tony32 Wrote: [ -> ]Hmm. Can anyone explain/tell me which function is used to trigger something when an item is picked up?
ex. When I pickup a bowl, something will happen. (NOT when I use the bowl)

Thanks.

Heres the code:

Code:
if(HasItem("NAME OF ITEM") == true) {
Bla Bla Stuff Here        
}

Example:

Code:
void OnStart()
{
if(HasItem("cutter_1") == true) {
        
bla bla

        }
}
(01-10-2011, 11:59 PM)house Wrote: [ -> ]Heres the code:

Code:
if(HasItem("NAME OF ITEM") == true) {
Bla Bla Stuff Here        
}

Example:

Code:
void OnStart()
{
if(HasItem("cutter_1") == true) {
        
bla bla

        }
}

Thank you. Is that the correct way to do it? I did something else to make it work, but I aint sure if it's the correct one. I did it like this:
Code:
void OnStart()
{
SetEntityCallbackFunc("Storage_Key","PickUpKeyStorage");
}

then the PickUpKeyStorage function:
Code:
    //Pick up storage key
    void  PickUpKeyStorage(string& asName, string& asCallback)
    {
        AddDebugMessage("Picked up the Storage Key.", false);
    }

It surely works perfect, but is it correct? :p
Thanks!
I think this thread should be stickied. Great source of info :Shy
Agreed, what the above post said.
(01-11-2011, 02:37 PM)Tony32 Wrote: [ -> ]
Code:
void OnStart()
{
SetEntityCallbackFunc("Storage_Key","PickUpKeyStorage");
}

then the PickUpKeyStorage function:
Code:
    //Pick up storage key
    void  PickUpKeyStorage(string& asName, string& asCallback)
    {
        AddDebugMessage("Picked up the Storage Key.", false);
    }

It surely works perfect, but is it correct? :p
Thanks!

You could alternatively just write PickUpKeyStorage in the callback field of the key.
Is the creator of this thread still active on the forum?
Or else we might wanna recreate the thread so it can be edited.
(01-15-2011, 06:25 PM)Akumasama Wrote: [ -> ]Is the creator of this thread still active on the forum?
Or else we might wanna recreate the thread so it can be edited.

Currently doing this, would you mind making the 2nd post? If we have a character limit on this forum we might need a 2nd post.
Do you mean that I make the second post on the topic or...?
If so, tell me when you're going to make it so I can post quickly Smile

And I'll be on everyday to check for new stuff ofcourse.
How about something for those of us that don't know heads or tails about programming, and don't even wanna try to learn?
(01-21-2011, 11:45 PM)Ianlis Wrote: [ -> ]How about something for those of us that don't know heads or tails about programming, and don't even wanna try to learn?

They don't deserve to make levels.
Or any other kind of game that needs scripting/coding to make something.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12