Door Script won't work
Posted: Sun Oct 05, 2008 12:56 pm
I am making a script for a door that opens and closes with various animations. It isn't complete, but it won't work. No console, no model in the scene. Just an open space where the door should be. here's the script. Every { has a } and every [ has a ]. The script starts with a { and ends with a } and I still can't see where it goes wrong:
Thanks for reading, and I hope you can help me
Code: Select all
{
ACCIONSLOTS [0]
OPENORCLOSED [0] //Open is 1, closed is 0
Spawn[()
{
Console(true);
LowLevel("IsClose");
return 0;
}]
IsClose[()
{
AnimationSpeed(1.50);
if(OPENORCLOSED = 0)
{
if(FastDistance("jugador", 50))
{
if(GetAttribute("Acciones", "jugador") = 0)
{
ACCIONSLOTS = 1;
self.think = "Closed";
return 0;
}
if(GetAttribute("Acciones", "jugador") = 1)
{
ACCIONSLOTS = 2;
self.think = "Closed";
return 0;
}
if(GetAttribute("Acciones", "jugador") = 2)
{
ACCIONSLOTS = 3;
self.think = "Closed";
return 0;
}
if(GetAttribute("Acciones", "jugador") = 3)
{
return 0;
}
}
}
if(OPENORCLOSED = 1)
{
if(FastDistance("jugador", 50))
{
if(GetAttribute("Acciones", "jugador") = 0)
{
ACCIONSLOTS = 1;
self.think = "Open";
return 0;
}
if(GetAttribute("Acciones", "jugador") = 1)
{
ACCIONSLOTS = 2;
self.think = "Open";
return 0;
}
if(GetAttribute("Acciones", "jugador") = 2)
{
ACCIONSLOTS = 3;
self.think = "Open";
return 0;
}
if(GetAttribute("Acciones", "jugador") = 3)
{
return 0;
}
}
}
}]
Closed[()
{
if(FastDistance("jugador", 50) = false)
{
self.think = "IsClose";
return 0;
}
SetTarget("jugador");
SetFOV(179); //Si lo ve, es que es para empujar.
SetAttribute("Acciones", ACCIONSLOTS, "jugador");
if(ACCIONSLOTS = 1)
{
if(IsKeyDown(29))
{
if(self.enemy_vis = true)
{
SetPosition("jugador", self.current_X , self.current_Y, self.current_Z - 8);
Animate("opendoor");
AnimateEntity("Pulldoor", "jugador", true);
if(jugador.animate_at_end)
{
SetAttribute("Accionando", 0, "jugador");
AnimateBlend("opened", 1);
OPENORCLOSED = 1;
Self.think = "Open";
}
}
}
}
}]
Open [()
{
if(FastDistance("jugador", 50) = false)
{
self.think = "IsClose";
return 0;
}
SetTarget("jugador");
SetFOV(179); //Si lo ve, es que es para empujar.
SetAttribute("Acciones", ACCIONSLOTS, "jugador");
if(ACCIONSLOTS = 1)
{
if(IsKeyDown(29))
{
if(self.enemy_vis = true)
{
SetPosition("jugador", self.current_X , self.current_Y, self.current_Z - 8);
Animate("closedoor");
AnimateEntity("Pulldoor", "jugador", true);
if(jugador.animate_at_end)
{
SetAttribute("Accionando", 0, "jugador");
AnimateBlend("closed", 1);
OPENORCLOSED = 0;
Self.think = "Closed";
}
}
}
}
}]
}