Topic category: User side tutorials
Hello everyone, I'm Sinlo, im working on a mushroom people kingdom mod, along the way i discovered that i can make a mob give a effect to a player so i thought i should share this and here's the basic way to allow a entity to give you a effect when you go near them!
So heres the step by step guide to do so!
Step 1:
On the first page of creating a entity, click "Select if you want your entity to be a boss" (This will change later on, dont worry your mob doesnt have to be a boss forever)
Step 2:
Now press next till you are on the page of procedures. On there click the "When player collides with entity" procedures and create one.
Step 3:
Now this is a important step.
You would need:
- 1, If do else if do (found in logic and loops) This will be the first thing to put under event trigger.
- 1, if do (found in logic and loops) Put this under If do else if do.
- 1, greater than (Found in Logic operations, its shown as Blank + Blank. But you can change the symbol. Choose the greater than symbol) Connect this onto If.
- 2, more thans (Found in Logic operations, its shown as Blank + Blank. But you can change the symbol. Choose the more than symbol.) Put one onto else if and the other onto If.
- 3, Random [0,1) (Found in Math) Drag this into the first blank box in the greater than and the more more than boxes.
- 2, Max (Found in Maths, looks like logics operation box with Blank + Blank, change the plus into Max.) Drag this into the other blank box on the greater than logic operation. Do the same on the more thans.
- 1, Min (Found in maths, looks like logic operation box. Change the plus to min) Put this on the bottom If, not the else if.
Now drag numbers into the blank boxes of the Max. You can find number boxes in Math. Now for this example I made is so that its 0 to 0.5. This is so how much effect do you want on the player and come from the mob. If you dont want you mob to have crazy large effects I recommend going for 0 to 0.5 for greater effects.
For the more than, you would want to take your large number for greater than and then chose a higher number for a more chance of a effect. I chosen 0.5 and 0.8. Again you can change this if you like.
For min however, for the number box i chosen 0.3 as i dont want the third effect to be a large effect.
Look at step 6 image below for help if you have done this right.
Step 4:
Now this is the important part. Make it so that your entity does give effects to the player.
What you need:
- 2, Spawn particles at x y zin area dx 3 dy 3 dz 3 with speed 1 type (click arrow and choose Spell) ((This is found in World management)). Put these under If do else if do, first Do.
- 3, Add potion with level 1 duration ambient true particles true to provided entity (choose what potion effect you would like) ((This is found in player procedures)). Put two in the first do, make sure that its order of Spawn then Add potion
-You can more than 3 effects, but in this case my entity has 3, be warned to many effects may lag your game-
Look at step 6 image below for help if you have done this right.
Step 5:
Now, you need to change the x and z on the Spawn particles.
What you need:
- 2, Blank + Blank from Math.
In the first Spawn, drag the X out of the x: box. Then drag the + into it, after that, drag the X back but into the first blank box of the +.
In the second blank box of the + box, put a number box in it. This number will be the number of particles coming from the mob. I Chosen 8. Dont go to crazy with how many particles you want as you may lag your game.
Now, In the second Spawn, did what you did with the first but instead of X, it is Z. But also change the + into -. This is so that it have less particles of the other effect on the mob but make sure it has the same number as +.
Step 6:
If you have done this right, you should have something like this. Make sure the do for the second logic and loops of If Do is empty.
Step 7:
Now click save. And run Test build minecraft gradle.
When in game spawn you mob.
Then close your game.
Reopen your entity on mcreator and click the box for boss again to turn it off.
Save.
reopen test build minecraft gradle. Recreated your minecraft world. Spawn your mob. It would no longer be a boss, but now it will give you effects!
This is due to boss mobs only giving players effects when near by. Now that your change your mob to no longer a mob, your entity would still have coding from where it was one!
I hope this help!
Please forgive me for any bad english.
Know issues:
> If your entity does range attacks, this will not work.
> Walking away from a entity will sometimes remove the effects, this is mostly because of the time limit and level of your potion effect.
> This is for entities only. It is unknown if this will work for blocks.
Well I did this and that's what happends...
https://gyazo.com/5f488bfc606db30b44dc6b6d1c4dc20a
(My effect make you explode id it ends exept if you have the totem)
Why ?
I cant see any of the pictures it just says that it dosnt exist and shows a ? symboyl
HELP MEnevermind im just gonna delete all my work
*crys*
can you upload the photos again, it would help me a lot!