Periodic spawning problem

Solu9

You can change this now in User CP.
Reaction score
216
This is probably an easy to solve problem. Nevertheless I can't figure out what to do.

Trigger:
  • Spawn trigger
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Item - Pick every item in Spawn <gen> and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Item-type of (Picked item)) Equal to Sword +1
                  • (Item-type of (Picked item)) Equal to Sword +2
                  • (Item-type of (Picked item)) Equal to Sword +3
            • Then - Actions
              • Do nothing
            • Else - Actions
              • Item - Create Random_Sword[(Random integer number between 1 and 3)] at (Random point in Spawn <gen>)


No item is spawning. I figure is has something to do with the "Pick every item" action. If there are no items I guess it can't pick any, thus the trigger fails.

Random_Sword is a Item(array) variable. And works as it should.
 

Solu9

You can change this now in User CP.
Reaction score
216
what exactly do you want for this trigger to do.

There is an item in the "Spawn" zone. If the player pick up that item the game will automatically create a new item. If the player has not picked up the item, the game will do nothing.
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
So you want to detect whether there is an item in ther region or not?

In that case do it like this:

Code:
set Temp_Integer = 0
pick every item in REGION{
 set Temp_Integer = Temp_Integer + 1 }
if Temp_Integer > 0{
 Create Item in REGION}
This is of course pseudo-code and i hope you can understand how this is supposed to work. We pick all items and count them with an integer variable, then, we check how many we have got.
 

Inflicted

Currently inactive
Reaction score
63
Just btw, this leaks:
Item - Create Random_Sword[(Random integer number between 1 and 3)] at (Random point in Spawn <gen>)

There is an item in the "Spawn" zone. If the player pick up that item the game will automatically create a new item. If the player has not picked up the item, the game will do nothing.
This confuses me slightly, what you have done is a periodic replacement instead of an individual item acquirement. Why not just have a trigger that checks when a unit picks up an item, if that unit is in the particular region and their are no nearby items of that type. Or simply check if the item is the specific one, or specific player. (I'm assuming you want that it to be dependent on a player or some sort due to you saying: "If the player has not picked up the item...")

My reasoning is that periodic's apparently use more memory or process power (something like that) because the trigger is run every few seconds. This only operates when an Item is Picked Up. Although this might run more often if you have a large amount of these items/spots in your map. So your method should be dependent on your need, in this case.

There is an event for an item being acquired. You can easily check if the unit is within a region as the default GUI editor has a function for that.

Please let us know if there is any step you cannot complete.
 

Solu9

You can change this now in User CP.
Reaction score
216
This is of course pseudo-code and i hope you can understand how this is supposed to work. We pick all items and count them with an integer variable, then, we check how many we have got.

The problem with this, I guess, is if the players leaves an item in the region and leaves. Thereby the trigger counts the item and does not spawn a new of the right type.

Please let us know if there is any step you cannot complete.

I'll let you know. Thanks.
 

Accname

2D-Graphics enthusiast
Reaction score
1,463
Of course you can do whatever "If/Then/Else" comparison within the loop you like, that doesnt matter. I just wanted to give you the basic outline of the trigger, you have to add the details yourself.
 

Kayoss666

Member
Reaction score
7
This is probably an easy to solve problem. Nevertheless I can't figure out what to do.

Trigger:
  • Spawn trigger
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Item - Pick every item in Spawn &lt;gen&gt; and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Item-type of (Picked item)) Equal to Sword +1
                  • (Item-type of (Picked item)) Equal to Sword +2
                  • (Item-type of (Picked item)) Equal to Sword +3
            • Then - Actions
              • Do nothing
            • Else - Actions
              • Item - Create Random_Sword[(Random integer number between 1 and 3)] at (Random point in Spawn &lt;gen&gt;)


No item is spawning. I figure is has something to do with the "Pick every item" action. If there are no items I guess it can't pick any, thus the trigger fails.

Random_Sword is a Item(array) variable. And works as it should.

you say the random_sword item(array) works cuz that is the only problem i see besides the event really should be
Trigger:
  • Unit - A unit Acquires an item
and the condition
Trigger:
  • ((Spawn &lt;gen&gt;) contains (Hero manipulating item)) Equal to True
should be added. does your trigger know that Random_Sword[(1)] = sword +1, Random_Sword[(2)] = sword +2, and Random_Sword[(3)] = sword +3?
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
The intent of your trigger still eludes me. Do you want to immediately spawn a new item whenever the old one is picked up? Periodically create new items if there aren't any in the region? Or something else?
 

Solu9

You can change this now in User CP.
Reaction score
216
Does your trigger know that Random_Sword[(1)] = sword +1, Random_Sword[(2)] = sword +2, and Random_Sword[(3)] = sword +3?

Trigger:
  • Set Random Sword
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Random_Sword[1] = Sword +1
      • Set Random_Sword[2] = Sword +2
      • Set Random_Sword[3] = Sword +3


Yeah I believe it does.

The intent of your trigger still eludes me. Do you want to immediately spawn a new item whenever the old one is picked up? Periodically create new items if there aren't any in the region? Or something else?

Periodically spawn. Lets say every 5 minutes. I must admit I don't see why this trigger does not work.
 

Chewbalka

New Member
Reaction score
14
Just add a if/then/else to the beginning.

if
(Random item in Spawn <gen>) Equal to No item
then
Item - Create Random_Sword[(Random integer number between 1 and 3)] at (Random point in Spawn <gen>)
skip remaining actions
else
The rest of the current code


There's no need for a variable or the loop when there is no item in the region. Just re-create the above in GUI at the top of the trigger.

You should also change that "do nothing" to "skip remaining actions"
Because if i place a item that is not a sword, the loop will pick it, find its not a sword and then spawn a item even if there are other swords within the region. (the loop does the actions for each item as a individual.)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top