Author Topic: Click-To-Equip Tools  (Read 859 times)

Quick and simple: I want to make a fairly short code that makes items impossible to pickup when the player collides with them. Instead, one must click on the weapon from within a certain Torque Unit distance. How could this be done?

What I'd do is to overwrite the tool collision function and make a raycast fire every time the player activates. If the raycast hits an item, check the length of the raycast or the distance of the player to the brick. If it's in the allowed range, addItem(); Otherwise, return.

What I'd do is to overwrite the tool collision function and make a raycast fire every time the player activates. If the raycast hits an item, check the length of the raycast or the distance of the player to the brick. If it's in the allowed range, addItem(); Otherwise, return.
pretty sure you can just package the ItemData::Pickup method or w/e it is and override it but i'm not sure

Create a raycast by packaging Player::ActivateStuff, use the correct typemasks so blocklands can't just click the weapon through other objects.
« Last Edit: October 10, 2015, 12:52:44 AM by Kyuande »

Already made this. Only issue being that it's not compatible with ammo.

http://swololol.com/rd?f=Script_ClickToPickup


Wow, I have that add-on,it sucks, I keep on forgetting to click

Wow, I have that add-on,it sucks, I keep on forgetting to click
You probably shouldn't just enable every add-on without realizing what you have.

pretty sure you can just package the ItemData::Pickup method or w/e it is and override it but i'm not sure
I'm pretty sure that ItemData::PickUp gets called after a collision test.

I'm pretty sure that ItemData::PickUp gets called after a collision test.
If you just additem() the item then you could just drop an item, spam click it, then have an inventory full of it.
::pickup adds the item to your inventory, and removes a dropped item/puts a static item on a respawn timer.

If you just additem() the item then you could just drop an item, spam click it, then have an inventory full of it.
::pickup adds the item to your inventory, and removes a dropped item/puts a static item on a respawn timer.
To be honest, I hate servers in which I can't have more of the same tool. Especially with grenades/molotovs/medpacks/etc.

To be honest, I hate servers in which I can't have more of the same tool. Especially with grenades/molotovs/medpacks/etc.
Most one-use items that are coded properly are modified to let you pick up more than one.

Either way, there's still the issue of duplication if you're just calling .additem(%data)
« Last Edit: October 11, 2015, 08:40:54 AM by Shift Kitty »