growing a plant....

Whisp_Rush

Active Member
Reaction score
0
Hi! I have the following trigger to plant, and to grow wheat, and it works very well, if I plant only I... The point is that I´d like to plant more than one, but with this trigger, it´s not possible :
Trigger:
  • plant grain
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Plant Grain
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Casting unit) has an item of type Wheat Seeds) Equal to True
            • Then - Actions
              • Do nothing
            • Else - Actions
              • Unit - Order (Casting unit) to Stop
              • Game - Display to (All players) the text: You must have Wheat...
          • Item - Create Young Wheat at (Target point of ability being cast)
          • Item - Set charges remaining in (Item carried by (Casting unit) of type Wheat Seeds) to ((Charges remaining in (Item carried by (Casting unit) of type Wheat Seeds)) - 1)
          • Set GrainPoint = (Target point of ability being cast)
          • Wait 5.00 seconds
          • Item - Remove (Last created item)
          • Item - Create Wheat at GrainPoint
        • Else - Actions
          • Do nothing


The problem is with
"Set GrainPoint = (Target point of ability being cast)
Wait 5.00 seconds
Item - Remove (Last created item)
Item - Create Wheat at GrainPoint"
this part I think, because if you plant a new wheat, than that will be the "last created item"... so if you can, please help...

And an other cuaestion: Is it possible to make an item unpickupable?
thx
 

Whisp_Rush

Active Member
Reaction score
0
I don´t know... I thought about that too, but if I make a set variable trigger for the item, it will be overwrited as well, as last created item... or if not I don´t know how shpuld I do it... could you expalin it to me better? :/
 

NeuroToxin

New Member
Reaction score
46
Wrong, do this, make an item variable, and also add this line to the VERY beginning.
Trigger:
  • Custom Script: local item i


then, in the Item part after the if/then/else, do this
Trigger:
  • Custom Script: set i = LastCreatedItemBJ
    • Custom Script: set udg_TempItem = i

Locals are their own in their own functions, so this will create a separate function for each. (Theoretically) Therefore you can use waits all you want.
 

Mythes

Member
Reaction score
7
See?
Everyday you learn something new on this forum with JASS writers :p
Thanks for the knowledge, Tox.
That's something I didn't know...

Myt.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
if you want an item to not be "pickupable" change it to a neutral passive unit with the same model/scale and then once u want it to be "pickupable" again change it to an item again, OR you can set it so that whenever someone picks up an item of item type of that item it drops the item, but that would move if someone picks it up and drop it at their location, unless you saved the location of the item when it is dropped and if someone tries to pick it up it drops it at the location, but that gets more complicated and leads to leaks
 

Whisp_Rush

Active Member
Reaction score
0
NeuroToxin... I tried what you said, it doesn´t work for me... I'm sure I put the custom scripts at a wrong line.... could you please correct it to me? I send the map with this post...
thx
 

Attachments

  • farmcraft (1).w3x
    311.4 KB · Views: 119
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top