View Full Version : Temp Combat Promo & Removing Unit XP
Darkhour Mar 16, 2006, 01:54 AM Okay dudes... I'm roughly hacking and slashing together python script mostly from other peoples mods etc.. thanks to everyone thats helped me out!.. :)
I've got 2 questions for people. I want to know if anyone can help me out with some code;
1. To subtract XP from a unit after combat if the loser withdraws.
and
2. To temporarily nullify an enemy unit's promotion during combat.. ie Flanking (withdrawal).
Cheers :goodjob:
Darkhour Mar 19, 2006, 10:39 PM Ack gone for the weekend and no-one has replied?!..:(
Somone?
TheLopez Mar 19, 2006, 11:49 PM 1) Its not possible to tell if a unit has withdrawn from combat, from what I can tell.
2) Its not possible to interact with units during combat, only after combat. Sorry.
Zuul Mar 20, 2006, 04:47 AM Why not edit the xml so you wont gain any xp?
Kael Mar 20, 2006, 05:13 AM Okay dudes... I'm roughly hacking and slashing together python script mostly from other peoples mods etc.. thanks to everyone thats helped me out!.. :)
I've got 2 questions for people. I want to know if anyone can help me out with some code;
1. To subtract XP from a unit after combat if the loser withdraws.
A check in onCombatResult to see if the losers damage is less than 100 might allow you to trap on this.
and
2. To temporarily nullify an enemy unit's promotion during combat.. ie Flanking (withdrawal).
Cheers :goodjob:
This will probably take the SDK. I wish we had a precombat python function.
The Great Apple Mar 20, 2006, 05:46 AM A check in onCombatResult to see if the losers damage is less than 100 might allow you to trap on this.
Alternatively, and slightly simpler, you could just check if the loser is alive.
TheLopez Mar 20, 2006, 05:59 AM I think you're right TGA, that should work.
Belizan Mar 20, 2006, 03:13 PM 1) Its not possible to tell if a unit has withdrawn from combat, from what I can tell.
2) Its not possible to interact with units during combat, only after combat. Sorry.
If you get a combat result, and the loser is alive, I think it's safe to assume one of the two withdrew from combat. I haven't tested, but I'm willing to bet that it is even demonstrable which one did the withdrawing.
Belizan Mar 20, 2006, 03:15 PM *sigh* I should really read all the posts before responding :(.
As for temporarily removing the promotion, that requires foreknowledge of the conditions. As Kael said, you can't trap combat before it is resolved, but if you can determine the conditions required to invalidate the promotion before the combat, say when the unit moves, or at the start of the turn, etc., then you can do it.
Teg_Navanis Mar 20, 2006, 04:10 PM From what I know (first-hand experience with Unit Statistics), onCombatResult is not called when the attacker retreats.
TheLopez Mar 20, 2006, 04:18 PM That's what I thought too.
Belizan Mar 20, 2006, 04:37 PM I thought I tested this, and found that it was. It's been a long time, however, so, really, as with all such things, you should go test it yourself.
Darkhour Mar 21, 2006, 12:14 AM Okay well I take it that you would require if loser is alive on combat result then change experience -x?
Cool... well I didn't think about the precombat aspect of it BUT couldn't you do a similar check as the above and see whether the loser is alive (withdrawn) and then kill unit if the unit has the relevant promotion?
Belizan Mar 21, 2006, 02:10 AM Okay well I take it that you would require if loser is alive on combat result then change experience -x?
Cool... well I didn't think about the precombat aspect of it BUT couldn't you do a similar check as the above and see whether the loser is alive (withdrawn) and then kill unit if the unit has the relevant promotion?
Assuming that was the only effect you wanted, yes. Although understand that that means the "retreater" never got his last series of exchanges with the "winner". It could well be that he would have won, had he stood his ground. But first, you should make some high withdrawal units and experiment with the behaviour exhibited in game.
Darkhour Mar 21, 2006, 03:50 AM Assuming that was the only effect you wanted, yes. Although understand that that means the "retreater" never got his last series of exchanges with the "winner". It could well be that he would have won, had he stood his ground. But first, you should make some high withdrawal units and experiment with the behaviour exhibited in game.
I thought that withdrawing only occured in combat if the loser was reduced to less than 0 HP?..
Belizan Mar 21, 2006, 04:41 AM I thought that withdrawing only occured in combat if the loser was reduced to less than 0 HP?..
That is not my understanding 8). I believe he gets a chance to retreat when he hits 10% damage? Something like that.
Kael Mar 21, 2006, 05:55 AM From what I know (first-hand experience with Unit Statistics), onCombatResult is not called when the attacker retreats.
You're right. It's only called when the attacker or defender is dead.
While looking though I did notice that it applies "Experience from Withdrawl" to the attacker during a withdrawal. If this was a negative number you might accomplish the effect ou are looking for. Not sure what negative xp would do to you.
Kael Mar 21, 2006, 05:57 AM That is not my understanding 8). I believe he gets a chance to retreat when he hits 10% damage? Something like that.
Withdrawal has its chance of happening when the damage the opponent is capable of doing is equal to or greater than the amount of hit points the attacker has left.
Belizan Mar 21, 2006, 06:13 AM Withdrawal has its chance of happening when the damage the opponent is capable of doing is equal to or greater than the amount of hit points the attacker has left.
That makes sense.
Darkhour Feb 26, 2008, 08:27 AM Hi there.. long time between drinks and I thought I'd revisit Civ 4 and find out if anyone has made any progress on any mods etc.. towards this idea? :)
Teg_Navanis Feb 26, 2008, 10:55 AM Phew, old post :)
The SDK (actually the C++ source code of the game) has been out for quite some time (it came out shortly after this discussion) and made the changes you asked for possible. I haven't heard of anyone implementing the changes you suggested, but there are some heavily modified combat systems out there.
Darkhour Feb 27, 2008, 05:14 PM Cheers Ted!.. I'll take a look at some of the combat systems although I dont want to modify the existing system too far, I changed it fairly simply and radically a while ago and it seemed to work well. just thought these options would provide a more rounded system.. :)
|
|