| 06-09-2003, 04:08 AM | #1 |
Okay, recently I've come up with a good way (With alot of help from the forums) to detect custom spell lvl using an integer variable. Once a hero learns the spell equal to the custom id, it sets the spellLVL variable. Now if in the meantime another hero learns a DIFFERENT skill, will it knock the first skill out? Or will the first variable with the same variable name remain intact? Now if I have a few different custom spells in the same map I need to use this variable for would I need to make it into an integer array? If I -do- then It won't work because the inital variable value needs to be 0 so you can set spellLVL = SpellLVL + 1 to make it recognize each custom lvl.. That's the only way it works. Unless the inital value of an integer array is 0 I don't see how this would work... what I need is a way to globally detect new custom spell lvls, so the variable can detect new ones while the old ones remain intact.. |
| 06-09-2003, 06:08 AM | #2 |
for each integerA 1 to [number of spells in total] do Action set spellLevel[IntegerA] = 0 do that at map startup. |
| 06-09-2003, 06:28 AM | #3 | |
Quote:
i dont get that at all. set spellvl = intergerA = 0? Or make a new variable, call it spellLVLIntegerA and make THAT equal zero? :P the name of my variable is 'spellLVL' so it would be foreachinterger A 1 to blah, do set spellLVL = 0? and also, with this method, do I have to make the variable an integer array. you should really read this post piro. :P http://wc3campaigns.com/forums/showt...threadid=18580 |
| 06-09-2003, 07:04 AM | #4 |
If you couldn't wipe out the old numbers, you couldn't do anything with the editor. Use arrays if you need the same name. Use more variables if you need different names. Regards Dead-Inside |
| 06-09-2003, 01:41 PM | #5 |
I already did the same a while ago. It works like a charm. The only problem is that you need to create an integer array for every hero you want to track the spell levels of Lets say you create an integer array for your first hero, called "SpellLVL1" . It will contain 4 values, one for each spell. As explained abose, zero the values at map init : Set SpellLVL1[1] = 0 Set SpellLVL1[2] = 0 Set SpellLVL1[3] = 0 Set SpellLVL1[4] = 0 Then the triggers for that hero would look like : Code:
Event : A unit owned by player1 learns a skill (repeat for all other players that can own that hero) Condition Unit type of (Learning unit) is *that hero type* Actions : If (learnt skill = *that hero's 1st spell id* then Do Set SpellLVL1[1] = SpellLVL1[1] + 1 If (learnt skill = *that hero's 2nd spell id* then Do Set SpellLVL1[2] = SpellLVL1[2] + 1 If (learnt skill = *that hero's 3rd spell id* then Do Set SpellLVL1[3] = SpellLVL1[3] + 1 If (learnt skill = *that hero's 4th spell id* then Do Set SpellLVL1[4] = SpellLVL1[4] + 1 I know it sounds a bit annoying making a variable array and a trigger for each different hero, but that works. Regards |
| 06-09-2003, 02:38 PM | #6 |
A thing that might come in handy is that you can use an interger to set a player, by using player index, from 1 to 12 (actually up to 16, but not in a regular game). So when someone picks a certain hero, you can set the corresponding heros variable to the triggering players number. This way you don't have to make a load of different "if triggering player = X and hero =" but just "If hero =". Player index[YourVariable] Regards Dead-Inside |
| 06-09-2003, 04:01 PM | #7 |
You had me right up until there end there. DI.... What would the trigger look like that sets that? |
| 06-09-2003, 06:17 PM | #8 |
Guest | instead of having the condition of the trigger check the hero type you might want to have the trigger action check the hero type sorta like event: a unit learns a skill action: if hero is this type then set spellLvl[0] = (spellLvl[0] + 1) elseif her is this type then set spellLvl[1] = (spellLvl[1] + 1) etc... that way you only have one trigger for keeping track of spell levels. |
| 06-09-2003, 06:41 PM | #9 |
Hmm... I'm a little dizzy right now... But I meant that, you don't have to make a comparsion of what player it is. You just set the player integer (The index) of the player that chooses the hero when made. This way you can at any time go back and look at the owner of this specific hero. You then know who that player is, by a number. You just used "Convert to player index" thingy in the list when choosing a player. Regards Dead-Inside |
| 06-10-2003, 01:54 PM | #10 |
hmm. I'm thinkin' I don't need a player-owned unit event now. I think Jumbo's right. Just have a condition that recognizes the unit-type in this case, the specific hero that can learn that skill, then set the variable index. Might be annoying depending on how many trigger spells I have in the game, but eh, a little extra triggering never killed anybody. Ofcourse knowin' my luck I learn how to do all this, and the new tft editor winds up doin' it all FOR me, heh. :) |
