HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

More Questions

07-17-2002, 04:34 AM#1
Guest
1: I'm using Cookie's new 1.01B Advanced editing tool. I want to make a custom building have another custom building be a requirement for it. The problem is, a string is required to identify the requisite building, and since the unit is custom, I don't know what that string is. How do I either find out, or set this string.

2: Is there a way to straight up change the duration of a summoned unit after it has been summoned?

3: Is there a straight up way to modify the mana cost of a spell/ability, or to change the cool down of the spell?
07-17-2002, 12:20 PM#2
Guest
1: I would jsut open up the regular WE and select your custom unit from the dialog. Then I would guess the proper string would show up the next time you open the map in the advanced editor.

2: This could be complicated. I'm not sure there is a way to explicitly do this, but I can think of at least one solution involving triggers... Before I go into this let me make sure I understand exactly what you are asking. You want a unit to die (or disappear or just not be useable anymore) after a specific amount of time passes since it first appeared on the map?

3: From what I have read and tried to figure out on my own there is no way to edit any of the properties of the spells.

Beav
07-17-2002, 10:05 PM#3
Guest
Yes, I want a Water Elemental, for instance, to be summoned for only 12 seconds. Could I do an increment timer and just tell it to 'die' after 12 seconds? I pretty much want it to work the same with all units of that type, no matter who summons them.
And, bummer about the spells, that'l make things difficult.
I was thinking, however, can't you 'set mana' in non % amounts triggered on the use of an ability? Doing such could reduce the cost of a spell by giving them X amount of mana back after each casting.
07-17-2002, 10:51 PM#4
Guest
If there is a way to simply set the expiration time of a unit (as it does whenever you summon a water elemental normally) I do not know of it. Unless someone else knows that that is possible I would to it with triggers.

First you'll need to make a few variables. Make an integer called count (you don't have to use these names exaclty), a unit array called whichUnit, and a integer array called countDown.

On the initialization set count to zero.

Them make the following triggers:

----------------------------------------
Events:
Unit Enter Region - entire map

Conditions:
Boolean Comparison - triggering unit is in units of type [whatever type] equal to true

Actions:
set whichUnit[count] = triggering unit
set countDown[count] = 12 (or any number of seconds)
set count = count + 1

----------------------------------------
Events:
Time Periodic Event - Every 1.00 second of game time

Actions:
for each integer A from 0 to count do set countDown[A] = countDown[A] -1
for each integer A from 0 to count do if countDown[A] == 0 then do unit - kill whichUnit[A] else do nothing

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

The last trigger can be done much more efficiently if you convert it to custom text and place both operations inside a single for loop. This could get very cumbersome if large amounts of creatures have to be controlled like this. Also, this does not have any optimizations for lowering count when a unit dies. This means that if it is happening often in a game the for loop will get very long. This is bad. You can add a one more trigger to help this, but it won't work very well if you have varying times of the units existance. If you always have the creatures lating the same amount of time it should work fine.

Add an integer called countLower and the following trigger. You'll also have to make a slight modifications to the time based trigger, namely make the for loop go from countLower to count. Also, set countLower to zero on init.

----------------------------------------
Events:
Unit Leaves Region - entire map

Conditions:
Boolean Comparison - triggering unit is in units of type [whatever type] equal to true

Actions:
if triggering unit == whichUnit[countLower] then countLower = countLower+1 else do nothing

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

Now again, this might not be the best way to do it, but it's how I would do it. I hope you understand this and it helps...

As for the last part of your question, you are able to add specific amount of mana, but I'm not sure there is a trigger event that deals with casting a spell. Also, if the unit had less mana than the normal requirement it would still not be able to cast the spell since you would have to catch the spell being cast and then credit mana back. The unit would not have had enough mana to ever cast the spell.

Beav
07-17-2002, 11:32 PM#5
Guest
Yes, and if I was making something more expensive, they could cast the spell without the requisite mana, so long as they had the starting mana. Shouldn't be a HUGE problem though, unless I was trying a low cool down effect (which I'm not sure you can change) I'm curious as to whether removing an ability from a unit, and then adding it again would revert the countdown to 0 (If even such is possible).

Ah, the direction for summoning that you put there make perfect sense. The only thing I'm wondering about ( I haven't really looked at the code yet, and until now didn't realize you could put in such functions) is garbage collection. You keep incrementing COUNT (The # of summons in the map) each time one is made, yet down decrement each time one is killed. I realize this is because you would have to shorten the array (WhichUnit (X) = WhichUnit(X+1) ). That'd take more processor power, but it'd keep The Count from getting too high. Not sure if it's important though, since I doubt I'll summon more creatures then an integer ranges to. Just wondered if there's a clean way to do that (doubtful).

Man o Man, though, Periodic timers are one of the greatest inventions, I swear :). Nothing like a built in Animator :-D.
07-18-2002, 06:48 AM#6
dataangel
You can disable/enable ability, and it setting cooldown to 0 is a theory of mine too... but I still haven't tested it >_<

Argh....
07-18-2002, 10:40 PM#7
Guest
Yes garbage collection is an issue, but I do not really know how it works in Warcraft3. The fact that you never have to specify the length of the array and that you never have to call memory allocation functions to use arrays makes me think the game will at least partially handle garbage collection. However it is not likely that any garbage collection would delete unused data at the beginning of an array, although it could. The other option is to move each element of the array down towards the first one (the one that is being removed). As long as you keep the whichUnit index matched up to the countDown index there will be no problem. Also you want the lowest time at zero and the highest time at n-1. This should all be natural if you have a constant expiration time. Then I would guess any garbage collection present would find the unused elements at the end of the array. This is still all assuming that warcraft handles garbage collection at all. This will use more processor time to handle then moving the lower bound up, but in actuality you will most likely not be able to tell on a decent computer and towards the lower limit of number of units being handled in this manor. Ie, if you are handling hundreds and maybe even dozens of units at a time you probably would not want to move all those around so often.

Beav