| Blockland Forums > Modification Help |
| Getting the object created from a default/different function |
| << < (2/4) > >> |
| Conan:
package droptool: turn on a global var call parent turn off global var package itemdata on add: if global var talk %obj return parent |
| Dannu:
Complete code for serverCmdDropTool that should do the trick. |
| Swollow:
--- Code: ---package captureDroppedItem { function serverCmdDropTool(%cl,%slot) { $dropItemCapture =""; parent::serverCmdDropTool(%cl,%slot); %item = $dropItemCapture; %item.setVelocity("0 0 100"); } function itemData::onAdd(%db,%item) { if(!$dropItemCapture) $dropItemCapture= %item; parent::onAdd(%db,%item); } }; activatePackage(captureDroppedItem); --- End code --- Edit: Woops thanks for the correction guys I didn't test it |
| Kyuande:
You parented the itemdata vars incorrectly, just an info for everyone planning to copy that code without thought |
| Shift Kitty:
--- Quote from: Swollow on October 26, 2017, 01:10:30 AM --- --- Code: ---package captureDroppedItem { function serverCmdDropTool(%cl,%slot) { $dropItemCapture =""; parent::serverCmdDropTool(%cl,%slot); %item = $dropItemCapture; %item.setVelocity("0 0 100"); } function itemData::onAdd(%db,%item) { if(!$dropItemCapture) $dropItemCapture= %item; parent::onAdd(%this,%obj); } }; activatePackage(captureDroppedItem); --- End code --- --- End quote --- 0/10 --- Quote from: Kyuande on October 26, 2017, 10:00:19 AM ---You parented the itemdata vars incorrectly, just an info for everyone planning to copy that code without thought --- End quote --- |
| Navigation |
| Message Index |
| Next page |
| Previous page |