i need a cog, that when the player gets hit.he becomes invincible for 5 secs and plays a sound.this is for a mod im makin.
This is the static archive of the Massassi Forums. The forums are
closed indefinitely. Thanks for all the memories!
You can also download
Super Old Archived Message Boards
from when Massassi first started.
"View" counts are as of the day the forums were archived, and will no longer increase.
# Demo cog for avpman
#
# Makes the player invulerable after being hit
# Don't know why ... but now I do.
#
# [DP]
#
symbols
thing player local
thing shooter local
int okay local
sound afterHit
sound congrats
sound congrats1
sound congrats2
sound congrats3
sound congrats4
sound congrats5
Message Startup
Message Damaged
Message Timer
end
code
Startup:
okay = 1;
Damaged:
player = GetSenderRef();
shooter = GetThingParent(GetSourceRef());
If(!okay) Return;
PlaySoundThing(afterHit, player, 1, -1, 10, 0x80);
PlaySoundThing(congrats[rand()*5], shooter, 1, -1, 10, 0x80);
// 10 is the maxium distance it can be heard
SetTimer(5);
ReturnEx(GetParam(0) * 0);
Timer:
okay = 0;
Sleep( *put a flex here as a delay* );
okay = 1;
end![http://forums.massassi.net/html/wink.gif [http://forums.massassi.net/html/wink.gif]](http://forums.massassi.net/html/wink.gif)
![http://forums.massassi.net/html/redface.gif [http://forums.massassi.net/html/redface.gif]](http://forums.massassi.net/html/redface.gif)
![http://forums.massassi.net/html/wink.gif [http://forums.massassi.net/html/wink.gif]](http://forums.massassi.net/html/wink.gif)
I can rig it so you can't fire during that delay.PlaySoundThing(afterHit, player, 1, -1, 10, 0x80); PlaySoundThing(congrats[rand()*5], shooter, 1, -1, 10, 0x80);
![http://forums.massassi.net/html/wink.gif [http://forums.massassi.net/html/wink.gif]](http://forums.massassi.net/html/wink.gif)