• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Random Spawning Destructibles

Status
Not open for further replies.
Level 5
Joined
Feb 5, 2021
Messages
89
Hello there, this is my first post in here and im hoping for the best!

So what im trying to do is have a trigger which on map initialization spawns a bunch of trees in a random position in the Test Region area and then these two triggers are supposed to pick the trees and make it so when one of the randomly placed trees in the area respawns randomly again.


TRIGGER #1 Works
RegrowTrees
Events
Map initialization
Conditions
Actions
Destructible - Pick every destructible in Test Region <gen> and do (If ((Destructible-type of (Picked destructible)) Equal to Grass Tree) then do (Trigger - Add to RegrowMe <gen> the event (Destructible - (Picked destructible) dies)) else do (Do nothing))

TRIGGER #2 Can be improved!
RegrowMe
Events
Conditions
Actions
Wait 0.10 seconds
Destructible - Create a (Destructible-type of (Dying destructible)) at (Random point in Test Region <gen>) facing (Random angle) with scale 1.00 and variation 0
Wait 0.10 seconds
If ((Destructible-type of (Last created destructible)) Equal to Grass Tree) then do (Destructible - Pick every destructible within 32.00 of (Position of (Last created destructible)) and do (Trigger - Add to RegrowMe <gen> the event (Destructible - (Picked destructible) dies))) else do (Do nothing)
Wait 0.10 seconds
Destructible - Remove (Dying destructible)


Right now, they do work, but what doesnt work for me is that if one of the respawned trees spawn beside another tree and i chop this "other" tree, it will trigger twice thus instead of creating just one other tree, it will make two.

I have a thought that you can make it trigger in a whole other way that i havnt thought of myself yet.
Maybe if i can somehow make a "cant place destructible within X from another" or something like that

Any suggestions are taken :)

- Sorry for the long post, this is my first, hope you can help me!
 
Level 5
Joined
Feb 5, 2021
Messages
89
Thank you, i am trying to do as you described but i am not using the resurrect destructible because i need the spawn to be random every time this unit "dies" and i am using the remove command to therefore get rid of the stump that it leaves behind.

I cannot find either an event nor an action that will allow me to set destructible position to be random at every creation or resurrection sadly :(


Essentially i am trying to make an area where you harvest resources, but i want it to be an infinite number of resources aswell as random spawns so it feels like the trees will "grow" when you are not in an area for some time :)
 
Level 5
Joined
Feb 5, 2021
Messages
89
Its okay, i found an actual solution to deal with the whole event adding and doubling system, the create / remove trigger is triggered from the use of an ability which i were going to use as an "Harvesting" ability so now it doesnt double and its all good!
 
Status
Not open for further replies.
Top