Bishop Posted August 18, 2019 Share Posted August 18, 2019 (edited) Hello, I need drop mounted item...I have this script with mouse 0 button1 - dropItem andbutton0 - RayCastObject....pick up item works great but when I want to drop an item it doesn't work.function serverCmdRayCastObject(%client,%obj) { %range = 4; $control = %client.getControlObject(); %eyePos = $control.getEyePoint(); %eyeVec = $control.getEyeVector(); %mask = $TypeMasks::StaticShapeObjectType|$TypeMasks::ItemObjectType; %dirScaled = VectorScale(%eyeVec, %range); %endPoint = VectorAdd(%eyePos, %dirScaled); %result = containerRayCast(%eyePos, %endPoint, %mask, %client.getControlObject(), false); if (getWordCount(%result) > 0 && getWord(%result, 0) !$= "0") { %obj = getWord(%result, 0); if (%obj.internalName $= "Item") { ItemText.setText(%obj.name); ItemText.schedule(500, "setText", ""); } if (%obj.parentGroup $= "InteractiveItems") { ItemText.setText(%obj.name SPC "PICKED UP"); ItemText.schedule(2000, "setText", ""); $control.mountObject (%obj, 0); } if (%obj.isMounted ()) { echo("is Mounted"); $control.unmountObject (%obj); } } } //----------------------------------------------------------------------------- //. Drop Items command //----------------------------------------------------------------------------- function serverCmddropItem (%client, %obj) { ItemText.setText("ITEM DROPED"); ItemText.schedule(1000, "setText", ""); } //------------------------------------------------------------------------------ ....so unmount works this way but I need Drop an item only when I press the mouse button. Edited August 23, 2019 by Bishop Quote Link to comment Share on other sites More sharing options...
Duion Posted August 20, 2019 Share Posted August 20, 2019 There is a hotkey to throw the weapon you are holding, just press it. You can modify the throw function and reduce the force and maybe remove the throw sound and it should be pretty good. Quote Link to comment Share on other sites More sharing options...
Bishop Posted August 23, 2019 Author Share Posted August 23, 2019 @Duion Thanks,....I only use Empty project template for my projects so I'm putting together from the ground simple game mechanics scripts everything as needed by the project.....slowly and step by step....while looking in the documentation and net.......after a short pause, i finally put it together and a script for a pick up and drop objects / items works great....serverCmdRayCastObject(%client, %obj) function takes care of mounting item to mount node and serverCmddropItem(%client, %obj) takes care of drop(unmount) item....This..%control = %client.getControlObject();%mountedItem = %control.getMountedObject(0);if (%mountedItem.isMounted()) { %mountedItem.unmount(); }.....it was crucial that drop / unmount work. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.