#how to detect when you lost your totem and then message:"you lost your totem" appear
1 messages Β· Page 1 of 1 (latest)
/execute as @a[hasitem={item=totem}] at @s run /tag @s add TotemOwning /execute as @a[tag=TotemOwning] at @s unless entity @s[hasitem={item=totem}] run /msg @s you lost your totem /execute as @a at @s unless entity @s[hasitem={item=totem}] run /tag @s remove TotemOwning
I think that should work
/tag @a[hasitem={item=totem}] add totem
/msg @a[tag=totem,hasitem={item=totem,quantity=0}] you lost your totem
/tag @a[tag=totem,hasitem={item=totem,quantity=0}] remove totem
Both cmds will work you can choose any of these @hollow harness
Okey ill try it
This msj will apear for all players right?
Without a totem yes
You want title?
wdym whitouth a totem
No just msj tellraw or titleraw
If he a totem and then lost then the msg will popup
and if i want to add colors to the msj how?
Β§
No k
Oow i know how now
Yeah Β§k SUCKS
Also CAPS don't work
I ain't good π€£
My skills are dying off π
l- bold
o- latin
f- white [normal chat colour]
r- reset all the colours and effect
This are the basic one
f is actually only slightly different color
Any other small letters, numbers are colour
Also you can use Β§β‘ to get specials
k- for hiding your chat that you types
arronow your good just believe yourself
thats very helpful
What if i want this messaje detect any player lost his totem and detect his name and then mssj apear his name lost totem i think is impossible
/execute as @a[tag=TotemOwning] at @s unless entity @s[hasitem={item=totem}] run /msg @s @s you lost your totem
I think that works?
If not use tellraw
And a selector
okey I will try it and see if it work
That works!
Like this on functions tag @s add TotemOwning
execute as @a[tag=TotemOwning] at @s unless entity @s[hasitem={item=totem}] run msg @s @s you lost your totem
tag @a[tag=totem,hasitem={item=totem,quantity=0}] remove totem
Sorry im noob
Sorry i don't do functions π
ow so this just for commands
It might be for functions yet idk
@idle plinth yo can this work w functions
I think I have to give it a try
Ask adish he's really good w commands
okey im waiting here for his response
This is awkward π
whyyy
Its just us waiting for someone and were alone in a post awkwardly talking
why you Think like that π its normaaale
Think about it
Ya it can
Phew also sorry for pinging you π
NPC can be used as one time function script
Aka you can use them as a long cmd into short one!
Well they kinda only do 5 per npc π
Nooo
Although i guess you could use the last command to run another npc
I think You can write 300 words in npc
5 commands per npc*
In first cmd use /tp @s ~ -200~
Then other cmd
It will be act like function
I can give you the example after finishing the work π
I have a question this command execute as @a[scores={Energy=1..100}] run particle ds:reversal4~~~ I think you understand what if i want to create a function to remove that particle for working and another for make it run again is that possible I think I have to use tags?
Thx broo for the help
This will work when the player has a value between 1 or 100 or 1,100 the particle will gen
Using /scoreboard players remove @a <score> 1
Will decrease the value 1 to 100
So you can use this as a timer
so like this tag @s add TotemOwning
execute as @a[tag=TotemOwning] at @s unless entity @s[hasitem={item=totem}] run msg @s @s you lost your totem
tag @a[tag=totem,hasitem={item=totem,quantity=0}] remove totem it doesnt work @tulip sphinx
How is that function being run? Just placed in tick.json?
I will be back am in a trouble with another guy [cmd] π
Im puting this value as actionbar this wont effect at it?
Take your time
Its okey man
Yeah but it didnt work
Those commands won't work how you want. The result is receiving that message every tick when no totem is in the inventory
No bc its based off a tag that is guven to those that had a totem
TotemOwning is granted unconditionally to every player at the start. Even if the tag is removed at the end of the tick, it will be applied again before the other logic.
You'll want to compare across ticks, seeing if the player had a totem in their hand. (This won't actually tell if the totem was used, just if the player lost the item in that slot. Moving it or dropping it will trigger the effect too.)
execute as @a[tag=holdTotem] unless entity @s[hasitem={item=totem,location=slot.weapon.mainhand}] run msg @s No longer holding a totem!
tag @a remove holdTotem
tag @a[hasitem={item=totem,location=slot.weapon.mainhand}] add holdTotem
What I sent works much the same as your did, but the order of commands is important. We need the tag application to occur last, so that the player's inventory can change between ticks. We can detect that change with hasitem
so this work in function or commands
@tulip sphinx
Either. You can paste that text block into a single function, or place each individual command into three command blocks
I want function
Why tho? No space for 3 command blocks?
Functions are generally more convenient and powerful.
Admittedly functions are trickier to hook into the world on their own, but one can always combine command blocks and functions to great effect
Well ig not most people can make a function so that limits its diversity too Β―_(γ)_/Β―
Lots of people tend to neglect that fact.
Yeah tbh i love doing commands over functions A i can't use functions π and B i love how much more knowledge is given and that interactive puzzle solving flair in commands
doesnt work
You opted to do a function, right? We can troubleshoot that
- Did you reload your changes? Restarting the game or with
/reload - Did you save your changes to the function?
- Is your function being invoked? Try putting a simple command inside like
say hi - Is your behavior pack applied?
That is a goated command tho ngl i just wish it was for commands too π
And the rest of the game at that π
yeah everything is good I tried to do /function in chat and they said successfully 3 execute smg
Can you post your pack structure here? A screenshot would work. I want to see where your function and tick.json are in relation to each other
Should be like this:
π BP
π fuctions
π tick.json
π myfunction.mcfunction
//tick.json
{
"values": [
"myfunction"
]
}
HISSS COM.MOJANG FILES
Yeah I know that
no I was looking to make armor health to a specific armor I made it but I switched to script and now im lazzy to rename
Oh yeah custom armor
Yess
Then theres armor health πππ
OK, and which function contains these commands?
armor_health1
/execute at @a[hasitem={item=customArmor,data=(armor health)] run
I can send you files here if you want
That would be great
/effect not execute ig
Yeah if thats what you want
/effect @a[hasitem={item=CustomArmor,data=1}] (effect)
Sorry, nevermindβit's in there. But it's placed wrong
The tag @a[...] add holdTotem command needs to be at the end of the function. The command order is very specific
effect @e[type=player,hasitem={item=ds_candy:candy_helmet,location=slot.armor.head}] health_boost 1 0 true
Place the commands exactly as I had them and it should work.
Add data=1 or 2 or 3 depending on what value u want
But I found it that script is much better
Okey
You do you then Β―_(γ)_/Β―
Doesn't work again @golden hinge
Oh, that's the off-hand. We need more logic to handle that
Probably not the most elegant solution, but try this:
execute as @a[tag=holdTotemMainhand] unless entity @s[hasitem={item=totem,location=slot.weapon.mainhand}] run msg @s No longer holding a totem!
execute as @a[tag=holdTotemOffhand] unless entity @s[hasitem={item=totem,location=slot.weapon.offhand}] run msg @s No longer holding a totem!
tag @a remove holdTotemMainhand
tag @a remove holdTotemOffhand
tag @a[hasitem={item=totem,location=slot.weapon.mainhand}] add holdTotemMainhand
tag @a[hasitem={item=totem,location=slot.weapon.offhand}] add holdTotemOffhand
alr
I want it directly not steve whispers to you
@golden hinge
You can change the /msg command to whatever you need it to be. e.g. /tellraw
If you need more complex logic, you could invoke another function from there instead. @s will be the player who lost the totem from their hand
Okeey thank you so much man
All good?
I was studying so I'm going to use it now
Is there any problem here again function file not found in tick.json execute as @a[tag=holdTotemMainhand] unless entity @s[hasitem={item=totem,location=slot.weapon.mainhand}] run tellraw @s No longer holding a totem! tag @a remove holdTotemMainhand tag @a remove holdTotemOffhand tag @a[hasitem={item=totem,location=slot.weapon.mainhand}] add holdTotemMainhand tag @a[hasitem={item=totem,location=slot.weapon.offhand}] add holdTotemOffhand
@golden hinge
Yea, that is invalid syntax for /tellraw. The command expects JSON in a very specific format.
https://minecraft.wiki/w/Raw_JSON_text_format#Bedrock_Edition
e.g.
tellraw @a {"rawtext":[{"text":"No longer holding a totem!"}]}
Why not just make it say the name of the person who lost the totem in the tellraw
For some reason this doesn't work for him
/tag @e[type=player,hasitem={item=totem_of_undying,location=slot.weapon.offhand,quantity=0}] add z
/tag @e[type=player,hasitem={item=totem_of_undying,location=slot.weapon.offhand}] remove z
/execute if entity @e[type=player,hasitem={item=totem_of_undying, quantity=0,location=slot.weapon.offhand}] run /tellraw yourname {"rawtext":[{"selector":"@e[type=player,tag=!z,hasitem={item=totem_of_undying,location=slot.weapon.offhand,quantity=0}]"},{"text":" Has used up a totem"}]}
Any ideas why?
Its an addon people will play there with their friends so thats why
Well you can just modify it to make it publicly announce to everyone that someone has lost their totem
I haven't tested it so
@golden hinge
I'm not sure what the intended logic is for this. If any player does not have a totem in their off-hand, then it prints a message to whoever "yourname" is.
Thing is, the selector condition in the rawtext is impossible to be met. The tag "z" will only be removed if there is a totem in the off-hand, yet it is also testing for an absence of the totem in that hand.
That's what I thought the issue is to be, but shouldn't it run at the same time?
Let me do some testing brb
Ok so I fixed the logic up a little, basically what it should do is first it'll announce to everyone that a person without the tag of z (to prevent spamming) who has no totem in their offhand it'll send a tellraw, afterwards it'll tag them with z (people without totems)
And without the tag, yet it still continues spamming despite me having the tag z
Can we talk here tomorrow its 1.20am I have to sleep
Oh wait lol
I knew the execute was at fault
The tellraw is going to run with spaces where the selector is supposed to go anyways
I added the execute if
But didn't exclude the tag z in the execute
/execute if entity @e[type=player,tag=!z,hasitem={item=totem_of_undying, quantity=0,location=slot.weapon.offhand}] run /tellraw @a {"rawtext":[{"selector":"@e[type=player,tag=!z,hasitem={item=totem_of_undying,location=slot.weapon.offhand,quantity=0}]"},{"text":" Has used up a totem"}]}
/tag @e[type=player,hasitem={item=totem_of_undying,location=slot.weapon.offhand,quantity=0}] add z
/tag @e[type=player,hasitem={item=totem_of_undying,location=slot.weapon.offhand}] remove z
Ok put these in separate function files @hollow harness
Tick magic for the win baby
Add a "text" and use the Β§4 before the selector in the raw json. Add Β§r to clear the color and format before the last "text"
execute if entity @e[type=player, tag=!z, hasitem={item=totem_of_undying, quantity=0, location=slot.weapon.offhand}] run tellraw @a {"rawtext":[{"text":"Β§4"}, {"selector":"@e[type=player,tag=!z, hasitem={item=totem_of_undying, location=slot.weapon.offhand, quantity=0}]"}, {"text":"Β§r Has used up a totem"}]}
That's so annoying
But we bedrock players have it good, at least we don't have to do {"color":"red"} like java players (prob incorrect syntax but you get the point)
Working yay tyssm guys
The totem does not detect all totems
When you enter it also detects that you spent one
And once you death not detect also
@earnest marsh @reef pecan
It's supposed to detect totems in the offhand
I don't think players would just be holding totems in their main hand
Atp it would be pointless to have any armor or anything like that
Mittens could probably help you making it the way you want, currently busy right now and can't test anything
Its okey thank you ill wait for him
As a mobile player that abuses shields I am offended
The issue is due to limitations of hasitem. The command can't tell if the player actually used the totem, dropped it, or put it in a chest.
You would need to make it so players couldn't move the totems out of inventory by using a replaceitem command that adds item lock mode lock_in_inventory (that way player could use offhand or main hand).
Also will need to add unique data to totem so player can have multiple totems in inventory. Will
use clear on normal data totems then replaceitem.
Then use an item counter to track amount of totems in inventory.
Then use a combination of unique player ids that summon an armor stand in a ticking area so you can use scoreboard operations to assign players' totem item count score to their armor stand.
Then use scoreboard operations to detect when a players' totem item count is less than the armor stands and execute your command off that trigger.