insane_metalhead, on Jul 9 2010, 07:59 AM, said:
I just don't know what to put first or to start with.
I got this, and trying to figure out what to do and such:
define WINDACTOR 19 useractor notenemy WINDACTOR cstat 32768 ifpdistl 864 ifcansee ifp palive ifhitweapon { soundonce WIND } enda
But this doesn't does anything.
There could be several different things wrong with that code that's causing it not to work. If its cstat is set at 32768 it will, indeed, be invisible, but it won't do anything when hit by a weapon because it doesn't have the proper bits to make it "hittable" (or however you'd phrase that). You'll need to add 256 to the cstat (see the cstat page on the wiki to get an idea of how all the bits work). Also, can't really confirm it, but that ifpdistl line could be throwing things out of whack too. A distance check probably isn't necessary if you just want it to execute some kind of code if it gets hit, here's some rough code that'll mostly achieve the effect you're going for...
Quote
useractor notenemy THIS_VAGUELY_DESCRIBED_THING_THAT_IS_INVISIBLE 0
cstat 33024
ifhitweapon { sound BAR_MUSIC } enda
That'll make the actor invisible and be receptive to hits, but it won't be blocked so the player can still walk through it. There's no real need to change the actor after its been hit, because it'll just keep playing the same sound, but it won't start it over again. You definitely won't want to use killit (i.e, delete it from the map) because that'll stop playing the sound altogether. I don't know how your wind ambience sound is defined, but for the bar music sound, I had to change its definesound from this
definesound BAR_MUSIC barmusic.voc 0 0 254 2 0
to this
definesound BAR_MUSIC barmusic.voc 0 0 254 1 0
The sound won't loop if you don't change that one little bit.