Started by
SkeletonKing
on
Topic category: Advanced modding
I already know how to add potion effects to armor, but how do I add a potion effect where if the full set of armor is worn, then the effect is applied? And when you take the armor off, it goes away?
I'd like to know this too. Anyone?
set variables so to change when all of the armor is active. Then set it so the armor gives you effects if (desirded variable equals the desirded number)
@steve you misunderstand. He wants it to add the effect only if the player is wearing the ENTIRE set of armor at the same time. @ahig that wouldn't work as intended. You'd need a way to turn the variables off when the player takes the armor off.
good point i will look into that
Have you found any opcion to do that? I want to do a miner armor, and with the complete set, have the night vision effect.
I saw on the MCreator wiki that with an "Armor Trigger Event" you can control if any player has the armor equipped or not... But I dont know if this will work and dont know how I can try it.
If you found any solution, can you please tell me how to do it?
Thanks and regards (sorry for the english, im spanish :p)
If you want to see practicle use for that skill check out my newest mod
Alright just set the armor so on update tick add (potion effect) change in all cases to be (if item is in slot) the set the item to be another piece of armor and set the slot id to be the slot id for the piece of armor. To make in need a full set just use stacked events so you need all of the pieces of armor in all of the armor plots before it gives you the effect.
Test this:
static{
ItemArmor.ArmorMaterial enuma = EnumHelper.addArmorMaterial("ARMOR", 25, new int[] {2, 7, 5, 3}, 9);
int armorPreffix = 0;
if(FMLCommonHandler.instance().getEffectiveSide()==Side.CLIENT) armorPreffix = RenderingRegistry.addNewArmourRendererPrefix("models");
helmet = (new ItemArmor(enuma, armorPreffix, 0)
{
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack stack){
if(player.getCurrentArmor(0) != null && player.getCurrentArmor(1) != null && player.getCurrentArmor(2) != null && player.getCurrentArmor(3) != null){
ItemStack boots = player.getCurrentArmor(0);
ItemStack legs = player.getCurrentArmor(1);
ItemStack chest = player.getCurrentArmor(2);
ItemStack helmet = player.getCurrentArmor(3);
if(boots.getItem() == mcreator_armor.boots && legs.getItem() == mcreator_armor.legs && chest.getItem() == mcreator_armor.body && helmet.getItem() == mcreator_armor.helmet){
player.addPotionEffect(new PotionEffect(Potion.resistance.getId(), 20, 1));
player.addPotionEffect(new PotionEffect(Potion.regeneration.getId(), 20, 1));
player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 20, 1));
}
}
}
Too much code for me....
up how use this code ?
I also need help with this. Someone please help me!!
I'm gonna answer your question since I made in an old mcreator version, an armor that gives speed 3 when full set is up.
1st thing to do is to create a variable: Go to variable list and create a new one called whatever you want (I called a) and give it a value, for example 3
2nd step: create your armor mod. You have now the Armor tick events right there. Start with helmet, select the condition
NUMBER = NUMBER, it will open a little window: select your first variable a, press ok. It will open another little window for the second variable. Now write in the space at right, (where you selected a before) 0 and press ok. Now select at left Variable set. You will see the variable to set, select a and below, in value of variable, write 1.
3rd: go to body event and do the same thing, but this time in NUMBER = NUMBER put first a and second 1, and in variable set, always a and value = 2. And go on like this in leggins and boots event (leggins--> NUMBER: a=2, variable set: a=3. Boots--> NUMBER a=3, var set: a=4).
4th: now you have to close the cycle, so go gain in body or leggins (NOT helmet or boots) event and do the same thing as before but this time, instead of having in NUMBER: a=4 and in var set: a=5, you have to set the var to a=0
5th: Now you completed the circle and the variable will pass from 0 to 4 continously only when you have the full armor weared. So you have to add the potion effect. Go in the helmet (or wherever you want) event and select same condition: first a, and for second put a number from 0 to 4 but NOT 3. Now add the potion effect: in this case speed (ID=1), duration = 20 (the duration is in ticks and a tick is = 1/20 second, so if you put a too lower value, the variable won't have time to make the cycle in time to re-give you the potion effect and it will be intermittently) and level 3 (or amplifier 2).
And it's all done, it should work fine, or at least, for me it works perfectly.
If not I'll pass you the code x)
@#13 @#13 Thnx for the help!
I'm making a Flash Mod, and I want when you put all entire armor give Speed effect and I read your comment(Kane), so I did what you said, but din't work. Do you can explain to me how I do it?