Jump to content
  • 0

Auto Loot


Miharukun

Question

5 answers to this question

Recommended Posts

  • 0
2 hours ago, Miharukun said:

Mind telling me how to do it? :D

Of course, I don't mind teaching.
1 - Create a common event. Name it with something you remember, let's go for "NpcDrop".

2 - In the NPC editor, you can run the common event "NpcDrop" when the npc die.

https://prnt.sc/rri4kv

3 - In the event in question, you will define his drop.

From this point you can put your imagination. I'll give you examples...

 

1 - If you want a normal drop.

Change items - Deliver item
Item x
Successfully delivered
--Show text in chat: You received item X.
If it fails to deliver
--Show text in chat: Delivery failed, check your inventory.


2 - If you want a drop with a chance to give more items

Create an int local variable - DropItem
In the common event

--Set Variable "DropItem" random between x and y (Choose numbers)
--Conditional branching {DropItem = 1}
[Repeat - 1 - If you want a normal drop.)
Else

End of branching.
--Conditional branching {DropItem = 2}
[Repeat - 1)
Else

End of branching.
--Conditional branching {DropItem = 3}
[Repeat - 1)
Else

End of branching.
And so on...


3 - If you want a drop with a chance to give items based on a skill, skill.

You will have to use your skills which are in variables, say "HuntMastery"

In this case, let's say that the maximum of this ability is 10.
If HuntMastery = or < than 5, deliver 3 items. if > deliver 5 items.

--Conditional branching {Variable HuntMastery = <5}
(Repeat - 1)
Else
(Repeat - 1, giving more items)
End of the branch.


4 - If you want a drop based on the lucky percentage.

You can use the Intersect 6.1 function
Or Create an item, let's call "Lucky charm" an amulet that gives the player 10% luck to receive more items.

-- Set the value of the variable "Random" between 1 and 100.
-- Conditional branching {Player has at least 1 "Lucky Charm"}
-- Set the value of the Random variable (add 10)
else

End of Branching
--Conditional Branching {(Repeat 3 - Replacing "HuntMastery" with "Random")}
.
.
.


5 - All previous.

Just copy and paste all the codes within branches. Always remembering to set the value of variables as DropItem or Random to a random value between a number X and Y before entering the branches.

--Set Variable "DropItem" random between x and y (Choose numbers)
-- Set the value of the variable "Random" between 1 and 100.
-- Conditional branching {Player has at least 1 "Lucky Charm"}
-- Set the value of the Random variable (add 10)
else

End of Branching
--Conditional branching {DropItem = 1}
--     Conditional branching {Variable Random = <50}
       (Repeat - 1)
        Else
       (Repeat - 1, giving more items)
       Else

   End of the branch.
Else

End of branching.

If any of these works for you, then there will be no need to make changes to the source and you can mark my answer as "best answer". Every time the npc dies it will activate his death event, delivering random items, setting random values, depending on what you want, and everything in the inventory.

Link to comment
Share on other sites

  • 0
1 hour ago, Miharukun said:

So after a player kill a NPC. The loot goes straight into the killer bag. And it will show on the right/left side of the screen or Chatbox on what the player getting.

This can currently be done through events in several ways. I use it in my game like you said. Even the part of saying in the chat what the player received, not only for npc but also for resources.

Link to comment
Share on other sites

  • 0
14 hours ago, Weylon Santana said:

This can currently be done through events in several ways. I use it in my game like you said. Even the part of saying in the chat what the player received, not only for npc but also for resources.

Mind telling me how to do it? :D

Link to comment
Share on other sites

  • 0
12 minutes ago, Weylon Santana said:

Of course, I don't mind teaching.
1 - Create a common event. Name it with something you remember, let's go for "NpcDrop".

2 - In the NPC editor, you can run the common event "NpcDrop" when the npc die.

https://prnt.sc/rri4kv

3 - In the event in question, you will define his drop.

From this point you can put your imagination. I'll give you examples...

 

1 - If you want a normal drop.


Change items - Deliver item
Item x
Successfully delivered
--Show text in chat: You received item X.
If it fails to deliver
--Show text in chat: Delivery failed, check your inventory.


2 - If you want a drop with a chance to give more items

Create an int local variable - DropItem
In the common event


--Set Variable "DropItem" random between x and y (Choose numbers)
--Conditional branching {DropItem = 1}
[Repeat - 1 - If you want a normal drop.)
Else

End of branching.
--Conditional branching {DropItem = 2}
[Repeat - 1)
Else

End of branching.
--Conditional branching {DropItem = 3}
[Repeat - 1)
Else

End of branching.
And so on...


3 - If you want a drop with a chance to give items based on a skill, skill.

You will have to use your skills which are in variables, say "HuntMastery"

In this case, let's say that the maximum of this ability is 10.
If HuntMastery = or < than 5, deliver 3 items. if > deliver 5 items.


--Conditional branching {Variable HuntMastery = <5}
(Repeat - 1)
Else
(Repeat - 1, giving more items)
End of the branch.


4 - If you want a drop based on the lucky percentage.

You can use the Intersect 6.1 function
Or Create an item, let's call "Lucky charm" an amulet that gives the player 10% luck to receive more items.


-- Set the value of the variable "Random" between 1 and 100.
-- Conditional branching {Player has at least 1 "Lucky Charm"}
-- Set the value of the Random variable (add 10)
else

End of Branching
--Conditional Branching {(Repeat 3 - Replacing "HuntMastery" with "Random")}
.
.
.


5 - All previous.

Just copy and paste all the codes within branches. Always remembering to set the value of variables as DropItem or Random to a random value between a number X and Y before entering the branches.


--Set Variable "DropItem" random between x and y (Choose numbers)
-- Set the value of the variable "Random" between 1 and 100.
-- Conditional branching {Player has at least 1 "Lucky Charm"}
-- Set the value of the Random variable (add 10)
else

End of Branching
--Conditional branching {DropItem = 1}
--     Conditional branching {Variable Random = <50}
       (Repeat - 1)
        Else
       (Repeat - 1, giving more items)
       Else

   End of the branch.
Else

End of branching.

If any of these works for you, then there will be no need to make changes to the source and you can mark my answer as "best answer". Every time the npc dies it will activate his death event, delivering random items, setting random values, depending on what you want, and everything in the inventory.

I'll try it now :D Thanks!

 

Link to comment
Share on other sites

×
×
  • Create New...