You could use attackHook, but that don't works if a Creeper explodes or a Skeleton shoot an arrow:
function attackHook(a, v){
if(Entity.getEntityTypeId(a)==14 && Entity.getEntityTypeId(v)==32){ //if a wolf attacks a zombie
if(Entity.getHealth(v)>0){
//if the zombie lives now
}else{
//Your Code
}
}
Oh! I should have seen that. My script works fine, just the skeleton was never killing the creeper, the arrow was.
Hm... I'll have to find some way of appointing the arrow as the attack entity. Then create a statement to deem the drop true only if the arrow was attacking the player, but killed entity 33.
Thanks for your implemented 'train-of-thought bug fix'.
The Meaning of Life, the Universe, and Everything.
Join Date:
7/23/2014
Posts:
62
Member Details
Yup. I used my original code, just changed the 34 to a 80.
If you have any ideas on how to make this exclusive to the skeleton shooting the arrow, and not function with an arrow from a player. That would be a big help.
Thanks for your input, by the way. You've been very helpful.
You can look with modTick and getCarriedItem if the player has in the last... maybe 3 ...seconds a bow in the hand and save this in a variable and put this variable in the if from the attackHook. That should work (exept the arrow flies over 3 seconds...).
The Meaning of Life, the Universe, and Everything.
Join Date:
7/23/2014
Posts:
62
Member Details
Yeah, I'm not sure. Based on how my script is setup it should work. Maybe somethings conflicting with my sheared modTick function. Regardless, I can't help that, plus, as I said before this method is too unreliable, especially for multiplayer. I'll have to keep looking.
I have both 0.11.0 and 0.10.5 installed. Just directed 0.11.0 its own package location. Don't know if you care to have both, just thought I'd let you know it's possible.
The Meaning of Life, the Universe, and Everything.
Join Date:
7/23/2014
Posts:
62
Member Details
Well, hadn't realized how fast Mojang was sending out updates. If when the final release of 0.11.0 comes out and BlockLauncher has yet to update, I'd be happy to send you a copy of 0.10.5 and 0.11.0 that you can install side by side. Again, if that's something your wanting to do.
A quick script consisting of what I believe would execute this request, however, does not:
function deathHook(murderer, victim){if(Entity.getEntityTypeId(murderer)==34 && Entity.getEntityTypeId(victim)==33){
Level.dropItem(Entity.getX(victim), Entity.getY(victim),
Entity.getZ(victim), 0, 377, 1, 0);
}
}
If the murderer is entity 34 (Skeleton), and the victim is entity 33 (Creeper), then the victim will drop item 377 at it's current location.
Anyone know how to set this up properly? Is this even posable yet?
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumYou could use attackHook, but that don't works if a Creeper explodes or a Skeleton shoot an arrow:
function attackHook(a, v){
if(Entity.getEntityTypeId(a)==14 && Entity.getEntityTypeId(v)==32){ //if a wolf attacks a zombie
if(Entity.getHealth(v)>0){
//if the zombie lives now
}else{
//Your Code
}
}
Oh! I should have seen that. My script works fine, just the skeleton was never killing the creeper, the arrow was.
Hm... I'll have to find some way of appointing the arrow as the attack entity. Then create a statement to deem the drop true only if the arrow was attacking the player, but killed entity 33.
Thanks for your implemented 'train-of-thought bug fix'.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumMaybe it works if you change the Id of the wolf(14) to the Id of an arrow (80).
Yup. I used my original code, just changed the 34 to a 80.
If you have any ideas on how to make this exclusive to the skeleton shooting the arrow, and not function with an arrow from a player. That would be a big help.
Thanks for your input, by the way. You've been very helpful.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumYou can look with modTick and getCarriedItem if the player has in the last... maybe 3 ...seconds a bow in the hand and save this in a variable and put this variable in the if from the attackHook. That should work (exept the arrow flies over 3 seconds...).
The only issue with that is it's not completely accurate. I'll have to keep trying till I find something.
Thinks again, though.
-
View User Profile
-
View Posts
-
Send Message
Curse Premiumvar useable=true;
var tick=0;
function modTick(){
if(Player.getCarriedItem()==261){
tick=60;
useable=false;
}else{
if(tick>0)
tick--;
}
if(tick==0)
useable=true;
}
Yeah, I can't even get that to work with my script at all. Did you test it?
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumNo, I actually can't test it because I use 0.11.0 and BlockLauncher crashes when I want to start it.
Why it maybe don't work:
-You didn't defined the 2 variables it uses at the start of the Script
-You already have a function called modTick
-modTick is used 20 times a second. Maybe your device is to slow? (That's not much at modTick, for that bugging you need a really slow device.)
-You don't use BlockLauncher, but something similar which don't knows modTick
If it's nothing of that I don't know...
Yeah, I'm not sure. Based on how my script is setup it should work. Maybe somethings conflicting with my sheared modTick function. Regardless, I can't help that, plus, as I said before this method is too unreliable, especially for multiplayer. I'll have to keep looking.
I have both 0.11.0 and 0.10.5 installed. Just directed 0.11.0 its own package location. Don't know if you care to have both, just thought I'd let you know it's possible.
Thinks again for your input.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumDon't works at me
What version is the 0.11.0 build up to? Only three, correct?
-
View User Profile
-
View Posts
-
Send Message
Curse Premium5...
Well, hadn't realized how fast Mojang was sending out updates. If when the final release of 0.11.0 comes out and BlockLauncher has yet to update, I'd be happy to send you a copy of 0.10.5 and 0.11.0 that you can install side by side. Again, if that's something your wanting to do.
I'm always happy to help.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumYou don't need to, I have a Backup-App, so I can save me what I need, but thanks.
I assumed so. Just happy to offer some help.