• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Save Codes and Hero Skills

Status
Not open for further replies.
Level 2
Joined
Dec 14, 2008
Messages
21
Firstly, I am VERY sorry if I missed this in the forums, I did use the search function several times (and googled it too) and didn't find anything.


Introduction (skip if you hate reading):

So I am still working on Poplicant (an ORPG) but it's nearing completion and all I have left to do is add in leader boards and save codes (the jokes on the "all I have to do" part, but considering I've been working on it for 2 years it seems like not much to me lol). So I looked around for a good system and I didn't like most of the ones I saw so I started my own. Everything was going fine, the xp, the hero type, the items, BUT THEN!!!


How do you automate saving hero skills (abilities) in to variables?


The reason I ask is I have a whopping 120 different hero abilities that I would have to write manually and I'd rather avoid that, and avoid having to add in all the extra code every time I add a new hero. I mean, the only way I can find in the trigger editor to detect hero skills specifically is when you learn it manually, which is fine except there is no way to make the computer automatically learn a random ability so you can detect it. The only other thing is the casting an ability one for all types of abilities, but once again making the computer make a hero cast their abilities is problematic, not to mention how it could detect passives :/

As an example of what I'm talking about I will explain my hero type automation. Having 30 different heroes (will 15 with 2 different 'Tiers' of advancement) I was loathe to write all that out manually so instead what I do is I placed all 30 heroes in the map. In the map initialization the computer picks each unit using the unit group action and then assigns it a number which can then be used to store in a save code. The computer picks the units in the exact same order every time so it works just fine.

Does any one know any simple way to automate the assignment of hero skills? Otherwise I'm going to have to sit down and do it for each of my 120 different abilities manually :(

Thanks in advance for ANY help OR advice, much love:

Ihatehumans :)
 
Last edited:
Level 21
Joined
Aug 21, 2005
Messages
3,699
So is your problem: how to save and load abilities in a savecode?

If it is, I still have a few questions:
- are you using jass or gui, and what's the basic idea behind the system? (i.e. how do you store stuff)
- are the abilities multi-level or do they only have 1 level?
- are all 120 abilities available to each hero or does every hero only have 4 abilities?
 
Level 2
Joined
Dec 14, 2008
Messages
21
I am using GUI but am not averse to Jass or custom script, just as long as it works. I am very fluent in GUI but my Jass skills are VERY basic (I know Java and I have read some Jass guides but haven't really programmed in it).

There are 30 different heroes.

Each hero has four different abilities that are (almost) exclusively available to that hero (about 5/6 abilities are quasi-shared so if needed I can split them).

120 abilities all up :)

They are hero abilities with 5 levels, and 4 levels for the ultimate (each one of the 30 heroes has one ultimate).

Basically I'm looking for some way (even Jass) to automatically store a whole bunch of hero skills in variables and then use those variables to save/load the level of the hero skills on heroes... if that makes sense lol.

Which brings me to another question: Is there any other way to set a hero skill level other than the learn hero skill (or Jass equiv.)?



P.S. I'm about half way through doing it the long way but would prefer to implement ANY shorter way if/when possible for future addition of heroes/abilities :)

P.P.S. I'm using NewGen WE that Hive recommends so I have all the Jass helpers etc.
 
Level 7
Joined
Jul 20, 2008
Messages
377
You could try directly saving the ability ID (it's an integer) and converting it into a save code using some kind of hash method that may also include the ability level.
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
If a hero is limited to a set of 4 abilities, you could check what type the hero is so you know what 4 abilities you'll need to store. When you know the 4 abilities you need to store, you simply store their levels...

e.g.

  • If (all conditions are true) then ...
    • If - Conditions
      • Unit-type of (your hero) equal to "Paladin"
    • Then - Actions
      • set abil_1 = level of (Holy light) on (your hero)
      • set abil_2 = level of (Divine shield) on (your hero)
      • etc.
    • Else // for other heroes
  • Store abil_1, abil_2 etc. with your save/load code
  • When loading your hero, you do the same: you load your hero-id, your abil_1, abil_2 etc.
  • Based on your hero-id you know that abil_1 contains the level of Holy light
 
Level 2
Joined
Dec 14, 2008
Messages
21
You could try directly saving the ability ID (it's an integer) and converting it into a save code using some kind of hash method that may also include the ability level.

And, um, exactly how would that be done lol?


And @Eleandor: That is the 'long' method, since I have to manually add in all 30 heroes and each of their 4 abilities meaning at least 120 lines, twice. I have started with a method similar to that and I'm about 1/2 way through but I'd prefer a shorter method :)
 
Level 4
Joined
Dec 10, 2005
Messages
73
I don't think there is a faster way than the method suggested by Eleandor. I can't find a way to directly check what hero has what abilities (this would be be the short method you wanted), therefore you need to store this information into variables.

Also you can't make the hero learn abilities through automatic abilities saving codes. Not through GUI anyways.
 
Level 2
Joined
Dec 14, 2008
Messages
21
It's ok, I've done it all now, save codes working 100%

I have used only numbers and its 23 numbers long and I haven't done any encrypting (ie. it's more like a hero creator than a save code) but considering the game is still in alpha I think that's fine.

Even when it hits beta testing I will probably leave it like that for easier play. When it goes to official release I will make save codes alpha-numeric and encrypted, hopefully dropping it down to more like 15 characters long and VERY hard to crack.
 
Status
Not open for further replies.
Top