HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Spellcraft-esque spell learning

07-28-2004, 04:35 AM#1
stilljester
I've looked through the forums for a while, and I can't find anything that directly addresses this problem:

I'm making a map which uses a hero spell system similar to spellcraft - ie, you combine elements and a spell based on which elements you used is added via trigger to your hero. Let's pretend that you combine 3 elements to get your spell and there are 6 elements to choose from. By my math that is 216 spells. The way you increase a spell's level is by simply buying it again. My problem is this - I can't figure out a way to efficiently add/increase the level of these spells. What I would like to be able to do is to say "if skill level of holy light < 1, add holy light to triggering unit. / If skill level of holy light > 0 and < 10 increase skill level of holy light by 1" But there seems to be no trigger action to increase the level of a skill.

The only thing that comes close is Hero -> learn hero skill. But that only works on skills that they have available to learn initially. (ie, for a paladin it would only work on holy light, divine shield, etc). It can't be used on an added skill. I thought maybe i'd try simply making all the skills available to all heros. After all, I can arrange it so that the only way they can learn them is with my tirggers. But that adds the red cross "learn hero skill button" that wastes a skill slot and i can't get rid of. So I'm stuck making 10 skills for each one I want to be available and doing this: "if skill level of holy light (1) = 1 then remove skill holy light (1), add skill holy light (2). Elseif skill level of holy light (2) = 1 then remove skill holy light (2) add skill holy light (3)" etc, etc, etc ad infinitum.

Let's pretend I have 10 levels for every skill - that makes 2160 IF/THEN statements I have to enter by hand!!! Not to mention the fact that I need to make 2160 custom skills! There's got to be an easier way! Help!!!! :(
07-28-2004, 10:00 AM#2
Anitarf
Well, according to my calculations, you only have 6 combinations where all 3 elements are the same, 36 combinations where two elements are the same and one is different, and 20 combinations where all 3 elements are different. That gives you "only" 62 unique spells, and with 10 levels each, that's 620 spells to do in the object editor (mostly just copy-pasting).

The triggers can be done simpler with the use of an ability variable array, but that still means you would need one massive initialization trigger where you would set all those 620 spells to the variable. Well, it's still doable... If you decide to go this way, then post away and I can help you with the triggers.

There is probably an alternative way to do this, with triggered spells, but it is much more advanced. Lord Vexorian could probably help you there.
But a lot of object editor work is still only a lot of work, while the work itself is very simple, so I would suggest the first method.
07-28-2004, 02:58 PM#3
Mythmon
i dont see how you get 62, but heres how we got 216:

6 combinations for the first choice x 6 combinations for the second choice x 6 combinations for the third choice = 6^3 = 216.
now if you never used the same rune twice in a spell you have
6x5x4=30x4=120 combos
07-28-2004, 03:03 PM#4
Anitarf
I told you exactly how I get 62. In your system, for example, 1,2,3 is not equal 3,1,2; in spellcraft (since that is the example you gave), the order of the elements doesn't matter, so 1,2,3 is equal to 3,1,2. So if you want a spellcraftish like system, you only have 62 different spells.
07-28-2004, 03:36 PM#5
stilljester
omg you're right. 62 not 216. I forgot that 3,1,2 would be the same result as 2,3,1. Well, suddenly my situation doesn't seem nearly as hopeless as i had originally thought. ^_^

But there's no way to do something like this without making a seperate unit spell for each level, huh? disappointing. Would be easier to make 62 spells with 10 levels (and then I can use the auto-fill tool in WE)

But anyway thanks for the replies. Next time I'll have to check my facts before i post o_O
07-28-2004, 03:42 PM#6
stilljester
Oh, and btw thanks for the suggestion re: ability variable array. I'll look into it.
07-29-2004, 06:16 AM#7
Anitarf
Yeah, you could hold all the spells on all the levels in a single array, let's say spell one in slots from 1 to 10, spell 2 from 11 to 20... Then you need a lot fewer if-then-elses, you can do most stuff with loops and numbers; if the spells are in the right order, then you could get the proper place of the spell in the array just out of the basic ingredients (so you wouldn't have to repeat even 62 if-then-elses, let alone 620).
07-29-2004, 07:59 AM#8
Azhag
If you do your suggestions above then loading the map would take forever, even with good computers. It has to go through 640!!!!!!!!!!!!!!!!!!! different variables. Lets just say my computer has a hard enought time loading like 30!!!!

There is an easier way, I know because I know the person who made spellcraft, and I could ask him for you. But I doubt he will let you know, because that is his own unique system, and he wants to keep it that way, do you get what I'm saying. I will ask him if you want. Just reply and I'll ask.
07-29-2004, 08:58 AM#9
Anitarf
I don't know about all that, I just did a very simple test: a trigger with a hundred lines of seting an ability to a variable; the whole map loaded in, like, 3 seconds (the triggers part must have taken a small part of a second). Seting stuff to variables is absolutely no big deal. What could be considered a problem would be 620 different abilities in the object editor themselves, not the trigger that stores them to a variable. And again, doing a test with 5 abilities being copy&pasted 10 times each (giving 50 custom abilities) showed no change in the loading time, or the filesize for that matter. That would suggest that warcraft only saves the modifications you do to an ability, rather than all the data of the ability (hence the low filesize and loading time, because I just copied the stuff and didn't modify it much), but his system also requires mostly copy&pasting, all he is going to modify are a few stats of the abilities that change as the spell gets better, and the tooltips.

Anyway, any more ambitious project ends up with a few 100 custom objects in the object editor (units, buildings, spells, buffs...); I don't see how 620 custom unit spells is such a big deal (that's it, the spells can be used also by creeps, so these 620 spells are probably all the spells he'll have).
07-29-2004, 11:52 AM#10
th15
Anitar, the reason cutting & pasting 10 copies of an abilities has no effect on the computer is that if the abilities aren't used by a unit that is pre-placed on the map, the ability won't be loaded until the game needs it.

Loading abilities involves parsing a butt-load of strings, it does take time. In some cases when creating heroes with lots of many-level spells, the lag becomes very noticeable. Theoretically, on a slow computer, a shrewd player should be able to know when any player creates a hero, even in melee. In theory anyways :)
07-29-2004, 12:28 PM#11
Anitarf
Yeah, I thought there was going to be a mistake somewhere in my methods. However, I do not see a way with which you could possibly get all the various spell effects with fewer spells. Even when entirely triggering spells, there are only some things that can be done at will, such as damage. Various buffing spells and such things need, on the other hand, actual spells to do what needs to be done. OK, perhaps, with making every aspect of a spell triggered with special sub-spells (so inner fire would be, for example, a combination of a bonus armor and a bonus damage spell), the ammount of abilities could be decreased, but not considerably.