Request Help With Debugging Reloading Magazine System
I don't know how much 'debugging' it will need, in fact the whole thing may need be rewritten, although I would hope my coding abilities wouldn't be that lax.
The concept was when a player goes to a large, or deployable, inventory station that they would receive a certain number of clips(according to the armor they purchase). When they fire, it checks if they have fired an ammo based weapon and if you have any magazines left it would then add your max amount of ammo for that weapon(basically reload it to full) and minus a magazine.
Code...
Projectiles.cs
Please don't judge me for my lack of experience, I'm just here to learn(actually, mostly to actually get this working, learning how to do it and like things is a bonus ). No syntax errors found for either files, nothing has changed in the game basically, firing is the same, invs, everything I can think of. Again, it may be all wrong or just part, help would be appreciated, thanks to all in advance.
The concept was when a player goes to a large, or deployable, inventory station that they would receive a certain number of clips(according to the armor they purchase). When they fire, it checks if they have fired an ammo based weapon and if you have any magazines left it would then add your max amount of ammo for that weapon(basically reload it to full) and minus a magazine.
Code...
Projectiles.cs
$Clip[0] = PlasmaClip; $Clip[1] = ChaingunClip; $Clip[2] = DiscClip; $Clip[3] = GrenadeLauncherClip; $Clip[4] = MortarClip; $Clip[5] = MissileLauncherClip; $Clip[6] = MMinigunClip; $numClips = 7;ShapeBaseImageData
if(%data.usesEnergy) { if(%data.useMountEnergy) { %useEnergyObj = %obj.getObjectMount(); if(!%useEnergyObj) %useEnergyObj = %obj; %energy = %useEnergyObj.getEnergyLevel(); %vehicle = %useEnergyObj; } else %energy = %obj.getEnergyLevel(); if(%data.useCapacitor && %data.usesEnergy) { if( %useEnergyObj.turretObject.getCapacitorLevel() < %data.minEnergy ) { return; } } else if(%energy < %data.minEnergy) return; } ////////////////////////////////////////////Began Editing else if(%data.ammo == 0) { for(%c = 0; %c < $numClips; %c++) { %clip = $Clip[%c]; if(%obj.getInventory(%clip) != 0) { reloadweapon(%obj, %data); %clip--; } else { } } } ////////////////////////////////////////ended//Used top to show locationNew Function Created Directly Below ShapeBaseImageData
/////////////////////////// function reloadweapon(%obj, %data) { %obj.setInventory(%data.ammo, %obj.getDataBlock().max[%data.ammo]); } ///////////////////////////Inventoryhud.cs>buyFavorites(%client);>At End Of Function
//////////////////// %cpclip = %client.player; if(%curArmor $= "light") { %cpclip.PlasmaClip = 2; %cpclip.ChaingunClip = 3; %cpclip.DiscClip = 2; %cpclip.GrenadeLauncherClip = 2; // %client.player.MortarClip = 2; // %client.player.MissileLauncherClip = 2; // %client.player.MMinigunClip = 2; } else if(%curArmor $= "medium") { %cpclip.PlasmaClip = 3; %cpclip.ChaingunClip = 4; %cpclip.DiscClip = 2; %cpclip.GrenadeLauncherClip = 3; // %client.player.MortarClip = 2; %cpclip.MissileLauncherClip = 2; // %client.player.MMinigunClip = 2; } else if(%curArmor $= "heavy") { %cpclip.PlasmaClip = 4; %cpclip.ChaingunClip = 4; %cpclip.DiscClip = 3; %cpclip.GrenadeLauncherClip = 2; %cpclip.MortarClip = 1; %cpclip.MissileLauncherClip = 3; %cpclip.MMinigunClip = 2; } ////////////////////////Inventoryhud.cs>buyDeployableFavorites(%client)>End Of Function
//////////////////// %curArmor = %client.player.getDatablock(); %cpclip = %client.player; if(%curArmor $= "light") { %cpclip.PlasmaClip = 1; %cpclip.ChaingunClip = 2; %cpclip.DiscClip = 1; %cpclip.GrenadeLauncherClip = 1; // %cpclip.MortarClip = 2; // %cpclip.MissileLauncherClip = 2; // %cpclip.MMinigunClip = 2; } if(%curArmor $= "medium") { %cpclip.PlasmaClip = 2; %cpclip.ChaingunClip = 2; %cpclip.DiscClip = 1; %cpclip.GrenadeLauncherClip = 2; // %client.player.MortarClip = 2; %cpclip.MissileLauncherClip = 1; // %client.player.MMinigunClip = 2; } if(%curArmor $= "heavy") { %cpclip.PlasmaClip = 2; %cpclip.ChaingunClip = 2; %cpclip.DiscClip = 2; %cpclip.GrenadeLauncherClip = 1; %cpclip.MortarClip = 1; %cpclip.MissileLauncherClip = 2; %cpclip.MMinigunClip = 1; } ////////////////////////Basically the same :P
Please don't judge me for my lack of experience, I'm just here to learn(actually, mostly to actually get this working, learning how to do it and like things is a bonus ). No syntax errors found for either files, nothing has changed in the game basically, firing is the same, invs, everything I can think of. Again, it may be all wrong or just part, help would be appreciated, thanks to all in advance.
Comments
This is what I saw first glance, I haven't checked anything else but that might be the majority of your problem.