I know it is off topic, but I finally decided to play MCPE again, and start some modding.
If you guys don't know what happen to me and why I'm saying this, I quit MCPE modding because of school issues and lots of problem. But I manage to balance my schedule, so I think it is safe to come back.
Here's a few thing I will do and not do
Do's:
Start making an API
Try to teach/fix others script
Make some new mods about mobs and stuff
Not do:
I will not continue on Hextral(or T-craft if you remember this name), basically I lost all the saves and I don't wanna code it all again
I will not post everyday, I still got my school.
So yea, that's about it. I have no idea where to post this thread, and I think most of my time spend on MCPE mods like 2 years ago, so I post here instead.
sorry if this shouldn't be here. I don't care if this thread get locked
I read that you like to try to help fix mods. Could you help me with one of my problems or is this not a good time or not the correct thread or whatever.
Me or Netherher0brine?, if me then sure, just message me with the link, make sure its in a private message because sometimes there are some people eho like to steal others ideas.
Either or, I'm just trying to get a bit of an opinion on how you would create a random event to occur, since people each do it differently than others. Some use modTick functions others use math.random I just kind of want your example and opinion.
if entityRemovedHook(entity) {
if (Entity.getEntityTypeId(entity) == 332) {
//332 snowball
//[Random number 1-3 named as "rnd" variable insert here]
}}
If (var=1){
clientMessage("A snowball!!");
else if (var=2){
clientMessage("oh? A snowball?");
else if (var=3){
clientMessage("Cool! A snowball!");
}}}
//End script
Something around those lines is what I'm trying to create. If you throw a Snowball and if it despawns you can get 1 out of 3 messages In the chat bar. It won't matter to me if someone steals it, it's solely for my learning purposes. Thanks for your time!
function projectileHitBlockHook(projectile,x,y,z,s){
if(Entity.getEntityTypeId(projectile)==81){
var r = Math.floor(Math.random()*3+1);//math random gives you a float between 0 and 1, so we round it up by using this
switch(r){//a better way than if(), but if() is fine
case 1:// 1 is the output of the random
clientMessage("your message 1");
break;//stopping the code to prevent repeating
case 2:
clientMessage("your message 2");
break;
case 3:
clientMessage("your message 3");
}
}
}
That's how I do it by taking the new hook function's advantage
Yes or no. Is it possible for me to put a switch statement inside another switch statement?(case 4)
switch(v){
case 1:
clientMessage(ChatColor.GREEN+ "Hello! How are you?");
break;
case 2:
clientMessage(ChatColor.GREEN+ "Hi.");
break;
case 3:
clientMessage(ChatColor.GREEN+ "Need something?");
break;
case 4:
var i = Math.floor(Math.random()*6+1);
switch(i)
{
case 1:
Level.dropItem (Entity.getX(victim), Entity.getY(victim), Entity.getZ(victim), 0, 297, 0, 0)
{
clientMessage(ChatColor.GREEN + "Here, take this. I made extra");
break;
case 2:
Level.dropItem(Entity.getX(victim), Entity.getY(victim), Entity.getZ(victim), 0, 384, 0, 0)
{
clientMessage(ChatColor.GREEN + "I found this inside a witches hut. I have no use for it though.");
break;
}
}
}
break;
case 5:
clientMessage(ChatColor.GREEN+ "What do you want?");
break;
case 6:
clientMessage(ChatColor.GREEN+ "Greetings!");
break;
Thanks for this I was always confused on what to use to terminate a function or part of a script (;) or ({}) ANd sorry, I should have put some kind of indication that the rest of the script was missing, it was quite long with 20 cases so I didn't bother typing the entire thing. This also fixes the problem with 2 clientMessages appear instead of one due to the break. Thx so much!
Ive gotten this script to work perfectly fine and what it dose is spawn a "boss" when you touch the ground with the blaze rod (it's a Husk zombie with a Human render type) but I'm bugged because the zombie is just black, meaning the script couldn't fetch the skin. But I don't understand, the alex.png is in the files but I can't get it to work. Maybe it only works with mob skins?
var alex = Level.spawnMob(x, y+1, z, 47,"assets/skins/Base/alex.png" );
I know it is off topic, but I finally decided to play MCPE again, and start some modding.
If you guys don't know what happen to me and why I'm saying this, I quit MCPE modding because of school issues and lots of problem. But I manage to balance my schedule, so I think it is safe to come back.
Here's a few thing I will do and not do
Do's:
Start making an API
Try to teach/fix others script
Make some new mods about mobs and stuff
Not do:
I will not continue on Hextral(or T-craft if you remember this name), basically I lost all the saves and I don't wanna code it all again
I will not post everyday, I still got my school.
So yea, that's about it. I have no idea where to post this thread, and I think most of my time spend on MCPE mods like 2 years ago, so I post here instead.
sorry if this shouldn't be here. I don't care if this thread get locked
Unfortunately, I can't
But this thread may help(if you still haven't found it)
http://www.minecraftforum.net/forums/minecraft-pocket-edition/mcpe-mods-tools/1987561-advanced-custom-block-shapes-in-blocklauncher-1-6
I read that you like to try to help fix mods. Could you help me with one of my problems or is this not a good time or not the correct thread or whatever.
Either or, I'm just trying to get a bit of an opinion on how you would create a random event to occur, since people each do it differently than others. Some use modTick functions others use math.random I just kind of want your example and opinion.
if entityRemovedHook(entity) {
if (Entity.getEntityTypeId(entity) == 332) {
//332 snowball
//[Random number 1-3 named as "rnd" variable insert here]
}}
If (var=1){
clientMessage("A snowball!!");
else if (var=2){
clientMessage("oh? A snowball?");
else if (var=3){
clientMessage("Cool! A snowball!");
}}}
//End script
Something around those lines is what I'm trying to create. If you throw a Snowball and if it despawns you can get 1 out of 3 messages In the chat bar. It won't matter to me if someone steals it, it's solely for my learning purposes. Thanks for your time!
Entity Id and Item Id is 2 things
Snowball entity id is 80(or 81 can't remember)
But snowball item Id is 332
Let's say you wanna have a random output, you need math.random to do so.
Here's a non-code explanation:
If I throw a snowball and it breaks
Then generate a random number
If the random number is(1,2 or 3)
Then do a client message
I haven't touch modpe for a while, so if Im wrong, plz tell me
Yes! Thats what I'm trying to do but I don't understand how use math.random to do this? And how do I rename it's output as "rnd"??
function projectileHitBlockHook(projectile,x,y,z,s){
if(Entity.getEntityTypeId(projectile)==81){
var r = Math.floor(Math.random()*3+1);//math random gives you a float between 0 and 1, so we round it up by using this
switch(r){//a better way than if(), but if() is fine
case 1:// 1 is the output of the random
clientMessage("your message 1");
break;//stopping the code to prevent repeating
case 2:
clientMessage("your message 2");
break;
case 3:
clientMessage("your message 3");
}
}
}
That's how I do it by taking the new hook function's advantage
Switches!! Why didn't I think of that!? Thanks, this was very helpful for me.
Ok so..
Math.floor(Math.random()*3+1);
You're making this only pick a number between 1 to 3 and what the one is for is rounding it up to prevent a decimal right?
Btw thx for your help. Hope I'm not wasting your time.
Edit:
Oh wait, duh nvm I understand. Thx for your help
Here's a sneak peek of my upcoming mod (it is a boss mod)
I was testing on my player before the mob so you may not realize what's that
The 5 heads will change to different mode depends on the health of boss
Always:
Melee mode+Range mode(2 go melee, 3 go range)
Gang beating mode xD(4 go melee, 1 go pick you up)
Missile mode(all charge to you and self explode)
Below 50% Hp:
Absorb(boss stay in the air, 5 heads keep attacking and give 2hp back to boss per hit)
Laser(sacrifice 20hp to shoot a 1 hit laser beam,l long charging time, auto target)
Below 20% Hp:
Defend(All damage reduce 50%)
Death:
Nuke(5 heads explode in a large radius)
It's just a plan, I may not have that much time to code them all
Those floating mob heads look nice! I see in the left hand corner a Wither with a sword. That code must be seriously complex
Yes or no. Is it possible for me to put a switch statement inside another switch statement?(case 4)
switch(v){
case 1:
clientMessage(ChatColor.GREEN+ "Hello! How are you?");
break;
case 2:
clientMessage(ChatColor.GREEN+ "Hi.");
break;
case 3:
clientMessage(ChatColor.GREEN+ "Need something?");
break;
case 4:
var i = Math.floor(Math.random()*6+1);
switch(i)
{
case 1:
Level.dropItem (Entity.getX(victim), Entity.getY(victim), Entity.getZ(victim), 0, 297, 0, 0)
{
clientMessage(ChatColor.GREEN + "Here, take this. I made extra");
break;
case 2:
Level.dropItem(Entity.getX(victim), Entity.getY(victim), Entity.getZ(victim), 0, 384, 0, 0)
{
clientMessage(ChatColor.GREEN + "I found this inside a witches hut. I have no use for it though.");
break;
}
}
}
break;
case 5:
clientMessage(ChatColor.GREEN+ "What do you want?");
break;
case 6:
clientMessage(ChatColor.GREEN+ "Greetings!");
break;
Ty for answering him, and he probably knows that he needs the random variable, just didn't type it out
Thanks for this I was always confused on what to use to terminate a function or part of a script (;) or ({}) ANd sorry, I should have put some kind of indication that the rest of the script was missing, it was quite long with 20 cases so I didn't bother typing the entire thing. This also fixes the problem with 2 clientMessages appear instead of one due to the break. Thx so much!
Ive gotten this script to work perfectly fine and what it dose is spawn a "boss" when you touch the ground with the blaze rod (it's a Husk zombie with a Human render type) but I'm bugged because the zombie is just black, meaning the script couldn't fetch the skin. But I don't understand, the alex.png is in the files but I can't get it to work. Maybe it only works with mob skins?
var alex = Level.spawnMob(x, y+1, z, 47,"assets/skins/Base/alex.png" );
If that's the case, use Entity.setMobSkin(entity, dir) after the spawn mob