Introduction:
In this guide, you’ll learn how to get a random weapon every time you knock out a player or sentry. This is very easy but tedious. You also may need to know a bit about block code and properties for this guide, but overall it shouldn’t be too difficult.
Granting The Weapons:
What you’ll first want to do is place a lifecycle and set the event to “Player Knocks Out”.
Now, place down a trigger with delay “0.1”.
Wire the lifecycle to the trigger like this:
Event occurs → Trigger
Create a block that starts with “When Triggered…” and then place down this block code:
![image](https://forum.creative.gimkit.com/uploads/default/original/2X/f/f335c1b302cb4578af5f4692468a3e597bd34b82.png)
This is a simple loot table that determines if the rarity of the weapon should be common, uncommon, rare, epic, or legendary. Be sure to make better weapons rarer so players don’t constantly have the most powerful weapons.
Now, place down 5 triggers. They should all trigger when receiving the channel of their respective rarity.
These are just some examples of what the triggers should look like. Now, create block code for each trigger.
All of this block code uses concatenation, which is a method of simplifying block code. Anyways, these triggers should broadcast on channels like EpicWeapon1 or RareWeapon5 or something like that. Make sure you know what your weapons are. Here’s what I did:
Weapon 1: Zapper
Weapon 2: Evil Eye
Weapon 3: P.M.L.
Weapon 4: Wooden Wand
Weapon 5: Slingshot
Weapon 6: Snowball Launcher.
Note how I didn’t use the Quantum Portal weapon. If you are going to make the player have a chance of getting all weapons of all rarities, make it so that rand is a random integer between 1 and 7. You also need more item granters for the next part.
Here’s the annoying part. Granting every single item.
These item granters will grant items of each rarity. Here are some examples of what their settings should be:
But what about the previous weapon you had? In this next part, we’ll take away the weapons.
Removing the Weapons:
Notice how our trigger has a delay of “0.1”. This is to make sure you always get your new weapon after your old one is removed.
Remember the lifecycle we used earlier? The one that tracked “Player Knocks Out”? Make it so that when that event occurs, the lifecycle sends a signal down the channel “WeaponRemoval”.
Now, copy every single lifecycle you had before and replace the “Granted Item Amount” setting to -1, and the “Grant item when receiving on…” channel with “WeaponRemoval”. This is what it should look like:
Now, this is the final, finished build:
![image](https://forum.creative.gimkit.com/uploads/default/original/2X/d/dd65c0de1b9a77ddd76891a3211c07441012da5b.png)
Exit Poll: Please complete this poll before exiting:
- 0/10 or
- 1/10 or
- 2/10 or
- 3/10 or
- 4/10 or
- 5/10 or
- 6/10 or
- 7/10 or
- 8/10 or
- 9/10 or
- 10/10 or
- 11/10 or
/
Conclusion:
Thanks for 2,000 likes! I can’t believe that just stumbling into the old forums would turn into this .
Happy Gimkitting, @mysz out.