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
Scripting assistance requested!
SLAMnesia Offline
Member

Posts: 99
Threads: 39
Joined: May 2011
Reputation: 0
#1
Scripting assistance requested!

lol jk I think that subject line would get more attention than "SCRIPT HELP"

<for those who cant script you may not read past this line>
------------------------------------------------------------------

you're reading and therefore you are a scriptor or immune to my commands
anyways:

I have a problem that I'm really not sure how or where to start it. Here's the situation though:
I have one coal intake machine thing, posing as an industrial cleaner.
What I'd like to have happen is you put a dirty blob "a rock" into the cleaner (its an entity not an item, so you pick it up and bring it into the cleaner) and once its inside the cleaner you must close the cleaner door (it self locks for a few seconds) and hit a lever. After the lever has been triggered for a few seconds the screen shakes, a few lights brighten ect (lasts 2 seconds please). Once that has been completed the dirty blob disappears and a clean shiney statuette is left in the cleaner Big Grin
here's the names
dirty object: dirty_object
clean object: clean_object
script area inside cleaner (if needed):cleaner_area
cleaner door: cleaner_door
cleaner: cleaner
lights: light1, light2 light3
cleaner lever: cleaner_lever

I don't understand the immensity of my request, but I do understand thank you's and I almost owe you one for reading all that Wink but you gotta earn it!!
Super thanks and virtual hugs to anyone who can solve my problem
(This post was last modified: 06-12-2011, 01:07 AM by SLAMnesia.)
06-11-2011, 08:53 AM
Find
laser50 Offline
Member

Posts: 242
Threads: 22
Joined: Apr 2011
Reputation: 0
#2
RE: SUP /B/!

You can easily Look up for the functions on the wiki and do a search on the forum, Because Most of this can be found in the forum..
06-11-2011, 10:29 AM
Find
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
#3
RE: SUP /B/!

instead of joking around with fake titles, make a propper title and the people who can help gets a little motivation to help.

[Image: 44917299.jpg]Dubstep <3
06-11-2011, 12:34 PM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#4
RE: SUP /B/!

This is one of those multi-step processes that could take hours to properly contruct.

I could start you off a little...

Make an area inside of the cleaner and then add an EntityCollideCallback for the collision of "dirty_object" and "cleaner_area". You would also have to make sure that the "dirty_object" is inside of the "cleaner" when the player closes the "cleaner_door", causing it to lock.

void OnStart()
{
    SetLocalVarInt("ObjectIn", 0);
    SetLocalVarInt("LevPulled", 0);
    AddEntityCollideCallback("dirty_object", "cleaner_area", "Func01", false, 1);
    AddEntityCollideCallback("dirty_object", "cleaner_area", "Func02", false, -1);
    SetEntityConnectionStateChangeCallback("cleaner_lever", "Func03");
    Func04();
}
void Func01(string &in asParent, string &in asChild, int alState)
{
    SetLocalVarInt("ObjectIn", 1);
}
void Func02(string &in asParent, string &in asChild, int alState)
{
    SetLocalVarInt("ObjectIn", 0);
}
void Func03(string &in asEntity, int alState)
{
    if (alState == 1)
    {
        SetLocalVarInt("LevPulled", 1);
    }
    else if (alState == 0)
    {
        SetLocalVarInt("LevPulled", 0);
    }
    else if (alState == -1)
    {
        SetLocalVarInt("LevPulled", 0);
    }
}
void Func04()
{
    if (GetSwingDoorClosed("cleaner_door") == true)
    {
        if (GetLocalVarInt("ObjectIn") == 1)
        {
            SetSwingDoorLocked("cleaner_door", true, true);
            //Add sound effect here maybe.
            if (GetLocalVarInt("LevPulled") ==  1)
            {
                SetLeverStuckState("cleaner_lever", 1, true);
                RemoveEntityCollideCallback("dirty_object", "cleaner_area");
                AddTimer("", 3, "Func05");
            }
        }
    }
}
void Func05(string &in asTimer)
{
    SetSwingDoorLocked("cleaner_door", false, true);
    SetEntityActive("dirty_object", false);
    SetEntityActive("clean_object", true);
    //Insert light, sound, and shake effects here!
}

(This post was last modified: 06-11-2011, 01:06 PM by Kyle.)
06-11-2011, 01:04 PM
Find
SLAMnesia Offline
Member

Posts: 99
Threads: 39
Joined: May 2011
Reputation: 0
#5
RE: SUP /B/!

(06-11-2011, 01:04 PM)Kyle Wrote: Make an area inside of the cleaner and then add an EntityCollideCallback for the collision of "dirty_object" and "cleaner_area". You would also have to make sure that the "dirty_object" is inside of the "cleaner" when the player closes the "cleaner_door", causing it to lock.

umm you want me to make the script for the EntityCollideCallback? I donno much about scripting, I can do simple stuff but levers and cranks jam me up pretty hard. and what should this function; """Make an area inside of the cleaner and then add an EntityCollideCallback for the collision of "dirty_object" and "cleaner_area" """ do? Im just confused sorry
06-12-2011, 12:51 AM
Find
Acies Offline
Posting Freak

Posts: 1,643
Threads: 60
Joined: Feb 2011
Reputation: 73
#6
RE: Scripting assistance requested!

Kyle's script pretty much does the job. Some things could be removed, but there is nothing wrong with it - everyone scripts in their unique way.

(06-12-2011, 12:51 AM)SLAMnesia Wrote:
(06-11-2011, 01:04 PM)Kyle Wrote: Make an area inside of the cleaner and then add an EntityCollideCallback for the collision of "dirty_object" and "cleaner_area". You would also have to make sure that the "dirty_object" is inside of the "cleaner" when the player closes the "cleaner_door", causing it to lock.

umm you want me to make the script for the EntityCollideCallback? I donno much about scripting, I can do simple stuff but levers and cranks jam me up pretty hard. and what should this function; """Make an area inside of the cleaner and then add an EntityCollideCallback for the collision of "dirty_object" and "cleaner_area" """ do? Im just confused sorry

You should create a script area inside of the cleaner named "cleaner_area". The rest is done in his script. The only thing missing is to add the lights you want and set them to radius 0.
Then create 2 timer functions which uses the command:
FadeLightTo(string& asLightName, float afR, float afG, float afB, float afA, float afRadius, float afTime);


As for the effects you are looking for refer to the:
http://wiki.frictionalgames.com/hpl2/amn..._functions

Trying is learning Smile


[Image: mZiYnxe.png]


06-12-2011, 01:31 AM
Find
SLAMnesia Offline
Member

Posts: 99
Threads: 39
Joined: May 2011
Reputation: 0
#7
RE: Scripting assistance requested!

Im learning that is true Smile and by that I mean trying. There is a problem with the script, there's no error and the level opens fine, except the whole thing doesnt work Sad any suggestions to potential problems? All the names match up
06-12-2011, 05:36 AM
Find
Kyle Offline
Posting Freak

Posts: 911
Threads: 36
Joined: Sep 2010
Reputation: 7
#8
RE: Scripting assistance requested!

(06-12-2011, 05:36 AM)SLAMnesia Wrote: Im learning that is true Smile and by that I mean trying. There is a problem with the script, there's no error and the level opens fine, except the whole thing doesnt work Sad any suggestions to potential problems? All the names match up

What exactly is this "cleaner" and "cleaner_door" objects? Is it the one from the game?

06-12-2011, 12:11 PM
Find




Users browsing this thread: 2 Guest(s)