I have a basic Pickpocket system now, however i need your help with one thing. I want to set the number of times you can you can pickpocket this enemy to be 1-3 times before the pockets are empty at a random number, 3 being the max. I also wish to have a short cooldown period of time when you first steal, so you can spam the button. Thank you!
- in the NPC:
This should allow you to pickpocket every 2 seconds. I’d have it as a BPI:
It can be easily extended to do more stuff. It assumes the NPC has stuff to be stolen. Ideally you’d script catching that, too.
Thank you for taking your time by making these blueprints, however I cant seem to make return node have a success frequence like yours. I have all my pickpocket blueprints on the player character, but yours are on the npc. How will i make them communicate?
It’s just a boolean:
I have all my pickpocket blueprints on the player character, but yours are on the npc.
You said:
the number of times you can you can pickpocket this enemy
It should be in the enemy then. Each enemy can track how many times it can be pickpocketed. is that not what you want?
How will i make them communicate?
You never explained how it works in your game. I assumed you call it somehow - what I demonstrated is a blueprint interface - probably the most common and convenient way to do it.
Ah, my misstake. Should propably have explained better. In my game i have plueprinted it so when i press R when behind a NPC (the npc has a capsule collision) The player steals a random ammount of coins.
But i will find a way to work around your blueprint. Thank you
You need to keep track of the number of times each enemy has been pickpocketed. What I suggested would work really well for this. If all you want is a number of coins, return an integer instead of random array element.
This goes into the player:
The function is implemented in the NPC.
I cant seem to get it to work, I dunno how to combine it with my existing blueprint in Player, to get it to function or the alternative how to make it viable with a button press in the AI/NPC blueprint.
Why are we pressing buttons in the NPC? I though it was the player doing the stealing.
I feel you’re not approaching it correctly.
- the NPC has the coins
- the player approaches the NPC and the player presses the button
- we run a function in the NPC, we get the NPC’s coins
You have your NPC right here:
Implement the stealing functionality there.
Yes it is the Player doing the stealing, however when i try to implement your blueprint into the NPC, i cant seem to get it to connect with eachother with my blueprint.
In the picture, As AI that you are pointing to where does it go?
Use the pin to call functionality in the desired NPC. Or look into the interface communication so you can avoid casting altogether.
To simplify it greatly:
- a function in the NPC:
Script the coins amount here that you can steal and the number of times it can happen, and how often.
- in the player BP: player stealing coins from all nearby NPCs:
You can keep the coins the GM if that’s more convenient, ofc.
How do you know it does not work? Print player coins, what do you get?
You can keep the coins the GM if that’s more convenient, ofc.
Did you forget to inform the Game Mode about your coins?
Again, we do not know how you want it to work.
The number in top right should increase when i press R when behind an opponent.
When i press R it says the unedited message of Hello
I did change the name of the variable in the Game Mode to Player coins from coin. However my Game Mode BP is empty
You need to send that value to the Game Mode. Changing a variable name is meaningless. As I said, if you want to keep the coins in the GM, do so.
You have it right here:
Use it to add to your coins if that’s how you want it to work.
How do i do send that value to Game Mode? Im rather new to blueprinting.
You’ve been doing it already in the very first pic you posted, see my previous post. Namely:
Not the best way of doing it but it will work.
It does seem work and generate coins, however the issue remaining is that i want it empty the pockets of the NPC of a number between 1-3 and giving it a short cooldown, so that you cant spam R in this case.
Look at the stuff I posted before. It’s all there.
Does it matter? You did not say originally what we were stealing. I thought we’d be nicking objects from NPCs’ inventories. If you want coins, just return an int.