I never could get that new weapons selection system to work.
I then added the following code to the relevant weapon cogs:
AND made new pickup cogs for these weapons:
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.
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.