6

I'm making a Tower Defense map and my score system is pretty simple, whenever you kill a zombie the 'Money' scoreboard gets 1 more score.

I used the command

/scoreboard objectives add Money stat.killEntity.Zombie Money

to set up the counter for that.

In my map there are different zombies, some have got more health then others. My problem is, all the different zombies give as much Money. So if the player kills a zombie of Lvl 1 or Lvl 12, the players always just gets 1 money. All the zombies are summoned with a '/summon' command and my solution to this was to give the different zombies different names and somehow make the scoreboard track down what zombie the player killed. (It will check the name of the zombie that has been killed)

Does someone know how? Or an easier or better way? I would highly appreciate it! I've got this problem for a while now and I cant make progress because of this. If someone can help me I'll credit him/her in my map.

  • This is quite tricky to do, since the zombies stop existing immediately upon their death. I just played around with it a bit and tried to have armorstands follow the zombies around. The problem here is that it's hard to not make them cross over to another zombie when they are close. – MrLemon Jan 19 '16 at 17:34
  • Thank you so much for your response! So you dont have an answer either? – DerpyBush Jan 19 '16 at 18:31
  • I figured a solution, nevermind! :D – DerpyBush Jan 19 '16 at 20:44
  • @DerpyBush Maybe, you could answer your own question, so players having the same question, don't have to post a new one.(just for completeness) – Mystery Jan 19 '16 at 23:36
  • First off, I didn't really solve the problem because now I don't have zombies with different levels anymore but I just made every 'level' a new mob. So what normally would be a level 2 zomie became a skeleton and 'level 3' a zombie pigman and so on. So to fix it I simply changed the scoreboard to: /scoreboard objectives add Money dummy Money Then I made new scoreboards for all the other levels (/mobs) like this: (Level 1, zombies) /scoreboard objectives add level1mob stat.killEntity.Zombie dummy (Level 2, skeletons) /scoreboard objectives add level2mob stat.killEntity.Skeleton dummy – DerpyBush Jan 20 '16 at 16:17
1

If your map is not going to be multiplayer, you may want to consider tracking if each zombie spawned is alive by attempting to execute commands on them and checking if said commands succeed.

Another solution, which I think is probably the best, is to implement custom loot from the different zombies that you spawn, perhaps paper or gold that is renamed to different values, or just different drops from each enemy, that are then automatically cleared from the players' inventories in exchange for scoreboard points.

  • As I said in the answer I wrote before noticing it's the exact same: Id rather use monster heads that match the monsters' actual heads than paper or gold or stuff like that. – Egor Hans Feb 24 '18 at 15:25
1

what is probably a bit better than your "different mobs" version: you could give them named armor (if you don't want them to be armored make them wear Zombie head items on their "real" head and name these) with 100% drop rate (0% for irrelevant armor parts so you don't need to mess around with them), then give score depending on the name of the heads the players collect and immediately clear the player's inventory for the specific item

a few advantages towards the multi-mob style:

  • all the enemies behave like Zombies (what you probably originally wanted them to)
  • you can have many levels not limited by the amount of hostile mobs in MineCraft
  • you can make this per mob, i.e. you can put level 1 Zombies, level 1 Skeletons and level 1 Endermen into the same wave

not sure if you like this better than your version of doing it, but if you do my planned in-game name is CreatorCraft ;-)

EDIT: just figured out that hacatu's "custom loot" answer is just what I explained

0

If you want to track all zombies killing you, set them all into a specified team (eg. Zombie) using a |repeat|unconditional|always active| command block after using these commands:

/scoreboard teams add Zombie
/scoreboard teams option Zombie color white
/scoreboard objectives add Money teamkill.white

The command in the loop command block should be:

/scoreboard teams join Zombie @e[type=Zombie]

If you want this score to be visible at all times use:

/scoreboard objectives setdisplay teamkill.white sidebar

The money system could be used by using /testfor commands to detect the score, deduct the desired amount and then give an item.

Have fun!

0

I think FungusKing is on the right track, but their solution is the same as tracking stat.killEntity.zombie.

(sorry, this got too long to fit in a comment.)

You'd have to add each zombie to a specific team based on its difficulty and have a dummy scoreboard objective tracking teamkill for each one:

(run once)

/scoreboard teams add EasyZombie
/scoreboard teams add MediumZombie
/scoreboard teams add HardZombie

/scoreboard teams option EasyZombie color white
/scoreboard teams option MediumZombie color gold
/scoreboard teams option HardZombie color red

/scoreboard objectives add EazyKill teamkill.white
/scoreboard objectives add MediumKill teamkill.gold
/scoreboard objectives add HardKill teamkill.red

(run on repeat)

/scoreboard teams join EasyZombie @e[type=Zombie,tag=easy]
/scoreboard teams join MediumZombie @e[type=Zombie,tag=medium]
/scoreboard teams join HardZombie @e[type=Zombie,tag=hard]

(this assumes that you are tagging them elsewhere)

When a player has a score over zero in any of those objectives, increase their money accordingly and clear their score:

(run on repeat)

/scoreboard players add @p[score_EasyKill=1] Money 1
/scoreboard players set @p[score_EasyKill=1] EasyKill 0

/scoreboard players add @p[score_MediumKill=1] Money 5
/scoreboard players set @p[score_MediumKill=1] MediumKill 0

/scoreboard players add @p[score_HardKill=1] Money 10
/scoreboard players set @p[score_HardKill=1] HardKill 0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.