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 → Disabling weapons
Disabling weapons
2006-06-14, 4:12 AM #1
I am looking for the simplest, most effective way to disable (and later on re-enable) a player's weapons. I don't need a fully-fledged cog, and don't worry about synchronization and stuff. Just the quick and dirty verbs. Thanks.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2006-06-14, 3:37 PM #2
SetInvAvailable() might do it, but I dunno for sure. That would be the easiest way.

Otherwise, you can probably store the weapon counts in memory and set them all to 0 until you want to re-enable them (extra work might be required here since the player can pick up the weapons from dead enemies, ruining the effect)

Another possibility is to utilize SetCurInvWeapon() all of the disabled weapons to a dummy weapon bin that always returns -1 in the autoselect message, and then switch the bins back to re-enable them

I am of course, assuming you want to prevent selection+mounting of the weapons altogether...
May the mass times acceleration be with you.
2006-06-14, 11:27 PM #3
Yeah, both have to be disabled. And pickup is no issue, since the player will be a ghost (thingflags 0x100). Thanks, I'll try your suggested verbs.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2006-06-15, 6:20 AM #4
Ok, I use multiple SetInvAvailables in combination with AssignWeapon(player, 0) now. There are two problems:
- No weapon mesh is seen after a reactivation of the bryar weapon
- force icons flicker (the bms you see when switching powers are only displayed for 1/10th of a second or so) after reactivation

Any ideas?
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2006-06-15, 6:27 AM #5
Ok, the first problem is solved...just run a SelectWeapon(player, AutoSelectWeapon(player, 1)) after the re-enabling of your weapons...
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2006-06-16, 11:13 AM #6
Look at the ammo.cog within the Disable Weapons and Drop Flag 2006-05-16-1912.zip file.

:)
2006-06-17, 2:31 AM #7
Hmmm, thanks. It doesn't explain how to disable/enable force powers without having the flickery-flicker on the bms, though...
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2006-06-17, 9:17 PM #8
(1 or more characters this! vbulletin!)
Quote:
Datamaster:
When a bin is available, the item of that bin is usable. You can have an amount greater than zero in the bin, and yet it won't be available. Availability makes forces and items show up in their selection boxes. Use IsInvAvailable() to check if the bin is available or not. A bin must be available for its hotkey to work. If a force or item is available, but you don't have anything in the bin, the selection boxes will flicker when they view the force or item; however, the cog will still work.
-Hell Raiser
2006-06-18, 2:31 AM #9
Perfect! Thanks a lot.

I now use this:
Code:
// Deactivation
if(IsInvAvailable(player, force_bin)) SetInvAvailable(player, force_bin, 0);

// Reactivation
if(GetInv(player, force_bin) > 0) SetInvAvailable(player, force_bin, 1);

It works like a charm...
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)

↑ Up to the top!