Blockland Forums > Modification Help
Can you drop/remove/throw an item datablock?
<< < (3/3)
xS K I D z:

--- Quote from: phflack on September 25, 2017, 10:40:09 PM ---
--- End quote ---

--- Quote from: SUSHI on September 26, 2017, 02:26:35 AM ---
--- End quote ---

Awesome! Really great resources to have. Thanks for the replies! Still haven't got it working after a couple of hours' work :P nothing can be easy for meh. I'm trying to pair it up with the "dropTool" keybind in a way and things got messy but nothing really happened, basically just wasn't switching to the other item. There is a resource (code) in a post by jes00 for it that I found but I'm not 100% how it works: https://forum.blockland.us/index.php?topic=235533.0

I will let you know if/when I get it working because I know I can do it :)
phflack:

--- Quote from: xS K I D z on September 26, 2017, 06:47:00 AM ---Awesome! Really great resources to have. Thanks for the replies! Still haven't got it working after a couple of hours' work :P nothing can be easy for meh. I'm trying to pair it up with the "dropTool" keybind in a way and things got messy but nothing really happened, basically just wasn't switching to the other item.

--- End quote ---
What exactly do you need it to do and what have you tried?
I can take a look at it tonight


--- Quote from: xS K I D z on September 26, 2017, 06:47:00 AM ---There is a resource (code) in a post by jes00 for it that I found but I'm not 100% how it works: https://forum.blockland.us/index.php?topic=235533.0

--- End quote ---
Pretty sure that code is just to add a keybind to send a server command
It's a lot more code than what you posted earlier because it checks if divisions already exist and adds it to them
xS K I D z:

--- Quote from: phflack on September 26, 2017, 11:27:34 AM ---What exactly do you need it to do and what have you tried?
I can take a look at it tonight
--- End quote ---
I'll post the .cs files here so it's easier, about to take a nap :P Originally I wanted to have my dropped tool/item play a custom spinning animation for a certain amount of time before disappearing, similar to how the Item Rotate script works, but for a dropped item and not an item spawned on a brick. But then I spent some more time on this and that looking up stuff and what I was doing wasn't very practical and probably pretty ugly.

So now I have only one Item Datablock and ShapeBaseImage and am going to use a projectile as the second "item" since you don't need to hold it, just needs to be dropped (in this case with projectile, spawned) and I can make it rotate(kinda defaulty but it works) more easily I imagine. More flexibility with projectiles as well, especially since I want it to "explode" lol. Still figuring things out, and a lot of things keep breaking and I'm getting errors but that's all in the name of the game ;)


--- Quote ---Pretty sure that code is just to add a keybind to send a server command
It's a lot more code than what you posted earlier because it checks if divisions already exist and adds it to them
--- End quote ---
Yea I pretty much got rid of a lot of that, I think I used a little of it though. I actually had it working (before it broke I think) when you would equip the item, it would store the value for the bind for your dropItem key, then use/re-bind it to be used on a different server command I made in server.cs which would remove the item and spawn the projectile if you had selected the correct item in your inventory, otherwise it would act normal and drop whatever tool you were holding and not spawn anything so yea I was proud of that.

I know it's a bit messed up atm but I'm sure you can see what I'm trying to do from the files. I'm really stuck on spawning a projectile, and spawning it with velocity in the direction of where the player is looking. Thanks for all the help thus far!
phflack:
Not home yet, but I seem to remember that projectiles can't be rotated easily, which is why the homing weapons look so weird

As for projectile velocity, you should be able to use the players eye vector
%itemVelocity = vectorScale(%playerEyeVector, 20.0 * %playerHeight);
%item.setVelocity(%itemVelocity);

Items should be able to rotate by setting their transform
%item.setTransform(%dropDelta SPC %playerRotation);
Change dropDelta to be the current item position, and playerRotation to be the item rotation rotated a bit

And by rebind, do you mean on the client or did you overwrite/package the function on the server
Do note that if you mess with keybinds it will only change for you
Navigation
Message Index
Previous page

Go to full version