This should do the trick...
# 11/2001 GBK
Symbols
Message Activated
Message Touched
Message Timer
Surface Switch_on
Surface Switch_off
Surface Field_0 LinkID=1
Surface Field_1 LinkID=1
Template Smoke
Flex Field_damage
Sound Field_on
Sound Field_off
Sound Field_ambient
Sound Field_hit
Int Field_channel=-1 Local
Thing Victem=0 Local
Int Lock=0 Local
End
Code
Activated:
If((Getsenderref() == Switch_on) && (Lock == 0)) { Lock=1; Call Field__On; }
Else If((Getsenderref() == Switch_off) && (Lock == 1)) { Lock=0; Call Field__off; } Stop;
Touched:
If(GetsenderID() == 1) {
Victem = Getsourceref(); Damagething(Victem, Field_damage, 0x4, Victem);
Creatething(Smoke, Victem); Playsoundthing(Field_hit, Victem, 1.0, 0.5, 10.0, 0x4); } Stop;
Field__on:
Playsoundpos(Field_on, Getsurfacecenter(Field_0), 1.0, 1, 10, 0x0);
Setwallcel(Switch_on, 1); SettimerEX(Getsoundlen(Field_on), 101, 0, 0);
Setfacetype(Field_0, 0x2);
Setfacetype(Field_1, 0x2);
Clearadjoinflags(Field_0, Getadjoinflags(Field_0));
Clearadjoinflags(Field_1, Getadjoinflags(Field_1));
Setadjoinflags(Field_0, 0x5);
Setadjoinflags(Field_1, 0x5);
Setfacegeomode(Field_0, 0x4);
Setfacegeomode(Field_1, 0x4);
Setsurfaceflags(Field_0, 0x4004);
Setsurfaceflags(Field_1, 0x4004);
Field_channel = Playsoundpos(Field_ambient, Getsurfacecenter(Field_0), 1.0, 1, 10, 0x1);
Stop;
Field__off:
Stopsound(Field_channel, 0.1);
Setfacetype(Field_0, 0x0);
Setfacetype(Field_1, 0x0);
Setadjoinflags(Field_0, 0x7);
Setadjoinflags(Field_1, 0x7);
Setfacegeomode(Field_0, 0x0);
Setfacegeomode(Field_1, 0x0);
Playsoundpos(Field_off, Getsurfacecenter(Field_0), 1.0, 1, 10, 0x0);
Setwallcel(Switch_off, 1); SettimerEX(Getsoundlen(Field_off), 102, 0, 0);
Stop;
Timer:
If(GetsenderID() == 101) { Setwallcel(Switch_on, 0); }
If(GetsenderID() == 102) { Setwallcel(Switch_off, 0); } Stop;
End
It works, I tested it.
------------------
Success is the inverse relationship between effort, gain, and loss.
And when the moment is right, I'm gonna fly a kite.