Jump to content

Custom item - Blowdart with fueled ammo


Recommended Posts

I want to push the features of my character by adding a new craftable item to him. I wonder if it is possible to create a projectile weapon like the blowdart with a fueled component to it :

1. Rather than using it one time, I want the character to have stingers in his inventory in order to shoot with the blowdart. And the blowdart could get used after a while, so creating a new dart can become useful and makes lot of sense.

or

2. By adding 10 stingers to the crafting recipe (I already know this), how can I limit the uses of the dart for like 10 shots?

D4rkh0bb1T

Link to comment
Share on other sites

I've made a gun similar to that, but my code is kinda messy, so... My gun has to be loaded manually though.

1. I'm not sure if you should use fueled component, because you could check if owner has stingers in inventory on projectile launch. Or check by listening for event when inventory of owner gets an item with a 'stinger' prefab, and then enable the ability to shoot. Or make a periodic task to check every second or so if the owner has stingers in their inventory.

2.  With every shot its durability gets reduced by 10%. When reaching 0, it should remove itself.

For example, you set maxfuel and currentfuel to 10. And on projectile launch you'd do function with: inst.components.fueled:DoDelta(-1)

Edited by PanAzej
Link to comment
Share on other sites

Thanx PanAzej for your reply, i really appreciate it.

Sounds pretty simple that way. I will try the second method, as it seems the easiest one so far.

I manage to code simple script by checking other files in game, but sometimes it surpasses me and I cant figure out how to assemble things.

If something is going bad, i will get back here with my troubleshootings.

Link to comment
Share on other sites

The DoDelta(-1) was not working, maybe my code was not right. Im still not sure how to make it work properly.

So i decided to check over the sewing kit and they use the finiteuses component to reduced the % of the item.

I did put that finiteuses thing inside my test item and the % was going down as expected!

I can throw the item at enemy and the item remains on the ground, which make sense...

But the item is invisible in my hand and in my inventory bar. its a common issue, I know, and a lot of topic had been made on this before. Just a badluck while creating the swap animation, I dunno yet...

Link to comment
Share on other sites

Sorry for the multiple posts...

I created the ground and the swap anim with success. My item appears on the ground when I drop it and it appears in my hand while I hold it.

However, when I throw my weapon at enemies, the item becomes invisible on the ground. Even if I pick it back and drop it, it will still be invisible, as if the item lose its image when I throw it ...

What could cause the item to be invisible after throwing it?

Link to comment
Share on other sites

Is the log saying anything useful (like what animation it is trying to find and not succeeding), or just that it can't find animation FROMNUM?

The projectile component is trying to rotate the item (self.inst.Transform:SetRotation(angle)), maybe this has something to do with it?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...