by ramon.dexter » Sun Aug 26, 2018 5:47 am
Yep, correct. Forgot that there is PolyWait for polyobjects.
edit: Here, take a look at my "function" scripts - when used, it behaves as a linedef action. The speed is solely for sound purposes (when moving slow, is emits different sound than when moving faster).
Code: Select all
//POLYOBJECT DOORS
//=============================================================================================
//universal door script - one script to rule dem all
//==--------------------------------------------------==
#define MAX_SWINGING_DOORS 1000
bool polyDoor[MAX_SWINGING_DOORS]; //'dynamic' variable = array
//==--------------------------------------------------==
//universal door script with variable sound
//==--------------------------------------------------==
script "polyDRswing_Right" (int poly, int spd)
{
if(!polyDoor[poly])
{
Polyobj_RotateRight(poly, spd, 64);
if(spd < 16)
{
AmbientSound("DoorCreak", 127);
}
else if(spd >= 16)
{
AmbientSound("sounds/officeDopen", 127);
}
PolyWait(poly);
polyDoor[poly] = true;
}
else if(polyDoor[poly])
{
Polyobj_RotateLeft(poly, spd, 64);
if(spd < 16)
{
AmbientSound("DoorCreak", 127);
}
else if(spd >= 16)
{
AmbientSound("sounds/officeDclose", 127);
}
PolyWait(poly);
polyDoor[poly] = false;
}
}
script "polyDRswing_Left" (int poly, int spd)
{
if(!polyDoor[poly])
{
Polyobj_RotateLeft(poly, spd, 64);
if(spd < 16)
{
AmbientSound("DoorCreak", 127);
}
else if(spd >= 16)
{
AmbientSound("sounds/officeDopen", 127);
}
PolyWait(poly);
polyDoor[poly] = true;
}
else if(polyDoor[poly])
{
Polyobj_RotateRight(poly, spd, 64);
if(spd < 16)
{
AmbientSound("DoorCreak", 127);
}
else if(spd >= 16)
{
AmbientSound("sounds/officeDclose", 127);
}
PolyWait(poly);
polyDoor[poly] = false;
}
}
script "polyDRSlide" (int poly, int angle, int dist)
{
if(!polyDoor[poly])
{
Polyobj_Move(poly, 24, angle, dist);
PolyWait(poly);
polyDoor[poly] = true;
}
else if(polyDoor[poly])
{
Polyobj_Move(poly, 24, -angle, dist);
PolyWait(poly);
polyDoor[poly] = false;
}
}
Yep, correct. Forgot that there is PolyWait for polyobjects.
edit: Here, take a look at my "function" scripts - when used, it behaves as a linedef action. The speed is solely for sound purposes (when moving slow, is emits different sound than when moving faster).
[code]
//POLYOBJECT DOORS
//=============================================================================================
//universal door script - one script to rule dem all
//==--------------------------------------------------==
#define MAX_SWINGING_DOORS 1000
bool polyDoor[MAX_SWINGING_DOORS]; //'dynamic' variable = array
//==--------------------------------------------------==
//universal door script with variable sound
//==--------------------------------------------------==
script "polyDRswing_Right" (int poly, int spd)
{
if(!polyDoor[poly])
{
Polyobj_RotateRight(poly, spd, 64);
if(spd < 16)
{
AmbientSound("DoorCreak", 127);
}
else if(spd >= 16)
{
AmbientSound("sounds/officeDopen", 127);
}
PolyWait(poly);
polyDoor[poly] = true;
}
else if(polyDoor[poly])
{
Polyobj_RotateLeft(poly, spd, 64);
if(spd < 16)
{
AmbientSound("DoorCreak", 127);
}
else if(spd >= 16)
{
AmbientSound("sounds/officeDclose", 127);
}
PolyWait(poly);
polyDoor[poly] = false;
}
}
script "polyDRswing_Left" (int poly, int spd)
{
if(!polyDoor[poly])
{
Polyobj_RotateLeft(poly, spd, 64);
if(spd < 16)
{
AmbientSound("DoorCreak", 127);
}
else if(spd >= 16)
{
AmbientSound("sounds/officeDopen", 127);
}
PolyWait(poly);
polyDoor[poly] = true;
}
else if(polyDoor[poly])
{
Polyobj_RotateRight(poly, spd, 64);
if(spd < 16)
{
AmbientSound("DoorCreak", 127);
}
else if(spd >= 16)
{
AmbientSound("sounds/officeDclose", 127);
}
PolyWait(poly);
polyDoor[poly] = false;
}
}
script "polyDRSlide" (int poly, int angle, int dist)
{
if(!polyDoor[poly])
{
Polyobj_Move(poly, 24, angle, dist);
PolyWait(poly);
polyDoor[poly] = true;
}
else if(polyDoor[poly])
{
Polyobj_Move(poly, 24, -angle, dist);
PolyWait(poly);
polyDoor[poly] = false;
}
}
[/code]