I started a server up recently where people can go and play mini games. One of the games I'm making is called Pack Attack. Basically you go around Taming wolfs and then attacking other people and there wolfs. I have struck a problem though. When you disconnect half way through a game your wolfs still stay in the game how can I find a way around this?
maybe detecting if a player is in a 10 block radius and if this is true they will not be killed one little problem if the owner runs to fast and is out of the 10 blocks they wil be killed but also if a player but not the owner the wil stil be alive
Yeah... That would kind of stuff up the in game performance. I was kind of hoping for something a little less buggy. Thanks Though. I'll take that idea into consideration.
Then place a chain command block at where the arrow on the second repeating commandblock points at, set it to Always active and Conditional, Type this inside:
kill @e[type=wolf,tag=1]
Also, remember to type
/reload
Give yourself the 1 tag by writing:
/scoreboard players tag @p add 1
Try it out, give me feedback
If you want more players, repeat step 4-7 but change every 1 to a 2, except for score_WalfTag_min=1, leave that as it is
Thanks so much. I know this might be a bit of pain but I have no idea what is happening with these commands. I've never heard of functions and I'm a bit of a noob when it comes to NBT tags could you please walk me through what's going on here? It might help if I want t o make edits to this game. Thanks So much!!
Yea, I wasn't sure how much you knew about this stuff, but here it is in detatil:
1.
Type /scoreboard objectives add WolfTag dummy
This adds an objective Wolftag. (You probably know about these)
2.
Create a function wolftagger in a folder wolf:
Enter your world save (probably in your server folder as it seems like you've got a server)
Go to data/functions and add a new folder called wolf, inside this, add a text document called wolftagger.mcfunction
Now, if you haven't got it already, download Notepad++. It's very useful when editing files like this, normal Notepad also doesn't work when editing these files (or they do, but you have to change lots of stuff)
Right click wolftagger.mcfunction and click Open with Notepad++.
Inside the document, write:
scoreboard players set @e[type=Wolf] WolfTag 1
scoreboard players set @e[type=Wolf] WolfTag 0 {OwnerUUID:""}
Basically what you've done, is created something that runs two commands in the same tick (almost simultaneously) but the second command runs last.
The first command sets every Wolf to have 1 in WolfTag.
The second command sets every Wolf that doesn't have an Owner to 0 in WolfTag.
That means that every dog with an owner has 1, every Wolf without an owner has 0.
3.
Then place an Always active Repeating command block somewhere in your world with this command:
function wolf:wolftagger
This makes the function you just created run over and over again.
Remember to type /reload to reload all of your functions, so they work.
4.
Then put this in a Repeating command block on Always active:
Now every player with a tag 1 is checked if a dog which has got an owner, which supposedly is you (score_WolfTag_min=1) in a radius of 6 blocks (r=6), if they have, the closest dog (c=1) without a tag (tag=!1) gets a tag. The tag=!1 is checked so you don't give an already tamed and tagged dog the same tag again.
5.
Place a repeating command set on Always active, with the command
testfor @p[tag=1]
This checks that a player with the tag 1 is online.
6.
Place a repeating command block on top with this command
This checks if the previous command block fails, in other words that the player is no longer online.
7.
Then place a chain command block at where the arrow on the second repeating commandblock points at, set it to Always active and Conditional, Type this inside:
kill @e[type=wolf,tag=1]
If the previous command succeds (if the player with tag 1) goes offline, then all dogs with tag 1 dies.
Also, remember to type
/reload
This once again reloads the function you've created
Give yourself the 1 tag by writing:
/scoreboard players tag @p add 1
This gives you the ability to kill the dogs you've tamed when you log out.
It might be good to set the gamerule doEntityDrops to false, so that the wolves doesn't drop xp when you log off.
/gamerule doEntityDrops false
I pretty sure it's doEntityDrops, but I could be wrong
Thank you so much!!! This helps everything I'll check if this works later today. One last question though. Then the player has the tag: "tag1" logs off does this mean when he logs back on he will no longer have the tag?
If you want him to lose the tag you could do this:
Type:
/scoreboard objectives add PlayerOnline dummy
Then change the commandblock in step 5 to have:
testfor @p[score_PlayerOnline=1]
Now add a chain commandblock i front of the chain commandblock you placed in step 7, set it to Always Active and Conditional, inside type:
scoreboard players set @a[score_PlayerOnline=1] PlayerOnline 0
What this will do is to change the players score in an objective when he's offline to 0 (which isn't possible with tags, so you have to create an objective instead.)
And instead of giving player tags, set their PlayerOnline score to 1, 2, 3 etc.
If you want him to lose the tag you could do this:
Type:
/scoreboard objectives add PlayerOnline dummy
Then change the commandblock in step 5 to have:
testfor @p[score_PlayerOnline=1]
Now add a chain commandblock i front of the chain commandblock you placed in step 7, set it to Always Active and Conditional, inside type:
scoreboard players set @a[score_PlayerOnline=1] PlayerOnline 0
What this will do is to change the players score in an objective when he's offline to 0 (which isn't possible with tags, so you have to create an objective instead.)
And instead of giving player tags, set their PlayerOnline score to 1, 2, 3 etc.
/scoreboard players set @p PlayerOnline 1
Thank you but you can do this an easyer way useing: stat.leaveGame
Hi everyone!!
I started a server up recently where people can go and play mini games. One of the games I'm making is called Pack Attack. Basically you go around Taming wolfs and then attacking other people and there wolfs. I have struck a problem though. When you disconnect half way through a game your wolfs still stay in the game how can I find a way around this?
Yeah... That would kind of stuff up the in game performance. I was kind of hoping for something a little less buggy. Thanks Though. I'll take that idea into consideration.
You could give each wolf and player a tag, if a player has tag 1, his wolves has tag 1 and if the player has tag 2, his wolves has tag 2 and so on.
If a command /testfor @p[tag=1] fails, /kill @e[type=wolf,tag=1] executes, do that for every player
I see. How would I give the specific wolfs who were tamed by let's say Me (BluePC1) the tags though?
Didn't think of that, though here's an idea:
1.
2.
Create a function wolftagger in a folder wolf,
If you don't know anything about functions I can help you
Inside, write:
3.
Then place an Always active Repeating command block somewhere in your world with this command:
4.
Then put this in a Repeating command block on Always active:
5.
Place a repeating command set on Always active, with the command
6.
Place a repeating command block on top with this command
7.
Then place a chain command block at where the arrow on the second repeating commandblock points at, set it to Always active and Conditional, Type this inside:
Also, remember to type
Give yourself the 1 tag by writing:
Try it out, give me feedback
If you want more players, repeat step 4-7 but change every 1 to a 2, except for score_WalfTag_min=1, leave that as it is
Tired, have to sleep see you tomorrow
Thanks so much. I know this might be a bit of pain but I have no idea what is happening with these commands. I've never heard of functions and I'm a bit of a noob when it comes to NBT tags could you please walk me through what's going on here? It might help if I want t o make edits to this game. Thanks So much!!
Yea, I wasn't sure how much you knew about this stuff, but here it is in detatil:
1.
This adds an objective Wolftag. (You probably know about these)
2.
Create a function wolftagger in a folder wolf:
Enter your world save (probably in your server folder as it seems like you've got a server)
Go to data/functions and add a new folder called wolf, inside this, add a text document called wolftagger.mcfunction
Now, if you haven't got it already, download Notepad++. It's very useful when editing files like this, normal Notepad also doesn't work when editing these files (or they do, but you have to change lots of stuff)
Right click wolftagger.mcfunction and click Open with Notepad++.
Inside the document, write:
Basically what you've done, is created something that runs two commands in the same tick (almost simultaneously) but the second command runs last.
The first command sets every Wolf to have 1 in WolfTag.
The second command sets every Wolf that doesn't have an Owner to 0 in WolfTag.
That means that every dog with an owner has 1, every Wolf without an owner has 0.
3.
Then place an Always active Repeating command block somewhere in your world with this command:
This makes the function you just created run over and over again.
Remember to type /reload to reload all of your functions, so they work.
4.
Then put this in a Repeating command block on Always active:
Now every player with a tag 1 is checked if a dog which has got an owner, which supposedly is you (score_WolfTag_min=1) in a radius of 6 blocks (r=6), if they have, the closest dog (c=1) without a tag (tag=!1) gets a tag. The tag=!1 is checked so you don't give an already tamed and tagged dog the same tag again.
5.
Place a repeating command set on Always active, with the command
This checks that a player with the tag 1 is online.
6.
Place a repeating command block on top with this command
This checks if the previous command block fails, in other words that the player is no longer online.
7.
Then place a chain command block at where the arrow on the second repeating commandblock points at, set it to Always active and Conditional, Type this inside:
If the previous command succeds (if the player with tag 1) goes offline, then all dogs with tag 1 dies.
Also, remember to type
This once again reloads the function you've created
Give yourself the 1 tag by writing:
This gives you the ability to kill the dogs you've tamed when you log out.
It might be good to set the gamerule doEntityDrops to false, so that the wolves doesn't drop xp when you log off.
I pretty sure it's doEntityDrops, but I could be wrong
Thank you so much!!! This helps everything I'll check if this works later today. One last question though. Then the player has the tag: "tag1" logs off does this mean when he logs back on he will no longer have the tag?
No, he will keep the tag.
If you want him to lose the tag you could do this:
Type:
Then change the commandblock in step 5 to have:
Now add a chain commandblock i front of the chain commandblock you placed in step 7, set it to Always Active and Conditional, inside type:
What this will do is to change the players score in an objective when he's offline to 0 (which isn't possible with tags, so you have to create an objective instead.)
And instead of giving player tags, set their PlayerOnline score to 1, 2, 3 etc.
Thank you but you can do this an easyer way useing: stat.leaveGame
Oh, yeah, I didn't even know it existed lol