(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."
AddEntityCollideCallback("coal_*","area_coal","CoalBurner",false,1);
//The "*" basically means everything named coal_ and a number
You'll also need this local variable:
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.
void CoalBurner(string &in asParent, string &in asChild, int 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(asParent, false, 5.0f);
AddLocalVarInt("CoalCheck",1);
}
else
{
//Makes the coal piece disappear
SetPropActiveAndFade(asParent, false, 3.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.