| Blockland Forums > Modification Help |
| Can you drop/remove/throw an item datablock? |
| (1/3) > >> |
| xS K I D z:
Instead of just dropping the item/tool in your hand with your drop/remove keybind (which I believe is the Armor::onRemove function(?)do I also use delete() ?), can I use it to drop a different datablock/item than the current one I have in my hand? I was thinking that if you did a check to see if you indeed had the correct item (currTool?) to initiate the drop/throw that it would be possible. Or I could be dead wrong. I'm using this site for references. |
| phflack:
what are you trying to do? drop an item in slot X regardless of which slot is selected? (drop as in chucks it like the keybind?) |
| PhantOS:
yes you can drop a different datablock. you'd probably have to find the actual droptool function in the bl source if you want to do it correctly |
| xS K I D z:
--- Quote from: phflack on September 25, 2017, 09:49:36 PM ---what are you trying to do? drop an item in slot X regardless of which slot is selected? (drop as in chucks it like the keybind?) --- End quote --- Allow me to elaborate my thought process lol :P (apologies) First things first: I thought this might work and I've been experimenting with methods and stuff, but the reason I thought of it is because I have two models, and two different datablocks in the script (but one Item/ItemData) and I want it to drop (remove from inventory and throw out into the world) Model2 when I have Model1 selected in my inventory. So I figure I need two Datablocks. The reason WHY I want Model2 to get thrown into the world is because I want it to play an animation as a dropped item. And because it is a slightly different mesh altogether. This is all a strange theory in my head but in my head it might work lol. The reason for the functions: So now I did a bit of looking and came across the function Armor::onRemove(), which really seems like it is indeed for the keybind to remove/throw-out-into-the-world an item. But I ALSO need it to not throw out the wrong thing if I have something else selected in my inventory other than Model1. This is where the check comes in, I figured it would be similar to a loop that would check your inventory for an item that is required to do something. The loop would do its check as you press the "drop item" keybind. What I want to happen (simplified (hopefully)): 1. Acquire Model1 item into inventory (from brick) 2. Model1 has it's own prefs and animations and whatnot, it does it's own thing until you press the "drop" key 3. Press the "drop" key 4. Model2 item is dropped from inventory (Model1 is gone until you acquire it again either from a brick or from picking up the dropped Model2 item) 5. Model2 has it's own prefs and stuff, it plays an idle animation until it is deleted/disappeared from the world after a set amount of time This probably is confusing but it's a neat idea and there is probably a way to do it and so I am asking :) |
| xS K I D z:
--- Quote from: PhantOS on September 25, 2017, 09:56:55 PM ---yes you can drop a different datablock. you'd probably have to find the actual droptool function in the bl source if you want to do it correctly --- End quote --- moveMap.bind(keyboard, "x", dropTool); ?????? I'll do some more looking. Thanks for the reply! |
| Navigation |
| Message Index |
| Next page |