Finalizing AWOL and there's a few effects or code snippets that should work standalone I wanted to share. This is a "Proximity Activator" that we used for Metal Gear Solid style doors that would automatically open when you were nearby, and allow for keycard requirements. It's like a touchplate without the actual touchplate. This works by abusing the sector locking lotag. Place it in a sector where you would otherwise put an ACTIVATOR or ACTIVATORLOCKED. We ran in to some weirdness with multi-sector effects, IE double ST doors with windows. I'm sure this could be solved but we just avoided those setups instead. Also DNUNLOCK probably breaks this, so might want to fix that if you care.
Set the palette of the actor to match the keycard you want, or set to PAL 6 to require all 3 keys. This code requires gamevars to be setup. No support will be provided for this code.
/*
// Proximity Activator
// LOTAG = Matching Activator LOTAG
// HITAG = Activation radius in units
// PAL = Require keycard, 1 = Blue, 2 = Red, 7 = Yellow, 6 = ALL 3
*/
appendevent EVENT_LOADACTOR
{
ife sprite[].picnum PROXIMITYACTIVATOR
{
seta .cstat 32768
geta .pal ACTORPATH
seta .pal 0
geta .lotag ACTORSPAWN
seta .lotag 0
// Set minimum range to 128 units, to prevent 0 distance weirdness
geta .hitag ACTORSEARCHRANGE
clamp ACTORSEARCHRANGE 128 MAXINT
seta .hitag 0
// Start sector locked
gets .lotag ACTORTEMP
add ACTORTEMP 16384
sets .lotag ACTORTEMP
}
}
endevent
defstate proximity_activate
{
ife ACTORPATH 0
operateactivators ACTORSPAWN 0
else
{
ife ACTORPATH 1
{
ifand player[].got_access 1 //blue
operateactivators ACTORSPAWN 0
}
else
ife ACTORPATH 2
{
ifand player[].got_access 2 //red
operateactivators ACTORSPAWN 0
}
else
ife ACTORPATH 7
{
ifand player[].got_access 4 //yellow
operateactivators ACTORSPAWN 0
}
else
ife ACTORPATH 6
{
ifand player[].got_access 1
ifand player[].got_access 2
ifand player[].got_access 4 //all
operateactivators ACTORSPAWN 0
}
}
}
ends
useractor notenemy PROXIMITYACTIVATOR
{
sleeptime 300
getu .vm_distance ACTORCHECK2
ifl ACTORCHECK2 ACTORSEARCHRANGE
{
ife ACTORNEAR FALSE
{
set ACTORNEAR TRUE
state proximity_activate
}
}
else
{
ife ACTORNEAR TRUE
{
set ACTORNEAR FALSE
state proximity_activate
}
}
}
enda