INI files: "defend"

Really? I don´t know. You could check... or do the insanely enormous amount of individual tests conducted by Spacer One, but with ships... and if you´re not disabled yet I can do it for you...
 
Weasel Op said:
Spacer, wouldn't it be easier to ask Finn how he got it to work, and then change things and see what makes it not work?

Storm, you're never going to get the source code if you're going around killing off their pets. :p

Have you tried giving a third animation to attack 2? That shows up all the time, the DEFEND ani is pretty rare, I admit. IMS, It showed up while the unit was FORTIFIED (did you try that?) and was attacked. On round 2, lo. And behold, the bazooka appeareth...
 
... and wreaked havocke amongst the enemies of our people and partie.
 
Finn...thank you for shedding light

ok...what do you mean "round 2"??

does that mean it survived a first units attack and then was attacked by a second unit?
or
it was fortified and attacked on seperate turns??

either way I can test pretty easily...expect an edit...
 
If i were you i would just run very few, entirely selective tests, as in the unit being in a fort, or in a city that is about to be destroyed if it lost.

Even the second case will need this amount of tests:
1 (1 case of a city size 1 with less than 10 culture) times 1 (1 case of the unit being attacked-not attacking itself) times 4 (the defending unit being elite/veteran/normal/recruit; although i doubt that elite would be so ussual in such a case, but this scenario is strecthing the odds anyway) times x (x being the ratio of its remaining HP to its full HP or a standard amount of HP; here there are some variations, but i am too bored to calculate them now) times y (factor of the unit type; there is the rather unlikely case that a non-combat unit that has defend (eg a scout) can have an attack ability if it is guarding such a city). So a total of 4xy number of tests.

But, as i said, this is not at all thorough. This is just taking one very small fraction of possibilities, and using it as a testing ground. It wont prove anything if it fails, and only will if it succeeds.
You can replace y with 2, 1 case being the non-combat units that have "defend" in their ini (iirc you said that only the scout does, so that is just 1 case) and the other case being any regular combat unit you choose. X is, typically, 6 times 5 times 4 times 3 times 2 (6 being a unit that has produced a leader, five being an elite unit, 4 a veteran, 2 a recruit; if you want you can not bother with the recruit, but replace with a unit that has a -1 negative bonus;) So even a crippled x is still 720 tests, and therefore even this very specialised test requires a total amount of 720 times 4 times 2 tests: 5760.
 
In any case, in reality i personally would not have had bothered with the tests. Perhaps i would have run only a very small number (less than 100) so only a very minor case which i had reason to suspect might utilise the defend.ini.
Since hearsay says that it really was triggered, when the unit was in a fort, you should just bother with that. The tests are, again, 5760 in that case, you just place the unit in a fort and not in a city of size 1 etc.
I would not bother with terrain, since this will make the amount of tests already huge (as if 5760 is small) ;)
 
It WORKED!!!!!!!!!!!!!

gimme a day or so to work out exactly why...but a fortified unit that has been previously attacked has maybe a 1 in 20 chance of hitting the Defend...where it is fortified didnt seem to matter(I set up tests with the 10 stacks, in forts, cities, etc...around 1500 units(alot to sit through all the animations *Whew*) and I saw it happen several times...

what I have eliminated or discerned:

The unit must be fortified, and have been attacked previously...and (apparantly) must be below "full" hp...so if it has been attacked but not damaged, it didnt happen (in this test)
The first unit to attack it(the "damaged unit") in a round doesnt seem to trigger the defend, but the second and up "may"...
a units defend can trigger several times but seemingly not between the same 2 units...(so if unit a attacks and triggers the defend, it doesnt seem to play again between those 2 units...and now that I think about it, the attacking unit was always down to 1 hp and the defend either won or lost the combat...perhaps both need to be low in HP...should have payed more attention, but I was excited that it worked)
in my tests, the most I saw it was 2 times between 2 stacks(of 10 each) on the average, so Varwnos can prolly tell you what the probability is...

IT WORKS!!!!! kinda...still doesnt seem worth the unit creators making a whole animation for it (since I now know how difficult it really is)...but its an option...

I would like to thank Finn for the info, and I will keep you all up to date on further testing...

oh and Varwnos, the huge number of tests was in case the probability was say .5%...which it seems to be close to...I didnt want to say "It doesnt work" when I justs didnt give it enough chances...and again, 2 times out of a 10X10 unit combat isnt a huge probability...
 
Very good news :)

So you already know that the unit has to be:

-fortified
-lost some HP

This means that the remaining factors can only be either limited to a hardcoded probability program (as in the case with the one which actually computes the win/lose in the regular combat mode, and allows for a spearman to defeat a tank) which i think is the most probable, or it could be something that has to do with the actual HP and/or battle progression (second unit to attack an already damaged fortified unit) or a probability variator which triggers with the second unit to do so.

It cannot be said how probable it is by knowing just how many times it triggered in a series of tests, since this can vary dramamtically and the actual test does not show the mathematical result, ie if you throw a coin 100 times in a row to the floor, it might even land 100 times with its face up, but in reality the pure probability that it would do so would still be only one in two. Unlike the case with the coin, though, which is affected by physics as well (how you threw it, etc) the case with pure maths is the result of the probability itself + the probability variator when existant.
 
Another use if for an immobile fortified unit. A castle can morph into a knight for example ;)

I suspect that there is a hardcoded probablity variator here though. But the good news in such a case is that it might not be set to a very high value (unless it was really a dead project and it was left in such a value out of boredom to change it)

Did the HP/class of the attacker effect at all the trigger of the defend animation?

if i was running the test i would mostly focus on these parameters:

-relative strengh/weakness/equality of the attacker -its stats as a unit.
-HP positive or negative bonus to the defender
-Full HP of the attacker

I have to suspect (since i am Holmes) that your attacking units always had full hp? If this is the case then at least you know that either the attacking unit HAS to have full hp, or that it is most probably not a parameter at all, OR that the attacking unit has to have at least more HP than the defender.

Basically you should post some examples of when the defend.ini triggered, so a lot of probabilities can be ruled out. Atm there still are too many. :)

ps: atm i am rulling out the possibility that the programmer installed some probability variator (Z) which took into account the actual other factors of the units. If it did then it basically is impossible to calculate what that is (it could be 20 lines of equations for all one can tell). But if it was just a set variator then its existence can be seen as mostly irrelevant (in most cases).
 
Hmmm... I might just have to make a bayonet attack for the Elvaan Infantry to use in this case (basically she'll keep shooting, until the defend animation gets triggered, then stab them with her bayonet).
 
ok, to answer Varwnos...

No, the attacking unit did not always have max HP...I should give the unit blitz to test that...but if it had attacked the turn before, and won, it wouldnt always have max HP when the defend triggered...

after another round of 200 tests...what I can definatly say is:

the attacker always had more HP than the "defend using" unit...
the defender always had lost HP before defend was triggered...
the defender was always fortified for a turn before the defend triggered...
the defend never triggered on the initial combat round...

the situation that triggered it was:
2 stacks of 10 units all of them 1/1...the "AI" attacks a full stack of 10 units(killing several of the units, but leaving some "damaged"...several AI units are damaged, or killed, but not all)...as the player, I fortify all of the remaining units(usually between 4-8 units survive) and end turn...the AI attacks with most(but not all...maybe I should also turn up AI hostility) of its units(again between 4-8 that survive) and I saw the defend once or twice in each stack of 10(a total of 11 times in the total test...and 4 of the times AI had full HP...7 times at 2 hp...and never at 1 hp)
 
This discovery, now that it has been confirmed, should be put up on the front page! This is pretty much the biggest discovery since the whole cracked editor teleport thing...

I know for certain that it will be taken advantage of in some of my upcoming units as well as re-makes of older units.......
 
Not front page yet(please)...lemme narrow down the reasons why it happens for a day or two first...but I agree...New animation is front page news...

also, I believe that Finn should get credit(maybe I am supporting cast?) for the discovery...I mean it was his, even if I did all the work...

BTW...would someone with vanilla or PTW(not conquests) test this as well, now that Ive narrowed the parameters...? it would be nice to know if it is in all 3...

just set up 2 stacks of 10(I forgot, it never happens with Barbs attacking, that Ive seen...or when attacking barbs either)...fortify all the "player units" and let the AI attack...when it is your turn again, just end turn(no moves by player)...thats how I got it to happen...

also, I would like to mention that the use of the word "test" is wrong...these are experiments...as there is no "Hypothesis" to "test"...

And Hikaro, as I mentioned, it is not common, and you should only remake(if you are gonna anyway) specifically "defence" types(spear/pike/musket/rifle/Infantry/Mech Infantry etc...) since they are the only units in a "normal" game that have a shot of using it(must be fortified 2 turns it seems)...or immobile units(like a new animation for the "city" units like Atlantis)

also, Im gonna run some Naval tests next to see if boats get this too(Orthanc will need to know...as well as Aaglo/Wyrm/Riptide/others I forget off the top of my head..heck maybe Bhita can be convinced since we found "New stuff")

3rd edit...lol...I would like to see mech units, have men/people jump out and shoot or something for defend...neato...but I still think its alot of work for an animation that "rarely" plays and only under very strict situations...because the strongest unit in a stack defends, so full HP units jump to the front
 
I was going to make a "Defend" animation for the FF mod king units, based on that charachter's Limit Break or some other special attack (especially since King units in my mod will not be flagged as kings, but will have the defensive flag under the AI strategies)

I primarily was going to limit it to defensive and offensive/defensive units (like airships)
 
Oh neat idea...a limit break would trigger instead of a "defend" style animation...

Im glad I could help make the FF mod better...the defend animation is perfect for that use (based on when Ive seen it work)

also, Ive gotten 2 Pms already that people arent seeing it "In Game"...be it known that I had 20 stacks of 10X10 opposing units(400 units total) and saw it 11 times...you do the math...and like Varwnos said, mayb e your coin always landed tails up...its not a guarantee...keep playing, maybe you'll see it maybe you wont...11 out of 200 is a low chance(like 5% right?)
 
Yeah, 1 in 20 odds, or 5%... Still, I find it interesting that one of the "unused" (by the stock units anyways) INI slots actually DOES work, even if only 1/20 of the time.....
 
indeed...makes me wonder what else "works"...but Im seriously lagged out from the testing of defend, and not willing to test others at this time...but I may just stack a unit full of flcs and hope....

and if it works, why wasnt it used by firaxis?? lazy programers?...
 
Back
Top Bottom