Tell me if there's anything wrong please!!!!!
[spoiler]
Here's the script I'd also (14193) is the script id
Tap a stick and get a wood starter kit
Tap an iron ingot to get a bow
Tap the bow to get 64 arrows
Tap a diamond to get a heck of a lot of stuff
/spoiler
1
function useItem(x,y,z,itemId,blockId,side)
2
{
3
function useItem(x,y,z,itemId,blockId,side)
4
{
5
if(itemId==280)//if your item is a stick
6
{
7
addItemInventory(268,1);//wood sword
8
addItemInventory(269,1);//wood shovel
9
addItemInventory(270,1);//wood pickaxe
10
addItemInventory(271,1);//wood axe
11
print("you got a wood starter kit");
12
}
13
if(itemId==265)//if your item is a bow
14
{
15
addItemInventory(261,1);
16
print("you got a bow");
17
}
18
if(itemId==261)
19
{
20
addItemInventory(262,64);//arrows
21
print("arrows!!!!");
22
}
23
if(itemId==263);//if your item is a peice of coal
24
{
25
addItemInventory(406,1);
26
}
27
if(itemId==264)
28
{
29
addItemInventory(264,-1);
30
addItemInventory(141,1);
31
addItemInventory(310,1);
32
addItemInventory(311,1);
33
addItemInventory(312,1);
34
addItemInventory(313,1);
35
addItemInventory(276,1);
36
addItemInventory(458,1);
37
addItemInventory(142,1);
38
print("yay al lot of items")
39
}
40
}
41
function attackHook(attacker,victim)
42
{
43
var ourItem=getCarriedItem();
44
if(ourItem==505);
45
{
46
preventDefault();
47
rideAnimal(attacker,victim);
48
}
49
if(getCarriedItem()==500);
50
{
51
preventDefault();
52
dont always use "if" after the first "if" use "else if".
the Id is: 15016
here's a fixed code, i haven tried it but it should work:
function useItem(x,y,z,itemId,blockId,side)
{
if(itemId==280)//if your item is a stick
{
addItemInventory(268,1);//wood sword
addItemInventory(269,1);//wood shovel
addItemInventory(270,1);//wood pickaxe
addItemInventory(271,1);//wood axe
print("you got a wood starter kit");
}
else if(itemId==265)//if your item is a bow
{
addItemInventory(261,1);
print("you got a bow");
}
else if(itemId==261)
{
addItemInventory(262,64);//arrows
print("arrows!!!!");
}
else if(itemId==263)//if your item is a peice of coal there was a extra ";" here
{
addItemInventory(406,1);
}
else if(itemId==264)
{
addItemInventory(264,-1);
addItemInventory(141,1);
addItemInventory(310,1);
addItemInventory(311,1);
addItemInventory(312,1);
addItemInventory(313,1);
addItemInventory(276,1);
addItemInventory(458,1);
addItemInventory(142,1);
print("yay al lot of items"); // wasnt a ";" here
}
}
function attackHook(attacker,victim)
{
// a unnessisary variable was here
if(getCarriedItem()==505);
{
preventDefault();
rideAnimal(attacker,victim);//added the player(rider) entity
}
}
Tell me if there's anything wrong please!!!!!
[spoiler]
Here's the script I'd also (14193) is the script id
Tap a stick and get a wood starter kit
Tap an iron ingot to get a bow
Tap the bow to get 64 arrows
Tap a diamond to get a heck of a lot of stuff
/spoiler
1
function useItem(x,y,z,itemId,blockId,side)
2
{
3
function useItem(x,y,z,itemId,blockId,side)
4
{
5
if(itemId==280)//if your item is a stick
6
{
7
addItemInventory(268,1);//wood sword
8
addItemInventory(269,1);//wood shovel
9
addItemInventory(270,1);//wood pickaxe
10
addItemInventory(271,1);//wood axe
11
print("you got a wood starter kit");
12
}
13
if(itemId==265)//if your item is a bow
14
{
15
addItemInventory(261,1);
16
print("you got a bow");
17
}
18
if(itemId==261)
19
{
20
addItemInventory(262,64);//arrows
21
print("arrows!!!!");
22
}
23
if(itemId==263);//if your item is a peice of coal
24
{
25
addItemInventory(406,1);
26
}
27
if(itemId==264)
28
{
29
addItemInventory(264,-1);
30
addItemInventory(141,1);
31
addItemInventory(310,1);
32
addItemInventory(311,1);
33
addItemInventory(312,1);
34
addItemInventory(313,1);
35
addItemInventory(276,1);
36
addItemInventory(458,1);
37
addItemInventory(142,1);
38
print("yay al lot of items")
39
}
40
}
41
function attackHook(attacker,victim)
42
{
43
var ourItem=getCarriedItem();
44
if(ourItem==505);
45
{
46
preventDefault();
47
rideAnimal(attacker,victim);
48
}
49
if(getCarriedItem()==500);
50
{
51
preventDefault();
52
@Minecraftwickedness - Why do you have a useItem function inside a useItem function????
Yeppers.
Uhm attackHook works as - If you are holding an item and hit a mob (you have to define that the mob is the victim however, look at code below) something happens
mob = victim; //add this into the code
so an example code would be:
function attackHook(attacker, victim) // function attack hook code goes here
{
if(getCarriedItem()==341) //if the carried item is a slimeball
{
mob=victim;
clientMessage("Hit a mob");
}
}
Yeppers.
Uhm attackHook works as - If you are holding an item and hit a mob (you have to define that the mob is the victim however, look at code below) something happens
mob = victim; //add this into the code
so an example code would be:
function attackHook(attacker, victim) // function attack hook code goes here
{
if(getCarriedItem()==341) //if the carried item is a slimeball
{
mob=victim;
clientMessage("Hit a mob");
}
}
[spoiler]
Here's the script I'd also (14193) is the script id
Tap a stick and get a wood starter kit
Tap an iron ingot to get a bow
Tap the bow to get 64 arrows
Tap a diamond to get a heck of a lot of stuff
/spoiler
1
function useItem(x,y,z,itemId,blockId,side)
2
{
3
function useItem(x,y,z,itemId,blockId,side)
4
{
5
if(itemId==280)//if your item is a stick
6
{
7
addItemInventory(268,1);//wood sword
8
addItemInventory(269,1);//wood shovel
9
addItemInventory(270,1);//wood pickaxe
10
addItemInventory(271,1);//wood axe
11
print("you got a wood starter kit");
12
}
13
if(itemId==265)//if your item is a bow
14
{
15
addItemInventory(261,1);
16
print("you got a bow");
17
}
18
if(itemId==261)
19
{
20
addItemInventory(262,64);//arrows
21
print("arrows!!!!");
22
}
23
if(itemId==263);//if your item is a peice of coal
24
{
25
addItemInventory(406,1);
26
}
27
if(itemId==264)
28
{
29
addItemInventory(264,-1);
30
addItemInventory(141,1);
31
addItemInventory(310,1);
32
addItemInventory(311,1);
33
addItemInventory(312,1);
34
addItemInventory(313,1);
35
addItemInventory(276,1);
36
addItemInventory(458,1);
37
addItemInventory(142,1);
38
print("yay al lot of items")
39
}
40
}
41
function attackHook(attacker,victim)
42
{
43
var ourItem=getCarriedItem();
44
if(ourItem==505);
45
{
46
preventDefault();
47
rideAnimal(attacker,victim);
48
}
49
if(getCarriedItem()==500);
50
{
51
preventDefault();
52
53
}
54
function modTick()
55
{
56
}
the Id is: 15016
here's a fixed code, i haven tried it but it should work:
function useItem(x,y,z,itemId,blockId,side) { if(itemId==280)//if your item is a stick { addItemInventory(268,1);//wood sword addItemInventory(269,1);//wood shovel addItemInventory(270,1);//wood pickaxe addItemInventory(271,1);//wood axe print("you got a wood starter kit"); } else if(itemId==265)//if your item is a bow { addItemInventory(261,1); print("you got a bow"); } else if(itemId==261) { addItemInventory(262,64);//arrows print("arrows!!!!"); } else if(itemId==263)//if your item is a peice of coal there was a extra ";" here { addItemInventory(406,1); } else if(itemId==264) { addItemInventory(264,-1); addItemInventory(141,1); addItemInventory(310,1); addItemInventory(311,1); addItemInventory(312,1); addItemInventory(313,1); addItemInventory(276,1); addItemInventory(458,1); addItemInventory(142,1); print("yay al lot of items"); // wasnt a ";" here } } function attackHook(attacker,victim) { // a unnessisary variable was here if(getCarriedItem()==505); { preventDefault(); rideAnimal(attacker,victim);//added the player(rider) entity } }Hope this helps!
~MattdaveMatt
Fixed it!
Want GUI Templates? Done!
https://github.com/BeATz-UnKNoWN/ModPE_Scripts/wiki/ModPE-Script-Templates
P.S. Feel free to follow me so you know when I post "awesome" content and make the MCForums a brighter place (totally).
If you need to contact me you can either shoot a Kik message to beatz_unknown or send an email to [email protected]
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumUhm attackHook works as - If you are holding an item and hit a mob (you have to define that the mob is the victim however, look at code below) something happens
so an example code would be:
function attackHook(attacker, victim) // function attack hook code goes here { if(getCarriedItem()==341) //if the carried item is a slimeball { mob=victim; clientMessage("Hit a mob"); } }Check out my game! It's an open-world, sandbox text adventure.
Follow @hexdro_
Hexdro © 2012-2015
Yup!
its fixed, so don't worry about it ;p
help me with mine: http://www.minecraftforum.net/topic/2196514-please-help-me-with-my-lasso-script/
and: http://www.minecraftforum.net/topic/2173312-help-with-attack-hook-please-and-tools-mod/