| 02-23-2004, 08:05 AM | #1 |
Ya as I said, the hero bonus attributes ability has yet to work right for me. I think it's because I have it set to higher spell level than it wants to use (15 levels) but I still dont see why it wont work. Anyhow, I wrote a trigger to compensate, but I just realized it won't work in my multiplayer map, because it uses a global variable and since all the heroes have this skill than it will get bugged. Soo, whats the easiest way to fix this? Use local variables in the trigger? Or maybe use group arrays? I'm none too skilled in either of those areas yet, I tend to have trouble using arrays with integers, etc. I'm going to post the trigger and see if any of you can post a fix for me. Basically all this trigger does is check the skill level for the hero, than sets the variable +1, and then applys an "item" skill that gives the appropriate amount of stat bonuses per level. Works great when i single player test, but I can tell it wont work with more than 1 player. It's setup to give +5 str/agi/int per level, so each level in the trigger I remove the previous ability and add a new one with an additional +5 to the stats. Ok here's the trigger, thanks for helping guys. Code:
hero attribute ability fix
Events
Unit - A unit Learns a skill
Conditions
(Learned Hero Skill) Equal to (==) Attribute Bonus
Actions
Set attribmod_lvl = (attribmod_lvl + 1)
Set attribmod_learner = (Learning Hero)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
attribmod_lvl Equal to (==) 1
Then - Actions
Unit - Add Hero Stat Bonus (+5 All Stats) to attribmod_learner
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
attribmod_lvl Equal to (==) 2
Then - Actions
Unit - Remove Hero Stat Bonus (+5 All Stats) from attribmod_learner
Unit - Add Hero Stat Bonus (+10 All Stats) to attribmod_learner
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
attribmod_lvl Equal to (==) 3
Then - Actions
Unit - Remove Hero Stat Bonus (+10 All Stats) from attribmod_learner
Unit - Add Hero Stat Bonus (+15 All Stats) to attribmod_learner
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
attribmod_lvl Equal to (==) 4
Then - Actions
Unit - Remove Hero Stat Bonus (+15 All Stats) from attribmod_learner
Unit - Add Hero Stat Bonus (+20 All Stats) to attribmod_learner
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
attribmod_lvl Equal to (==) 5
Then - Actions
Unit - Remove Hero Stat Bonus (+20 All Stats) from attribmod_learner
Unit - Add Hero Stat Bonus (+25 All Stats) to attribmod_learner
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
attribmod_lvl Equal to (==) 6
Then - Actions
Unit - Remove Hero Stat Bonus (+25 All Stats) from attribmod_learner
Unit - Add Hero Stat Bonus (+30 All Stats) to attribmod_learner
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
attribmod_lvl Equal to (==) 7
Then - Actions
Unit - Remove Hero Stat Bonus (+30 All Stats) from attribmod_learner
Unit - Add Hero Stat Bonus (+35 All Stats) to attribmod_learner
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
attribmod_lvl Equal to (==) 8
Then - Actions
Unit - Remove Hero Stat Bonus (+35 All Stats) from attribmod_learner
Unit - Add Hero Stat Bonus (+40 All Stats) to attribmod_learner
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
attribmod_lvl Equal to (==) 9
Then - Actions
Unit - Remove Hero Stat Bonus (+40 All Stats) from attribmod_learner
Unit - Add Hero Stat Bonus (+45 All Stats) to attribmod_learner
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
attribmod_lvl Equal to (==) 10
Then - Actions
Unit - Remove Hero Stat Bonus (+45 All Stats) from attribmod_learner
Unit - Add Hero Stat Bonus (+50 All Stats) to attribmod_learner
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
attribmod_lvl Equal to (==) 11
Then - Actions
Unit - Remove Hero Stat Bonus (+50 All Stats) from attribmod_learner
Unit - Add Hero Stat Bonus (+55 All Stats) to attribmod_learner
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
attribmod_lvl Equal to (==) 12
Then - Actions
Unit - Remove Hero Stat Bonus (+55 All Stats) from attribmod_learner
Unit - Add Hero Stat Bonus (+60 All Stats) to attribmod_learner
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
attribmod_lvl Equal to (==) 13
Then - Actions
Unit - Remove Hero Stat Bonus (+60 All Stats) from attribmod_learner
Unit - Add Hero Stat Bonus (+65 All Stats) to attribmod_learner
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
attribmod_lvl Equal to (==) 14
Then - Actions
Unit - Remove Hero Stat Bonus (+65 All Stats) from attribmod_learner
Unit - Add Hero Stat Bonus (+70 All Stats) to attribmod_learner
Else - Actions
Do nothing
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
attribmod_lvl Equal to (==) 15
Then - Actions
Unit - Remove Hero Stat Bonus (+70 All Stats) from attribmod_learner
Unit - Add Hero Stat Bonus (+75 All Stats) to attribmod_learner
Else - Actions
Do nothingYep its a fairly long trigger, but its super simple. Just want to get it working so if a bunch of heroes controlled by different players all have this ability it will work correctly for each of them.. -Huh |
| 02-23-2004, 08:54 AM | #2 |
Ok well, let's see, what variables do you have? attribmod_lvl and attribmod_learner...now firstly go to variables and change attribmod_lvl to arrays with a max of how many players are in your map. Then add another variable called...hrmm, say "TempPlayer" add a... Set TempPlayer = owner of Learning Hero in amongst the other settings of variables. Then go through and for every attribmod_lvl(?) set the array number to TempPlayer. This way it'll keep track of every player's hero seperately and stay as one trigger. I think that will work, perhaps someone else can verify. Goodluck. EDIT: Ok wait, another thought, that whole thing can be a lot simpler. Add another variable called "AttributeAbilties" make it's variable type an ability and then make it an array large enough for all the levels of your ability. Then add for loops like this... set tempplayer = owner of learning hero set attribmod_lvl(tempplayer) = attribmod_lvl(tempplayer) + 1 for a = 1 to 10( remove attributeabilities(for loop integer a) from learning hero )end loop add attributeabilities(attribmod_lvl(tempplayer)) to learning hero and bham, that's the whole trigger. Of course you'll need another trigger, that goes off near map initialization or at map initialization that goes something like this... set attributeabilities(1) = attribute1 set attributeabilities(2) = attribute2 set attributeabilities(3) = attribute3 etc where, attribute1 is the first level of the attribute ability you're adding. Hope this helps. |
| 02-24-2004, 02:50 AM | #3 |
if tempplayer is a player variable, how could i use it with attribmod_lvl? attribmod_lvl is an integer variable, it requires an integer (i think), not a player. Sorry but I'm still a tad bit confused.. |
| 02-24-2004, 03:06 AM | #4 |
Ok, I undestand your problem, all you need to do is look through the integer list, say you've opened up the list of things you can use for the array number. Look up 'Player - ' and you should find, player number, click that and it'll convert a player's number into an integer for you, then use TempPlayer, sorry I wasn't more clear about that. Hope it helps you. |
| 02-24-2004, 03:13 AM | #5 |
wow thats a really crappy way of doing it. Oh how horribly sloppy that is! Please use BonusMod for the love of all thats holy. It uses less abilities for what you need. And is much cleaner code wise. You would have to change its current definations from HP,Dmg,mana,and armor to that stat bonus thing at incrementing powers of 2. It will only use 10 abilites and give you a range of a 1023 bonus stats, which I think is plenty more then you need anyway. |
| 02-24-2004, 03:30 AM | #6 |
Uh Weaddar, thanks but no thanks. I don't do my maps in that JASS crap, i like to leave it in GUI form. Your way might be alot better in your opinion, but for what I'm trying to do my way will work just fine. Also I dont find it any more sloppy than that jass method. Its a helluva lot easier to understand for non-JASS map makers like myself... |
| 02-24-2004, 03:38 AM | #7 |
forgive me but from a programmer stance your code is what we call sloppy. My code is lean and built around an algorothim, your is just handling every case possible explicity. (hence more code). Also wether your little mind comprehends it you are using jass as the GUI just translate it to jass when it compiles but your method is monstrious and unreadable from a jass viewers prospective. Turn that Custom text (how i'll read it as programming in setence is just awkward) and you'll be greated by a cacophany of gobbledegook. You have to make 15 abilities, I made 10. You support only 16 different bonuses (0,5,5*2,5*15), I support 1024 (0-1023). My code is more clever, uses natives insuring greater speed, and has no overhead from excessively having to retry a condition. A slight optimization for you would be to go If(cond)then (blah blah) Else if(next cond)then else if(next cond) This means war3 quits the code earlier meaning it has to run through less of these repetitions. |
| 02-24-2004, 03:42 AM | #8 | |
Quote:
Um, ok thanks for the insult, you seem to be really good at that from what I get perusing these forums. I'd love to try and make a witty little reply but I recall reading somebodys signature that keeps me from doing so.. goes a little something like this: "Arguing on the internet is like entering the special olympics; even if you win you're still a retard".. 'nuff said ... |
| 02-24-2004, 03:48 AM | #9 |
Its infuriating that you're insulting a clearly supperior method. (Jass Crap) I take that as an insult, and you completely dismissing my advice and calling it and my code crap is more insulting then me saying your method is shoddy with a further explanation as to why it is shoddy. Especially when the answer is right in front of you. If I were to tell you dude your doing more work then you have to and just tell you to use a binary approach, I'd be rightfully told, no thanks. But when somebody presents you some answer you generally don't look a gifthorse in the mouth. But I suppose you have the greatest argument against it, its in optimized jass form. Goddamn me and wanting to be effecient! I should use GUI, i'm sure you'd be more acceptive at that point. Also, I've been generally reverred (recently) as one of the more helpful people on these forums so keep these remarks to yourself. |
| 02-24-2004, 03:58 AM | #10 |
Ok well I DO appreciate help offered, but I always take it with a grain of salt. Also, you really don't go about trying to offer help, and then decide to insult the person you're trying to help at the same time, because all that does is make you look like an ass. I'm sure custom text is alot more efficient, and most likely easier to impliment... from a programmers perspective. BUT, I'd just like to clarify.. I'M NOT A PROGRAMMER. Playing with the war3 editor is about the closest thing I've ever come to programming. ALso, if I was a "programmer", I seriously doubt I'd be wasting my time messing with WC3 when I could be out there doing truly original creative things that could make me a ton of money. So, in all honesty, when you offer help to somebody please dont imply that your method is like "the method to end all methods", because in the case that somebody doesn't fully understand your method, then it wouldn't do them much good. I'm NOT going to let this turn into some kind of argument, because I already know how people like yourself are. They're forum trolls who read every freaking post and take every chance to try to make themselves look superior. That's not me ok, I'm just looking for a little help here and there for something I'm doing for fun, without getting insulted in the process. ARGH, I already said I wasn't going to argue this. Thanks for your uh, help already. Think I'm going to redo my signature to reflect my opinion on internet arguments ^_^ -Huh |
| 02-24-2004, 04:20 AM | #11 |
Offtopic: I'm no troll and I don't read every post, I read what interests me and what I have experience in. Also programming is not some magical easy way to make money, and not all people are as amoral to think that life resolves soley around money. As a student I don't have time to devote myself to a fulltime programming job (nor would one even hire me). I am not an expert programmer, I'm just your joe regular, with enough experience and freetime to devote to a hobby of choice. Also, even if your talent is unbearably great creative and truly out of the box thinking is so hard to come by. Thats why most of us Joe regular programmers just love open source, we see what others more inspired programmers did. I assure you that 9/10 times its inspiration which seperates your average joe programmer from his counterpart who's doing the inconcievable. Also programming is not some simple little course of study, it takes years and a full regiment of mathamatics and just plain old experiment as most of your courses are in the theory behind what your doing and they don't really explain the nitty gritties of programming. Thats for you to discover on your own. They just teach you the constructs and the learning blocks. Much like how an art course can only show you the methodology, it can't turn you into piccasso, that takes your talent and your effort into the endevour. You seem to be all for throwing insults at me, but my minute assertions against you clearly make me the flaming troll.I just love the irony. |
| 02-24-2004, 05:04 AM | #12 |
Oooookay, I'm no moderator but I read cubasis' post about how he'd like less arguements and flames. So let's just take a step back and cool down ok? I'd say the term 'Jass Crap', is somewhat insulting, but that's only cause the guy doesn't understand it, so Weaaddar, you don't need to take it so offensively, yeah his method was inefficient and he's learning. We are all learning, even if we're at different levels of learning. I'd say Huh should've been a little more polite in refusing your method but Weaaddar, you definately shouldn't have bitten back like that and just tried to be more objective. Ok so you knew his method was inefficient, it then stands to reason he... A) doesn't understand Jass B) and more importantly B, he's not ready to try and understand it yet. Small steps ok? I like this community, I hate to see when people argue, and yes I'd classify this as an arguement. Learn from starfall, and take some time to cooldown. Ok, bad joke, just trying to lighten the tension. I'm glad my way suits you Huh, but you shouldn't make accusations about Weaaddar being a Forum Troll. |
| 02-24-2004, 09:46 AM | #13 |
Back on topic: Ill have to agree with Weaaddar; the code looks kinda messy, but if one doesnt do well with JASS there's little to do. If you want to make it easier to read, though, you could do something like this: Code:
Declaration
Events
Map initialization
Conditions
Actions
Set Attribmod[1] = Hero Stat Bonus (+5 All Stats)
Set Attribmod[2] = Hero Stat Bonus (+10 All Stats)
Set Attribmod[3] = Hero Stat Bonus (+15 All Stats)
etc..And then: Code:
Add attrib
Events
Unit - A unit Learns a skill
Conditions
(Learned Hero Skill) Equal to (==) Attribute Bonus
Actions
Set attribmod_learner = (Learning Hero)
[color=red] Set attribmod_lvl = ((Level of Attribute Bonus) for attribmod_learner)[/color]
Unit - Remove Attribmod[(attribmod_lvl - 1)] from (attribmod_learner)
Unit - Add Attribmod[attribmod_lvl] to (attribmod_learner)First you remove the previous add-bonus, then you add the next one to get the extra +5 effect. Edit: Added support for multiplayer. (Note: I wrote this in a txt, so i dunno if the syntax is 100% correct, but im sure you get the point) Hope it helps. |
| 02-24-2004, 10:05 AM | #14 |
Sorry to stray off topic but can attribute bonus skill stack? can a hero have 2 skills based off of it? |
| 02-24-2004, 10:39 AM | #15 |
Yeah I know what you mean, stack them on one unit with for loops, but unfortunately no you can't stack them. Which really pisses me off sometimes, it would be so useful if you could. |
