Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
UpgradeUnitToLevel function - Want to change sequence
Author Message
mcwebtree Offline

Posts: 110
Joined: Feb 2015
Post: #1
UpgradeUnitToLevel function - Want to change sequence

Using the warchiefs upgrade script to mass upgrade defence units a a great time saver when you have a load of cry to burn, however I don't like the way it iterates through the units.

A8, B8, C8, D8, ...
A7, B7, C7, D7, ...
A6, B6, C6, D6, ...

At the moment the script upgrades the units vertically, so all the A's then all the B's then C's and so on. I want the option to either start at 8 and do A8, B8, C8, horizontally OR A1, B1, C1. otherwise I have a very lopsided defence!

I thought I'd be able to to do it in the warchiefs script, however it would appear that it only calls a function in the base game code. Which is lovely and obfuscated. I'm pretty sure this is the code in question.


function(a) { var $createHelper;
var b={k:null, v:null};
for (var d in c){

Now I think its the for loop that takes the order of positions, however I've not managed to work out what the construct is its looping around. I guess I'm going to have to write my own loop driver by position and then call the CKXZNV (UpgradeUnitToLevel) function. So I need to figure out how to iterate through the positions next.

Anyone got any useful thoughts or suggestions...

(This post was last modified: 03-02-2017 10:22 PM by mcwebtree.)
03-02-2017 10:16 PM
 Search   Quote 
D4rkv3nom Offline
<h1>Hello world</h1>

Posts: 121
Joined: Jan 2013
Post: #2
RE: UpgradeUnitToLevel function - Want to change sequence

UpgradeAllUnitsToLevel call UpgradeUnitToLevel for every unit
Only thing that UpgradeUnitToLevel function is doing is to upgrade (if the upgrade is possible) a unit to a specific level
And this method it's just a for loop to call Upgrade function for each level

You can of course get the Upgrade function name with javascript to call it directly for each unit, but the easiest thing to do is to call UpgradeUnitToLevel instead

UpgradeUnitToLevel (A, 1)
UpgradeUnitToLevel (B, 1)
UpgradeUnitToLevel (C, 1)
UpgradeUnitToLevel (A , 2)
UpgradeUnitToLevel (B, 2)
UpgradeUnitToLevel (C, 2)
(This post was last modified: 10-02-2017 12:22 AM by D4rkv3nom.)
10-02-2017 12:21 AM
 Visit this user's website   Search   Quote 

Forum Jump:

User(s) browsing this thread: 1 Guest(s)