1

Need some command block help...

General Lucifer 12/19/16 9:01 pm
491
12/20/2016 12:55 pm
Here is what i'm trying to do:
I want to give a player points (dummy scoreboard) based on what mob was killed (ex: Zombie=1). I also want to create a shop which uses this scoreboard to do stuff like give an item or spawn a monster by using that scoreboard as currency, as well as increasing a mob's hp when spawning it with a command block.

This is a lot to ask for so one person will probably not know how to do everything here. Any help is appreciated!
Posted by
General Lucifer
Level 1 : New Explorer
0

  Have something to say?

JoinSign in

4

a_creeper_won
12/20/2016 12:55 pm
Level 18 : Journeyman Explorer
1
Carnivore
12/20/2016 4:39 am
Level 42 : Master System
- EDIT -
Have a better idea for multiplayer, although:
No scoreboard display just for now

But:
No requirement for real-time tracking and operating the scoreboards

Here's what it is:

* Global Objectives:
scoreboard objectives add eGetPlayerKill_Z stat.killEntity.Zombie
scoreboard objectives add eGetPlayerKill_C stat.killEntity.Creeper
scoreboard objectives add eGetPlayerKill_S stat.killEntity.Skeleton

* Shop:
@@ZOMBIESHOP
execute @p[r=4,score_eGetPlayerKill_Z_min=minScoreValue] ~ ~ ~ give @p itemName itemCount itemData dataTag
scoreboard players remove @p eGetPlayerKill_Z itemCost
@@CREEPERSHOP
execute @p[r=4,score_eGetPlayerKill_C_min=minScoreValue] ~ ~ ~ give @p itemName itemCount itemData dataTag
scoreboard players remove @p eGetPlayerKill_C itemCost
@@SKELETONSHOP
execute @p[r=4,score_eGetPlayerKill_S_min=minScoreValue] ~ ~ ~ give @p itemName itemCount itemData dataTag
scoreboard players remove @p eGetPlayerKill_S itemCost

We've got counts for Zombies, Skeletons and Creepers killed. Each incremented automatically by default.
The shop functions similarly, by giving players items that require some amount of specific entities killed, after that their score is decremented by the cost of the item.

Which items, how many, and everything else is for you to decide.
1
General Lucifer
12/20/2016 1:54 am
Level 1 : New Explorer
Thanks! This will definitely help!
1
Tyranico1024
12/19/2016 11:07 pm
Level 27 : Expert System
Hi there!

I just looked into your idea, and I quickly came up with a simple solution to the first part. It may not be the best if you're making a multiplayer game, but for singleplayer it will work just fine. I can also look into the shop idea if you'd like.

First make 2 scoreboard objectives, one for your dummy objective (I called mine CreepScore) and one for tracking the mobkills (ZombiesKilled of type stat.killEntity.Zombie).
/scoreboard objectives add CreepScore dummy
/scoreboard objectives add ZombiesKilled stat.killEntity.Zombie

The setup is 3 command blocks per mob you want to track, so 3 for zombies, 3 for creepers, etc. I use an arrow (-->) to indicate command blocks pointing into other command blocks.

Repeating, Unconditional, Always Active --> Chain, Conditional, Always Active --> Chain, Conditional, Always Active.

Commands:
Repeating:
testfor @p[score_ZombiesKilled_min=1,c=1]
This tests for the nearest one player who killed a zombie.
First Chain:
/scoreboard players add @p[score_ZombiesKilled_min=1,c=1] CreepScore 1
This adds points to the dummy objective "CreepScore".
Second Chain:
/scoreboard players remove @p[score_ZombiesKilled_min=1,c=1] ZombiesKilled 1
This removes 1 from the ZombiesKilled objective. The next time they kill a zombie, they'll get more points. I had to make an edit as my last command didn't account for killing multiple zombies at one time.

To keep going for other mobs, you can just make more objectives of type stat.killEntity.[Whatever Entity You Want] and then change the points added to CreepScore on the second command block.
1

Welcome