A long time ago in 0.5.0 I made a map based off of the game boxhead 2playrooms. I am now making a mod script for this map that will allow it to be more like a shooting game. I have a few questions about the scripts though.
1: if there is an additemInventory(blockId,amount), is there a removeitemInventory or can you make the amount for add item a negative number?
2: Is there a way to have a wait ___seconds?
3: Can you state specific coordinates to trigger something?
4: I see alot in scripts that there are custom items which never work for me. Is the custom item function not developed or am I just stupid?
5: Is there a way to say " if touching(block or mob)"?
A long time ago in 0.5.0 I made a map based off of the game boxhead 2playrooms. I am now making a mod script for this map that will allow it to be more like a shooting game. I have a few questions about the scripts though.
1: if there is an additemInventory(blockId,amount), is there a removeitemInventory or can you make the amount for add item a negative number?
2: Is there a way to have a wait ___seconds?
3: Can you state specific coordinates to trigger something?
4: I see alot in scripts that there are custom items which never work for me. Is the custom item function not developed or am I just stupid?
5: Is there a way to say " if touching(block or mob)"?
If you have any answers please tell me.
3. Use:
var px,py,pz;
var atTriggerCoords=false;
var triggerX=0; //place x coords here
var triggerY=0;//place y coords here
var triggerZ=0;//place z coords here
function modTick()
{
px=Player.getX(); //gets the player x
py=Player.getY-1(); //gets the player y (the -1 because if you dont it will use the pos of your head)
pz=Player.getZ(); //gets the player z
if(px==triggerX&&py==triggerY) // if the player x an y are at the trigger x and y
{
if(pz==triggerZ) // and if the player z is at triggerZ
{
atTriggerCoOrds=true;
//Your code here (Do what you want when the coords are there eg. clientMessage("You are at the trigger coOrds!");
atTriggerCoOrds=false;
}
}
}
A long time ago in 0.5.0 I made a map based off of the game boxhead 2playrooms. I am now making a mod script for this map that will allow it to be more like a shooting game. I have a few questions about the scripts though.
1: if there is an additemInventory(blockId,amount), is there a removeitemInventory or can you make the amount for add item a negative number?
2: Is there a way to have a wait ___seconds?
3: Can you state specific coordinates to trigger something?
4: I see alot in scripts that there are custom items which never work for me. Is the custom item function not developed or am I just stupid?
5: Is there a way to say " if touching(block or mob)"?
If you have any answers please tell me.
and for the wait..
NOTE: a "tick" is 1/20 of a second
var go=false;
var delay=0;
//example trigger code
function useItem(x,y,z,itemId,blockId,side)
{
if(itemId==280)//if a stick on anything
{
delay=60; //sets the delay to 6 seconds
go=true; //start the countdown
}
}
//the actual delay:
function modTick()
{
if(go) // if "go" is true
{
delay--; //makes the delay go down 1 every 20th of a second
if(delay==0) // if the delay is over
{
go=false; //turns it off
//the code you want after the delay is over here
}
}
}
If i helped you please press the button ------------->
A long time ago in 0.5.0 I made a map based off of the game boxhead 2playrooms. I am now making a mod script for this map that will allow it to be more like a shooting game. I have a few questions about the scripts though.
1: if there is an additemInventory(blockId,amount), is there a removeitemInventory or can you make the amount for add item a negative number?
2: Is there a way to have a wait ___seconds?
3: Can you state specific coordinates to trigger something?
4: I see alot in scripts that there are custom items which never work for me. Is the custom item function not developed or am I just stupid?
5: Is there a way to say " if touching(block or mob)"?
If you have any answers please tell me.
4. for custom items do:
var ini=false; //this is the initializing variable
function selectLevelHook()//if you chose a world
{
ModPE.setItem(CustomitemId,"Item Texture name", Item Texture #, "Custom Item Name");
ini=true;
}
and for the wait..
NOTE: a "tick" is 1/20 of a second
var go=false;
var delay=0;
//example trigger code
function useItem(x,y,z,itemId,blockId,side)
{
if(itemId==280)//if a stick on anything
{
delay=60; //sets the delay to 6 seconds
go=true; //start the countdown
}
}
//the actual delay:
function modTick()
{
if(go) // if "go" is true
{
delay--; //makes the delay go down 1 every 20th of a second
if(delay==0) // if the delay is over
{
go=false; //turns it off
//the code you want after the delay is over here
}
}
}
If i helped you please press the button ------------->
~MattdaveMatt
4. for custom items do:
var ini=false; //this is the initializing variable
function selectLevelHook()//if you chose a world
{
ModPE.setItem(CustomitemId,"Item Texture name", Item Texture #, "Custom Item Name");
ini=true;
}
1: if there is an additemInventory(blockId,amount), is there a removeitemInventory or can you make the amount for add item a negative number?
2: Is there a way to have a wait ___seconds?
3: Can you state specific coordinates to trigger something?
4: I see alot in scripts that there are custom items which never work for me. Is the custom item function not developed or am I just stupid?
5: Is there a way to say " if touching(block or mob)"?
If you have any answers please tell me.
3. Use:
var px,py,pz; var atTriggerCoords=false; var triggerX=0; //place x coords here var triggerY=0;//place y coords here var triggerZ=0;//place z coords here function modTick() { px=Player.getX(); //gets the player x py=Player.getY-1(); //gets the player y (the -1 because if you dont it will use the pos of your head) pz=Player.getZ(); //gets the player z if(px==triggerX&&py==triggerY) // if the player x an y are at the trigger x and y { if(pz==triggerZ) // and if the player z is at triggerZ { atTriggerCoOrds=true; //Your code here (Do what you want when the coords are there eg. clientMessage("You are at the trigger coOrds!"); atTriggerCoOrds=false; } } }I hope this helps!
and for the wait..
NOTE: a "tick" is 1/20 of a second
var go=false; var delay=0; //example trigger code function useItem(x,y,z,itemId,blockId,side) { if(itemId==280)//if a stick on anything { delay=60; //sets the delay to 6 seconds go=true; //start the countdown } } //the actual delay: function modTick() { if(go) // if "go" is true { delay--; //makes the delay go down 1 every 20th of a second if(delay==0) // if the delay is over { go=false; //turns it off //the code you want after the delay is over here } } }If i helped you please press the
~MattdaveMatt
4. for custom items do:
var ini=false; //this is the initializing variable function selectLevelHook()//if you chose a world { ModPE.setItem(CustomitemId,"Item Texture name", Item Texture #, "Custom Item Name"); ini=true; }you get the texture names from:
http://zhuoweizhang.net/mcpetexturenames/
You missed 4, your 4 is 5.
Actually, 60 ticks would be the equivalent of 3 seconds not 6 seconds...
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]
oh yeah,
Glad to hear it!