Massassi Forums Logo

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.

ForumsCog Forum → need cog, at least read before u turn me down
need cog, at least read before u turn me down
2002-07-04, 8:56 AM #1
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.
2002-07-04, 11:29 AM #2
Here.
Code:
# 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
Has a delay, so the player is invulerable for five seconds, but you set the delay for the time after invulerablity but before you can be invulerable agian. [http://forums.massassi.net/html/wink.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions

[This message has been edited by Descent_pilot (edited July 04, 2002).]
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-04, 1:10 PM #3
thanks 4 the cog but...where do i type in the sound at? before or after "after hit" and how many spaces? etc.....i usually am used to have a sound already in place to just rewrite
2002-07-04, 1:12 PM #4
Oops, check the relpy above for a revised edition. [http://forums.massassi.net/html/redface.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-04, 1:13 PM #5
o yea. and how can i make the max health 6 instead of 100. the lasers take way one life out of 6 aka the 6 health . can i do this withinthe level . or must i do seperate cog work.
2002-07-04, 1:14 PM #6
Change the template.

------------------
The Sniper Missions. Current project, The Sniper Missions
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-04, 1:15 PM #7
sorry about all the posts but my edit key dont work for some odd reason. but i can use the cog u gave me in multiplayer right? its a LASER TAG MOD
2002-07-04, 1:18 PM #8
i also need just ....1 more...teensy lil cog.....somehow i need , when ever u hit another player , randomly selected about 1 out of every 5 shots i want to play a sound for example . if i shoot u the vest computer says "good shot" or something.but not all the time just random .is this possible or will it cause lag .
2002-07-04, 1:19 PM #9
Check the revised edition, just give me a minute after I post this. [http://forums.massassi.net/html/wink.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-04, 1:20 PM #10
GOD IM SO SORRY . err...uh....the invincible for 5 sec cog .....how do i set how much time im invincible for? where at?
2002-07-04, 1:25 PM #11
SetTimer(5);
and
Sleep( some number for the delay );

Hold on, I can't do everything this fast. [http://forums.massassi.net/html/wink.gif] I can rig it so you can't fire during that delay.

------------------
The Sniper Missions. Current project, The Sniper Missions
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-04, 1:28 PM #12
one last question....do i replace afterhit with the sound file name?
2002-07-04, 1:30 PM #13
One more thing, congrats 5 is a failsafe. (Don't ask.) Add in the sound files after and make it local, like this. 'sound afterHit=whater.wav local'

------------------
The Sniper Missions. Current project, The Sniper Missions

[This message has been edited by Descent_pilot (edited July 04, 2002).]
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-04, 1:32 PM #14
one last thing and im good to go i assume. where do i put the SOUND FILE NAME so the cog will play it when im hit. and explain the parameters like congrats? wha tare they for and how do i use them.
2002-07-04, 1:42 PM #15
In the symbols section.

Congrats are the sounds that play things like 'Good Shot' and so forth. Congrats should get played to the person who shot the laser, and afterHit should get played to the person got hit. Set it up just like afterHit in the symbols section.

I couldn't have used PlaySoundLocal(); because that would only play on the host's computer. So I did PlaySoundThing(); so you also hear it around the person.

You can change the 1 and the 10s in those lines, 1 is the volume, 10 is the maxdistance.

While I'm here, do you want it set up so you can't fire while invulerable?

------------------
The Sniper Missions. Current project, The Sniper Missions
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-04, 1:44 PM #16
yes , i also tested this cog in SP it didint work o.o does it need to be in MP? answer before u change anything
2002-07-04, 1:48 PM #17
Yes, because of the damaged: message. You should here the congrats sound in SP if you shoot a guy. Post your cog with your sound files there.

------------------
The Sniper Missions. Current project, The Sniper Missions
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-04, 1:51 PM #18
# 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=dsaw.wav local
sound congrats=gs.wav local
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], player 1, -1, 10, 0x80);
// 10 is the maxium distance it can be heard
SetTimer(5);
ReturnEx(GetParam(0) * 0);
Timer:
okay = 0;
Sleep(5);
okay = 1;
end
2002-07-04, 1:53 PM #19
# 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=dsaw.wav local
sound congrats=gs.wav local
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], player 1, -1, 10, 0x80);
// 10 is the maxium distance it can be heard
SetTimer(5);
ReturnEx(GetParam(0) * 0);
Timer:
okay = 0;
Sleep(5);
okay = 1;
end
2002-07-04, 1:57 PM #20
I noted some small mistakes in my cog above, replace the PlaySoundThing lines with these.
Code:
PlaySoundThing(afterHit, player, 1, -1, 10, 0x80);
PlaySoundThing(congrats[rand()*5], shooter, 1, -1, 10, 0x80);
Two other things, make all congrats sounds gs.wav (you can change them later, this is for testing purposes) and use the code blocks "code" "/code" just replace "" with [] There's also a link UBB Code is ON. that has all the 'special' code seen at the forums, along with Smilies Legend. [http://forums.massassi.net/html/wink.gif]

------------------
The Sniper Missions. Current project, The Sniper Missions

[This message has been edited by Descent_pilot (edited July 04, 2002).]
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-04, 2:04 PM #21
im testing it in sp...it wont work not when i shoot someone or get hit :/
2002-07-04, 2:10 PM #22
This is why I perfer to stay out of MP cogs. I started this, so I'll finish this. Switch GetSenderRef(); and GetSourceRef(); .

------------------
The Sniper Missions. Current project, The Sniper Missions
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-04, 2:12 PM #23
do you have AIM? or a zone name? where we can talk easier or can u come to the #massassi chat on mirc
2002-07-04, 2:15 PM #24
No, here we can ask GBK or SaberMaster for help. (little bit of bait). I do/did have a Zone name, play over the net sometime?

------------------
The Sniper Missions. Current project, The Sniper Missions
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack
2002-07-04, 2:17 PM #25
i screw up cogs easy. i always prefur to have em made ready so i can just popem in and they work.
2002-07-04, 8:24 PM #26
I found it, my zone name, descent_pilot2 (because Dumb@$$ took my name!!!)

------------------
The Sniper Missions. Current project, The Sniper Missions
Major projects working on:
SATNRT, JK Pistol Mod, Aliens TC, Firearms

Completed
Judgement Day (HLP), My level pack

↑ Up to the top!