function gc_HeavyPlateHelmetMountedImage::onFire(%this, %obj, %slot){ %obj.playthread(2, ThrowingspearThrow); serverPlay3D(ThrowingspearFireSound, %obj.getTransform()); Parent::OnFire(%this, %obj, %slot); %currSlot = %obj.gc_HeavyPlateHelmetMountedSlot; %obj.tool[%currSlot] = 0; %obj.weaponCount--; messageClient(%obj.client,'MsgItemPickup','',%currSlot,0); serverCmdUnUseTool(%obj.client);}function gc_HeavyPlateHelmetMountedImage::onDone(%this,%obj,%slot){ %obj.unMountImage(%slot);}function gc_HeavyPlateHelmetMountedImage::onMount(%image, %player, %slot) { //Hide all hat and accent nodes for(%i=0; $hat[%i] !$= ""; %i++) %player.hideNode($hat[%i]); for(%i=0; $accent[%i] !$= ""; %i++) %player.hideNode($accent[%i]);}function gc_HeavyPlateHelmetMountedImage::onUnmount(%image, %player, %slot) { if(isObject(%client = %player.client)) { %client.schedule(100, applyBodyParts); %client.schedule(100, applyBodyColors); }}
//Make sure it's the hand image, not the worn armor image%image = YourArmorItemImage;//Check 5for(%i=0;%i<5;%i++){ //Inventory Slots %toolDB = %obj.tool[%i]; //And see if it matches our image if(%toolDB $= %image.item.getID()) { //Remove the item from our hand and inventory %obj.tool[%i] = 0; %obj.weaponCount--; serverCmdUnUseTool(%obj.client); messageClient(%obj.client,'MsgItemPickup','',%i,0); //Ends the loop check break; }}
Don't do what Goth said. It's overly complicated and doesn't support playertypes with more than 5 inventory slots.Post the image datablock too, so I can know what went wrong.
%count= %obj.client.player.getDatablock().maxTools;for(%i=0;%i<%count;%i++)
I don't see how it's overly complicated
Because you don't need to cycle through their inventory. You can just remove their active item.
%currSlot = %obj.currTool; %obj.tool[%currSlot] = 0; %obj.weaponCount--; messageClient(%obj.client,'MsgItemPickup','',%currSlot,0); serverCmdUnUseTool(%obj.client);
but I suppose you could do Code: [Select] %currSlot = %obj.currTool; %obj.tool[%currSlot] = 0; %obj.weaponCount--; messageClient(%obj.client,'MsgItemPickup','',%currSlot,0); serverCmdUnUseTool(%obj.client);instead
^stateTimeoutValue[0] = 0.1;^stateTransitionOnTimeout[0] = "Idle";^stateName[1] = "Idle";^stateAllowImageChange[1] = true;};function gc_HeavyPlateHelmetMountedImage::onFire(%this, %obj, %slot)//Make sure it's the hand image, not the worn armor image%image [color=red]##=##[/color] gc_HeavyPlateHelmetMountedImage;//Check 5for(%i=0;%i<5;%i++){ //Inventory Slots %toolDB = %obj.tool[%i]; //And see if it matches our image if(%toolDB $= %image.item.getID()) { //Remove the item from our hand and inventory>>> Error report complete.ADD-ON "Item_Medieval_Armor" CONTAINS SYNTAX ERRORS
Code: [Select]function gc_HeavyPlateHelmetMountedImage::onFire(%this, %obj, %slot)%image [color=red]##=##[/color] gc_HeavyPlateHelmetMountedImage;ADD-ON "Item_Medieval_Armor" CONTAINS SYNTAX ERRORS
function gc_HeavyPlateHelmetMountedImage::onFire(%this, %obj, %slot)%image [color=red]##=##[/color] gc_HeavyPlateHelmetMountedImage;ADD-ON "Item_Medieval_Armor" CONTAINS SYNTAX ERRORS
//..code.. if(isObject(%client = %obj.client)) { %currSlot = %obj.currTool; //Object's current slot %item = %obj.tool[%currSlot]; //The item (usually it's an ID) %image = %obj.tool[%currSlot].image; //Get the image of the current tool the guy is holding if(isObject(%item) && isObject(%image)) //Make sure they both exist if(%image == %this) //%this = the current image the object is holding, usually it's an ID, you could also do -> if(nameToID(%image) == nameToID(%this)) { %obj.tool[%currSlot] = 0; %obj.weaponCount--; messageClient(%client, 'MsgItemPickup', '', %currSlot, 0); serverCmdUnUseTool(%client); } } //..code..