Author Topic:  Crops  (Read 847 times)

0 Members and 1 Guest are viewing this topic.

JAZZ 0R KILLER

  • Jr. Member
  • **
  • Posts: 30
    • View Profile
    • Awards
  • Xbox: JAZZ 0R KILLER
Crops
« on: May 22, 2017, 09:34:56 PM »
Hello everyone!
If you have looked at my world "Society: Adventures within" world in the worlds section, you would know that I am working on an Adventure RPG map.

I have made some really cool scripts.
EX: Swing your hand to retrieve let's say flowers. You will receive the flowers if you are standing on the flower. This works for all flowers, and works for getting berries from the berry bush. The block itself doesn't get destroyed, it's just a set event script.

My question is, is there a way I could use this method for players to get crops?

EX: The player swings his\her hand, and if they are standing over the crop, lets say corn, they will get corn. The corn also has to be fully grown to get anything. I know you could do this using the crop option for set block, but is there any way you could script it so that it recognizes what crop is what? Like the corn crop is corn, and the potato crop is potato. It's just called "Crop".

Platinum Dryym

  • Supreme Member
  • *****
  • Posts: 4212
  • What's yours is mine. ~TM's Resident Master Thief~
  • Awards Members who have unlocked the robotic avatar Awarded to exemplary forum members 2 years on site+300 posts 3 years on site+600 posts Site art contributions/TPs in-game/Contest winners 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: dryym
Re: Crops
« Reply #1 on: May 22, 2017, 10:35:23 PM »
Use IsBlock [x,y,z] [aux]. I forget the exact aux values for each crop, So you'll have to experiment with it.

Out of curiosity, How did you make it so that when you swing your hand at a flower it doesn't break the flower? In my experience, Turning off edit from a swing event doesn't prevent you from breaking the thing.

Creator of the term "Deathmine "
Jared [19|Oct 07:12 PM]: "It changes everything" Dryym

crazytater94

  • Supreme Member
  • *****
  • Posts: 2567
  • Mastering TM since 2011
  • Awards Awarded to exemplary forum members Members who have unlocked the robotic avatar 3 years on site+600 posts 2 years on site+300 posts Was in the top 10 of the forum stats page as of 4/12/15 Former MotM winners Week 1 members w/25+ posts (4/13/13-4/20/13) 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: crazytater94
  • PSN: crazytater94 (Inactive)
  • Steam: crazytater94
Re: Crops
« Reply #2 on: May 23, 2017, 12:08:19 AM »
False. I confirmed this earlier, without edit, the flowers did not break. I did have admin, and wasn't the host though, but I doubt that has much to do with it.


Unless when you say "from a swing event" you mean that the script takes the permission, then you'd be correct, because the block breaks before the swing event is ran.

He just has edit off as a starting rule.

Platinum Dryym

  • Supreme Member
  • *****
  • Posts: 4212
  • What's yours is mine. ~TM's Resident Master Thief~
  • Awards Members who have unlocked the robotic avatar Awarded to exemplary forum members 2 years on site+300 posts 3 years on site+600 posts Site art contributions/TPs in-game/Contest winners 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: dryym
Re: Crops
« Reply #3 on: May 23, 2017, 02:20:21 PM »
False. I confirmed this earlier, without edit, the flowers did not break. I did have admin, and wasn't the host though, but I doubt that has much to do with it.


Unless when you say "from a swing event" you mean that the script takes the permission, then you'd be correct, because the block breaks before the swing event is ran.

He just has edit off as a starting rule.

Yeah, That's exactly what I meant.
I was assuming (And hoping) that this was an enhanced survival type thing where you would have edit by default.

Creator of the term "Deathmine "
Jared [19|Oct 07:12 PM]: "It changes everything" Dryym

JAZZ 0R KILLER

  • Jr. Member
  • **
  • Posts: 30
    • View Profile
    • Awards
  • Xbox: JAZZ 0R KILLER
Re: Crops
« Reply #4 on: May 23, 2017, 04:56:51 PM »
Thanks Platinum Dryym! I will go try that.
If anyone would like to see the world I am talking about, send me a message through Xbox and I will invite you. - JAZZ 0R KILLER

JAZZ 0R KILLER

  • Jr. Member
  • **
  • Posts: 30
    • View Profile
    • Awards
  • Xbox: JAZZ 0R KILLER
Re: Crops
« Reply #5 on: May 23, 2017, 05:14:06 PM »
I tried Platinum Dryyms idea and set the aux value and it sorta worked. Setting the aux value in the script If is block [block][aux]... will run true, but it's only for full grown crops. I noticed it does this for all of the crops. So, is there a way to establish what crop is what? I want it so the game recognizes which crop is which so that I can set the add inventory for the corresponding crop, if that makes any sence.

Platinum Dryym

  • Supreme Member
  • *****
  • Posts: 4212
  • What's yours is mine. ~TM's Resident Master Thief~
  • Awards Members who have unlocked the robotic avatar Awarded to exemplary forum members 2 years on site+300 posts 3 years on site+600 posts Site art contributions/TPs in-game/Contest winners 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: dryym
Re: Crops
« Reply #6 on: May 23, 2017, 07:23:08 PM »
I tried Platinum Dryyms idea and set the aux value and it sorta worked. Setting the aux value in the script If is block [block][aux]... will run true, but it's only for full grown crops. I noticed it does this for all of the crops. So, is there a way to establish what crop is what? I want it so the game recognizes which crop is which so that I can set the add inventory for the corresponding crop, if that makes any sence.

Set [Aux] to the auxiliary data value of the crop you want to check for. I don't remember the aux data for each crop off the top of my head, So you will have to experiment. If I get the chance, I will investigate and try to find the values for you.

Creator of the term "Deathmine "
Jared [19|Oct 07:12 PM]: "It changes everything" Dryym

JAZZ 0R KILLER

  • Jr. Member
  • **
  • Posts: 30
    • View Profile
    • Awards
  • Xbox: JAZZ 0R KILLER
Re: Crops
« Reply #7 on: May 23, 2017, 09:50:27 PM »
I played around with the aux values. It goes 1-5. The aux values are just the stage of the plants growth. If the aux value is 1, the plant has just started out. If it's 5, it's ready to be harvested. I don't think the aux values determines what crop is what. Thank you for the ideas though, and let me know if you find something.

Platinum Dryym

  • Supreme Member
  • *****
  • Posts: 4212
  • What's yours is mine. ~TM's Resident Master Thief~
  • Awards Members who have unlocked the robotic avatar Awarded to exemplary forum members 2 years on site+300 posts 3 years on site+600 posts Site art contributions/TPs in-game/Contest winners 1 year on site+100 posts
    • View Profile
    • Awards
  • Xbox: dryym
Re: Crops
« Reply #8 on: May 23, 2017, 11:35:48 PM »
Aux Data - Auxiliary data

Every block in the map has 8 bits of data available to it called auxiliary data.

Bits 1 - 3 are used for orientation and state.

Bit 4 is used to store whether or not the block is the originally generated block or whether it has been changed since generation (by a player or something else). This bit cannot be manipulated by script commands.

Bits 5 - 8 are used to store the selected texture id's (value range = 0-15 = 16 possible textures).

In order to calculate the Aux values by hand, you must understand the binary number system and how to form separate values in different groups of bits and combine them to calculate the final number.

http://en.wikipedia.org/wiki/Binary_number
http://en.wikipedia.org/wiki/Bitwise_operation
http://en.wikipedia.org/wiki/Bit_manipulation
http://en.wikipedia.org/wiki/Bit_field
http://en.wikipedia.org/wiki/Mask_%28computing%29

-----------------------------------------------------------------------------------------

Any block that has orientation: doors, trapdoors, stairs, ramps, one way glass, paintings, climbing ivy, torches, ladders, switches, buttons, beds, cylinders, use Bits 1 - 3 to define their orientation.


The following blocks can only face NSEW. They use Bits 1 and 2 to define the direction they face. A value from 0 to 3 inclusive. 0 = Facing East, 1 = Facing South, 2 = Facing West, 3 = Facing North.

Doors
Trapdoors
Stairs
Ramps
OneWayGlass
Beds
Cylinders

Cylinders are slightly different in that if Bit 3 = 0, then they are upright and Bits 1 - 2 are ignored. If Bit 3 = 1, then they are horizontal and Bits 1 - 2 are used to define their orientation.

Doors and Trapdoors use Bit 3 to define their state. 0 = Closed, 1 = Open.


The following blocks can be attached to the face of another block. They use Bits 1 - 3 to define the face they are attached to. A value from 0 to 5 inclusive. 0 = East face, 1 = South face, 2 = West face, 3 = North face, 4 = Top face, 5 = Bottom face.

ClimbingIvy
Switches
Buttons
Ladders
Torches
Paintings

Ladders and ClimbingIvy cannot be attached to the top or bottom face, so they cannot have a value higher than 3.

Torches cannot be attached to the bottom face, so they cannot have a value higher than 4.

Paintings are slightly different. They use Bits 1 - 2 to define the NSEW face they are attached to, but if Bit 3 = 1, then they are attached to the top face of the other block, facing up, and Bits 1 - 2 are now used to define their orientation.

Half Block:
Only uses Bit 1. If Bit 1 = 0, they are grounded, if Bit 1 = 1, they are raised.

Shops.
If Bit 1 = 1 they are economized.

Crops:
Bits 1 - 3 are used to define their current growth stage. Values 0 - 5 (6 stages).
Bits 5 - 8 are used to define the crop. Current values 0 - 2 (Wheat, Sugar Cane, Tomato).


Keys:
Bits 1 - 3 and 5 - 8 are used to define the key id.
0 = Skeleton key, 1 = Skull key. It's tricky to work this out by hand because Bit 4 is not used.

---------------------------------------------------------------------------

Textures

All blocks that can have their textures changed, including Paintings, use bits 5 - 8 of their Aux data to define the slot id for their texture.

0 = Default
1 - 15 = The slot id. That is the slot on the texture selection screen, not the block id itself.

e.g. If for Stairs you had Default, ConcreteBrick, WoodPlank, LimeStone and Glass selected as your textures, then a value of 3 will cause the stairs to be drawn with the LimeStone texture.

This should mean the numbers for fully grown crops are 5, 21, 41, 43, And 81. Although I am tired. So my binary may be incorrect.

Creator of the term "Deathmine "
Jared [19|Oct 07:12 PM]: "It changes everything" Dryym

JAZZ 0R KILLER

  • Jr. Member
  • **
  • Posts: 30
    • View Profile
    • Awards
  • Xbox: JAZZ 0R KILLER
Re: Crops
« Reply #9 on: May 24, 2017, 08:13:08 AM »
Wow, thanks Platinum Dryym! This is so helpful. Thank you so much!