Well, I wrote the script again and it seem to work now ... go figure. Who knows what idiotic typo I had in it the first time. I'll post it anyhow.
What I wanted to do was a lighter system simular to that in the new XBOX 360 game "Prey." I saw the idea in the demo of the game and liked it ... so decided to "Borrow" the idea. Basically this is what happens.
You turn you lighter on and it starts heating up. Once the heat reaches maxium heat the lighter goes out cause you can't hold it anymore, and you can't relight it until it drops past a certain heat mark.
I used the flashlight script posted here in these forums to start me off and so the code looks a lot like that code with a few more if statements thrown in. Was a good learning experience for me.
Code: Select all
{
KNUM [29]
ISON [false]
TRIG [flash]
CLCK [0]
INTV [25]
Spawn[()
{
LowLevel("setup");
}]
setup[()
{
SetNoCollision();
PawnRender(false);
self.think = "update";
}]
update[()
{
self.ThinkTime = 0.2;
self.think = "fll";
}]
fll[ ()
{
if(ISON)
{
PositionToPlayer(0, 30, 10, true);
if(GetAttribute("lighter_heat","Player") < 100){
CLCK = CLCK + 1;
if(CLCK > INTV){
ModifyAttribute("lighter_heat",1,"Player");
CLCK = 0;
}
}else{
SetEventState(TRIG, false);
ISON = false;
}
}
if(ISON = false)
{
if(GetAttribute("lighter_heat","Player") > 0){
CLCK = CLCK + 1;
if(CLCK > INTV){
ModifyAttribute("lighter_heat",-1,"Player");
CLCK = 0;
}
}
}
if(GetAttribute("lighter_heat","Player") < 75){
if(self.key_pressed=KNUM)
{
if(ISON = false)
{
SetEventState(TRIG, true);
ISON = true;
}
else
{
SetEventState(TRIG, false);
ISON = false;
}
}
}
}]
}