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 → Not THIS again...
Not THIS again...
2002-11-13, 2:49 PM #1
I never could get that new weapons selection system to work.

Code:
# Xan_Weap.cog
#
# weapTrig param0 (1 = mount, 0 = dismount)
# pickTrig param0 (weapNum slot)
# pickTrig param1 (weapNum value)
#
# [Grismath]
#======================================================================================#
symbols

message startup
message	playeraction
message	trigger

int	weapTrigX=199	local	// All Weapons
int	weapTrig0=100	local	// Fists
int	weapTrig1=101	local	// Broadsword
int	weapTrig2=102	local	// Mace

int	pickTrigX=299	local	// All Weapons
int	pickTrig0=200	local	// Fists
int	pickTrig1=201	local	// Broadsword
int	pickTrig2=202	local	// Mace

int	weapNum0=0	local	// Slot #
int	weapNum1=-1	local
int	weapNum2=-1	local

int	weapTotal=3	local	// Total Weapons
int	X=0		local

end
#======================================================================================#
code
#--------------------------------------------------------
startup:
 SetActionCog(GetSelfCog(), 0x7FFFFFFF);
return;
#--------------------------------------------------------
playeraction:
 if(GetParam(0)==7) {
 // Weapon Key
  if(GetParam(2)==13) {
   for(X = 0; X < weapTotal; X = X + 1) {
    if(weapNum0==X || X!=-1) {
	SendTrigger(-1, weapTrigX, 0, 0, 0, 0);
	SendTrigger(-1, weapTrig0[X], 1, 0, 0, 0);
   }}}
  if(GetParam(2)==14) {
   for(X = 0; X < weapTotal; X = X + 1) {
    if(weapNum1==X || X!=-1) {
	SendTrigger(-1, weapTrigX, 0, 0, 0, 0);
	SendTrigger(-1, weapTrig0[X], 1, 0, 0, 0);
   }}}
  if(GetParam(2)==15) {
   for(X = 0; X < weapTotal; X = X + 1) {
	SendTrigger(-1, weapTrigX, 0, 0, 0, 0);
	SendTrigger(-1, weapTrig0[X], 1, 0, 0, 0);
   }}}
  }
return;
#--------------------------------------------------------
trigger:
 for(X = 0; X < weapTotal; X = X + 1) {
  if(GetSourceRef()==pickTrig0[X]) {
   print("Pick up weapon");
   if(GetParam(0)==0) weapNum0=GetParam(1);
   if(GetParam(0)==1) weapNum1=GetParam(1);
   if(GetParam(0)==2) weapNum2=GetParam(1);
 }}
return;
#--------------------------------------------------------
end


I then added the following code to the relevant weapon cogs:

Code:
trigger:
 if(GetSourceRef()==dismTrig) {
  call user1;
 }
 if(GetSourceRef()==weapTrig) {
  if(GetParam(0)==1) call user2;
  if(GetParam(0)==0) call user1;
 }
return;


AND made new pickup cogs for these weapons:

Code:
# XANTHUS REVISED
#  Pick_Broad.cog
#   - Broadsword
# [Grismath]
# ========================================================================================

symbols

thing       powerup                          local
thing       player                           local
int         bin=2                            local
int         ammobin=11                       local
sound       pickupsnd=thrmlpu2.wav           local
sound       respawnsnd=Activate01.wav        local
flex        amount                           local


message     touched
message     taken
message     respawn

end

# ========================================================================================

code

touched:
   player = GetSourceRef();

   if (GetThingType(player) == 10)  // Can only be taken by players.
   {
      if(IsMulti() || (GetInv(player, GetWeaponBin(bin)) == 0))
      {
         TakeItem(GetSenderRef(), -1);
         call taken;
      }
   }
   Return;

# ........................................................................................

taken:
   player = GetSourceRef();
   powerup = GetSenderRef();

   // Do effects.
   PlaySoundLocal(pickupsnd, 1, 0, 0);
   AddDynamicTint(player, 0.0, 0.0, 0.2);

   if(GetInv(player, GetWeaponBin(bin)) == 0)
   {
      ChangeInv(player, GetWeaponBin(bin), 1.0);
   }

   Return;

# ........................................................................................

respawn:
   PlaySoundThingLocal(respawnsnd, GetSenderRef(), 0.6, 5.0, 10.0, 0);

   Return;

end


None of this works. I want the player to be able to carry a maximum of two weapons (and his fists), which can then be changed by a weapon drop/throw cog.
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2002-11-16, 1:30 AM #2
.........
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2002-11-18, 4:26 AM #3
I was actually thing about a similar system. I was going to have different player classes be able to carry different amounts of weapons.

But I don't really want to implement it, because the way I was thinking of doing I was going to use a single bin that would represent the weight of their inventory. Of course missing one subtract somewhere would have a similar effect to a memory leak.
2002-11-18, 4:27 AM #4
By the way...what exactly do you mean by none of this works? Are you unable to pick up weapons...select them?
2002-11-18, 12:02 PM #5
I can pick them up, but the selection system doesn't work.

And I have a weapon weight cog.
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.

↑ Up to the top!