• 🏆 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!

Set Limit on Tree Spawn Troubles

Status
Not open for further replies.
Level 2
Joined
Oct 18, 2004
Messages
16
Im starting off on my map and i cant get tree's to spawn again with a set limit... i have it spawn trees at a random point in Wood Total Area <gen> after 30 seconds
but then no matter what i try i cant get what i want it to do.
I want after a certain amount of time for trees to spawn in Wood Total Area <gen>. 1 for every 1 that has died.
Here are my triggers so far for this...

--
Tree Count
Events
Time - Elapsed game time is 30.00 seconds
Conditions
Actions
For each (Integer A) from 1 to 30, do (Actions)
Loop - Actions
Destructible - Create a TREE!!! at (Random point in Wood Total Area <gen>) facing (Random angle) with scale 1.00 and variation 0
Trigger - Turn on Tree Respawn <gen>

--
Tree Count Dead
Events
Destructible - A destructible within (Entire map) dies
Conditions
Actions
Set DeadTreeCount = (DeadTreeCount + 1.00)

--
Tree Respawn
Events
Time - Every 30.00 seconds of game time
Conditions
Actions
For each (Integer A) from 1 to (Integer(DeadTreeCount)), do (Actions)
Loop - Actions
Destructible - Create a TREE!!! at (Random point in Wood Total Area <gen>) facing (Random angle) with scale 1.00 and variation 0
Set DeadTreeCount = (DeadTreeCount - 1.00)
 
Level 6
Joined
Feb 18, 2005
Messages
263
i think i know your problem. its within the last trigger you did.

Tree Respawn
Events
Time - Every 30.00 seconds of game time
Conditions
Actions
For each (Integer A) from 1 to (Integer(DeadTreeCount)), do (Actions)
Loop - Actions
Destructible - Create a TREE!!! at (Random point in Wood Total Area <gen>) facing (Random angle) with scale 1.00 and variation 0
Set DeadTreeCount = (DeadTreeCount - 1.00)

you should change this to
event
every 30 sec
conditions
actions
for 1 to DeadTreeCount do
//create your tree
//endfor
set DeadTreeCount = 0

becouse the way you did it, it decreased the DeadTreeCounter while waiting to reach it - if you change it's value within the loop, you change it in the endloop condition as well. so if you want to crate, lets sey 10 trees you would only create 5.

loop1
create tree
TreeCounter = TreeCounter - 1
counter = counter+1
exit if counter = TreeCounter
endloop

thats the the trigger you created... you see that it does not exactly what you wanted.

hope you understood what i ment.

- Raszul
 
Level 2
Joined
Oct 18, 2004
Messages
16
k i think that makes sense... ill mess around with the triggers and try to get it to work
 
Level 7
Joined
Jul 30, 2004
Messages
451
Lord Raszul said:
etc...
loop1
create tree
TreeCounter = TreeCounter - 1
counter = counter+1
exit if counter = TreeCounter
endloop

thats the the trigger you created... you see that it does not exactly what you wanted.

hope you understood what i ment.

- Raszul

-although i'm not totally sure on this-,
i'm pretty sure the internal structure of the loop actions actually go
bj_loopvarA = 1
bj_finishvarA = treecount

and then it loops using those 2 variables instead of the actual variable

although what you said is true under other circumstances

but maybe ur right if his problem is only getting 1/2 the trees



as for the original question

the other thing i'd ask is why use a real variable when you can just use an integer for incrementing treedeadcount

if its still not working display a text message of the value of deadtreecount, to see if its actually increasing the variable correctly
 
Status
Not open for further replies.
Top