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
Multiple Issues Help Setting up the elevator machine
Tomato Cat Offline
Senior Member

Posts: 287
Threads: 2
Joined: Sep 2012
Reputation: 20
#5
RE: Setting up the elevator machine

(05-07-2013, 03:14 AM)serbusfish Wrote: I dont have anything so far as I dont know where to begin.

I'm not asking for anyone to write the entire thing out for me, I simply need to know where to start, what commands are needed, etc. I have only been scripting since January but I know my way around most of the basic commands, but when it comes to something as complex (I think?) as this machine im a little out of my depth.

Oh, no problem. =)

So, you want the player to replace 3 cogwheels, put some coal in and then pull the lever? Not terribly difficult once you get the hang of it. I'll give you a general idea and you can adjust it to your liking.

Let's start with the coal. I assume you're using the default elevator machine's coal burner.

Spawn in some coal pieces and keep the default names. Next, create a script area. Name it area_coal and place it inside the burner.

Then add a collide callback. The callback function will known as "CoalBurner."

PHP Code: (Select All)
AddEntityCollideCallback("coal_*","area_coal","CoalBurner",false,1);
//The "*" basically means everything named coal_ and a number 

You'll also need this local variable:

PHP Code: (Select All)
SetLocalVarInt("CoalCheck",0);
//Place it alongside the collide callback 

Now the function! What it essentially does is increment a variable every time a coal piece is added. If enough coal has already been added, the piece will disappear.

PHP Code: (Select All)
void CoalBurner(string &in asParentstring &in asChildint alState)
{
        
    if(
GetLocalVarInt("CoalCheck") < 3)
    {
                
//Increments CoalCheck variable and makes the piece disappear
        
AddDebugMessage("Adding coal piece "+asParent,false);
                
AddDebugMessage("Coal check now at "+GetLocalVarInt("CoalCheck"),false);
        
SetPropActiveAndFade(asParentfalse5.0f);
        
AddLocalVarInt("CoalCheck",1);
    }
    
        else
        {
            
//Makes the coal piece disappear
            
SetPropActiveAndFade(asParentfalse3.0f);
            
AddDebugMessage("Too much coal, incinerating!",false);
        }


Let me know how that turns out. Then I can help you with the sticky areas, if you like.
05-07-2013, 04:39 AM
Find


Messages In This Thread
Setting up the elevator machine - by serbusfish - 05-07-2013, 01:30 AM
RE: Setting up the elevator machine - by Rapture - 05-07-2013, 03:09 AM
RE: Setting up the elevator machine - by Tomato Cat - 05-07-2013, 04:39 AM



Users browsing this thread: 1 Guest(s)