View Full Version : Cloaking Device Modmod
TC01 Aug 07, 2009, 07:54 PM Cloaking Devices 1.2 for Star Trek 2.37 (Now included in 3.0!)
This is a now defunct modmod which expands cloaking devices- by giving you the ability to cloak and decloak your ships. It is defunct because deanej has merged it with the main Star Trek mod and is now standard as of 3.0.
Therefore, the download has been removed, so as not to confuse people. If you want the source code... (the original source code), please either post that in this thread or PM me.
Otherwise, this thread can be used for discussion about Cloaking Devices, as set up in 3.0.
Original Description:
This has been implemented as a python action button (without adding a new mission or command to the SDK). It has been added to all ST scenarios that feature cloaking devices as of the current version, v1.2. There is also AI scripting to make the AI cloak and decloak. It's still being worked on and is extremely basic, but it works. Thanks to apenpaap for the core idea of how it works.
As of v1.2, there is a sound effect triggered on when you cloak and decloak a unit.
Features:
-Cloaking Device Promotion now enables use of the "Cloak" button.
-This button provides the "Cloaked" promotion, which makes the unit invisible.
-It can be removed by pressing the "Decloak" button (which you will only see after your unit has cloaked)
-There is a flat movement cost (1 mp) to cloaking to try and limit the exploitability of this.
-AI scripting that causes the AI to decloak units in solar systems and cloak units outside solar systems.
-New in v1.2, a sound effect triggered when you press the Cloak and Decloak buttons (Cloak On and Cloak Off)
Download removed, due to the mod's integration in 3.0 (and the fixing of several Cloaking Devices bugs in 3.25).
Changelog:
v1.2 Changelog:
-Added audio effect when cloak or decloak occurs
-Added Cloaks to all remaining Star Trek scenarios
-Fixed bug in ST Galaxy cloaking
v1.1 Changelog:
-Added Cloaks to ST 2.0 scenarios (Millennium, Galaxy, Lost Era)
-Fixed bug where ships start with wrong cloaking promotion
-Made cloaked ships unable to attack (have 0 strength)
-Added AI scripting to make the AI cloak and decloak units
To Install:
1. Unzip the files to a temporary directory (such as Temp/Cloaking Devices... this is defaulted).
2. Copy the Mods folder into your Civilization IV\Beyond the Sword directory (or wherever you installed BTS). This will overwrite the following files in all Star Trek directories SAVE Voyager and Xindi Attack.
-Units.xml (changed in all)
-CIV4PromotionInfos.xml (changed in all)
-CIV4UnitInfos.xml (changed in all save TOS, Millennium, Lost Era).
-CvGameUtils.py (changed in all)
-CvMainInterface.py (changed in all)
-CvFinalFrontierEvents.py (changed in all)
-Audio2DScripts.xml (changed in DS9)
-AudioDefines.xml (changed in DS9)
If you have made changes to any of said files, please back them up or manually copy the code over. All changes are marked with "Cloaking Devices"
3. To test, start a game in any Star Trek scenario, go into Worldbuilder, give yourself a unit with the Cloaking Device promotion. You should have a "Cloak" button you can press (at the end of the movement, kill, sleep, etc. mission buttons). Upon pressing it, you should gain Cloaked, loose 1 movement point, and gain the "Decloak" button where the "Cloak" button was. (Both buttons are identical graphically, mouse-over it to check)
Credits:
TC01 for making the module/modcomp.
deanej for making the Star Trek Mod
The_J for helping me figure out how to make the button display text
apenpaap for suggesting how the AI scripting should work
Whoever made the Cloak button (may have been deanej or Jaydn or someone else...)
Jon Shafer for creating Final Frontier.
Firaxis/2K Games (makers of Civ 4)
Paramount/Viacom (makers of Star Trek)
JEELEN Aug 07, 2009, 10:43 PM Excellent! IMO this should be added as a standard feature for the races with Cloak ships.:goodjob:
deanej Aug 08, 2009, 03:08 PM I would, but the AI is probably oblivious (unless it's been coded to use it; then again, the AI probably doesn't do much with cloaking now). Is there a way to make it so that units can't engage in combat or pillage while cloaked (except when using a particular unit perhaps? My origional idea for the klingon uu was to be able to fire while cloaked).
TC01 Aug 08, 2009, 03:48 PM I would, but the AI is probably oblivious (unless it's been coded to use it; then again, the AI probably doesn't do much with cloaking now). Is there a way to make it so that units can't engage in combat or pillage while cloaked (except when using a particular unit perhaps? My origional idea for the klingon uu was to be able to fire while cloaked).
Well, we were talking about how to make the AI use a python action button in the tutorial I just made:
The easiest way, I think, is to make what you want to do a triggered function somewhere, triggered from the handleInput() code normally.
Then whenever your condition in onUnitMove is satisfied (they are on a tile in their territory without any resources, perhaps?) have the function be triggered and do the effect of pressing the button, without actually pressing the button.
(This was my example in the tutorial, a prospect ability that randomly gave a resource-less plot a resource.)
So the scripting for this would be really really complicated. You'd have to define conditions for the AI to cloak and recloak. Perhaps if they have ships with cloaking devices they should auto-cloak, and if they're in range of an enemy unit they can defeat they should decloak, attack, and recloak? (provided movement points work)
As to preventing use of attacking while cloaking, the easiest way is to set the unit's combat strength to 0 when it has the Cloaked promotion (symbolizing how a cloaked ship cannot use weapons or shields). Doesn't seem to prevent pillaging, but there is a tag in the Unit Infos,
<bPillage>0</bPillage>
that could be cloned into PromotionInfos, perhaps.
deanej Aug 08, 2009, 03:58 PM Come to think of it, the AI probably doesn't cloak units now (has anyone ever seen them do this?). Their handling of them now is poor at best so it might be better that they not use it. I could clone bOnlyDefensive to the promos to prevent attacking. I'll have to look at it to see how it does the cloaking - maybe I'll be able to make a special version for the Klingon UU (as I'm thinking of having starts with cloaking device as a civ trait).
EDIT: one other question: how do you make it so that units can only get the cloaked promo is the player uses the button?
TC01 Aug 08, 2009, 04:34 PM EDIT: one other question: how do you make it so that units can only get the cloaked promo is the player uses the button?
My tutorial on how to do this is here (http://forums.civfanatics.com/showthread.php?t=331001) (it's also in my sig), and both changes of how I did it are labeled "Cloaking Devices -- TC01" or somesuch in CvMainInterface.py of the download.
But generally what I did was made one button set the unit to have the Cloaked promotion, and have the other remove the promotion. The buttons only appear to a unit with the Cloaking Device promotion (which is given as usual).
apenpaap Aug 08, 2009, 05:39 PM Maybe a good way to teach the A.I. how to use it would be to simply tell them to cloak units in space, and uncloak them in solar systems. Like that, they could use it, but still defend.
deanej Aug 08, 2009, 09:36 PM My tutorial on how to do this is here (http://forums.civfanatics.com/showthread.php?t=331001) (it's also in my sig), and both changes of how I did it are labeled "Cloaking Devices -- TC01" or somesuch in CvMainInterface.py of the download.
But generally what I did was made one button set the unit to have the Cloaked promotion, and have the other remove the promotion. The buttons only appear to a unit with the Cloaking Device promotion (which is given as usual).
What I ment was, how do you prevent units from getting the cloaked promo by normal means (experience) when the player has researched the cloaking device technology? It doesn't look like there's anything to disable it.
TC01 Aug 09, 2009, 08:01 AM Well, what I did was set the <UnitCombat> tag to have no attached UnitCombats, which should prevent any unit from being able to purchase the promotion... this should work? If it doesn't, I can tie this into Future Tech.
I realize that I forgot to change units who started with PROMOTION_CLOAK to start with PROMOTION_CLOAKING_DEVICE. This will be fixed in the future.
deanej Aug 09, 2009, 12:50 PM Duh. I forgot to look at that.:blush:
TC01 Aug 13, 2009, 07:28 PM I've updated this modmod to v1.1. It adds cloaks to three additional scenarios, the 2.0mod/scenarios (Galaxy, Lost Era, and Millennium), prevents you from attacking while cloaked by making your ship have 0 combat strength when it is cloaked, and adds some basic AI scripting as apenpaap described:
Maybe a good way to teach the A.I. how to use it would be to simply tell them to cloak units in space, and uncloak them in solar systems. Like that, they could use it, but still defend.
I think in the future I'm going to make the Klingon UU have a seperate promotion that acts the same way, but doesn't remove the combat strength. I also want to make the AI decloak if they're in the movement range of another unit that is capable of seeing cloaked ships (if they can see it, anyway), and decloak if they are within movement range of a unit they could defeat in combat.
And, of course, update the mod to all other Star Trek scenarios.
deanej Aug 13, 2009, 08:05 PM Have you tested the combat change? I think the way you have it will work fine, but I'm not an expert on how combat works (iCombatPercent is the only modifier that applies directly to the unit at all times - with everything else applying to the defender, I think the only interference will be from combat promotions, as the percents may add instead of multiply). For 3.0 I plan to clone bOnlyDefensive to the promotions.
TC01 Aug 13, 2009, 08:19 PM Have you tested the combat change? I think the way you have it will work fine, but I'm not an expert on how combat works (iCombatPercent is the only modifier that applies directly to the unit at all times - with everything else applying to the defender, I think the only interference will be from combat promotions, as the percents may add instead of multiply). For 3.0 I plan to clone bOnlyDefensive to the promotions.
I thought it would work too. But after a few tests it seems like it might not be working... the promotion is definitely giving minus 100% strength, but it doesn't seem to be stopping me from attacking and destroying a 1 strength shuttle with my 5-strength cloaked Prometheus (this was done in Millennium since my Star Trek mod has Wormholes installed and I haven't made the two modcomps compatible) with 99.99% odds. Which shouldn't be happening. But, same cloaked Prometheus (well, a different one, but I did the same thing) has 0.19% odds against a fellow Prometheus that I gave to the barbarians.
Not sure what is happening.
deanej Aug 13, 2009, 09:02 PM Odd stuff seems to happen with the percentages. For example: probes are strength 1 (so they can auto-explore) but have -1000% space defense (and can't attack). They still win a against early barbs.
GASherbert Aug 13, 2009, 10:38 PM The first few barbarian fights are free victories, if I remember correctly. And if the probe is in an asteroid field, I don't believe it suffers from the -1000%.
TC01 Aug 20, 2009, 06:53 PM In my testing trying to get a script that makes the AI decloak a unit right next to another unit, attack, and then recloak, I discovered it can still bombard while cloaked (obviously, I hadn't eliminated it).
This might be something else to disable, except I have no idea how. Would simply setting <iBombardRateChange> to -100 fix the issue for the cloaked promotion?
TC01 Aug 26, 2009, 08:26 PM Released v1.2, probably the final version. Changelog below:
-Added audio effect when cloak or decloak occurs
-Added Cloaks to all remaining Star Trek scenarios
-Fixed bug in ST Galaxy cloaking
I think that "ranged attack" while cloaked is the easiest way to represent units decloaking, attacking, and then cloaking, so it doesn't have to be removed.
Pablod Sep 20, 2009, 05:55 PM where is the sound of the device
is nothing without it
TC01 Sep 20, 2009, 06:04 PM where is the sound of the device
is nothing without it
You don't get a sound effect when using the cloak?
I suggest re-downloading and re-installing v1.2, since that version contains the sound effect (or, rather, the code that triggers the sound effect). My test shows that it works fine.
Anyone else having this issue?
Pablod Sep 25, 2009, 10:43 PM still no sound
promotion show AS2D sound on
but nothing there is not such sound
in sound folder
TC01 Sep 26, 2009, 03:53 PM still no sound
promotion show AS2D sound on
but nothing there is not such sound
in sound folder
There should be a sound AS2D_CLOAK_ON in the Audio 2D scripts file in Assets\XML\Audio. Please go into that file and see if you find this sound effect (and the AS2D_CLOAK_OFF) sound.
Most sounds are not in the Sounds folder of Star Trek\Assets\Sounds, but rather they are in the Sounds folder in CustomAssets\Sounds.
Pablod Sep 27, 2009, 08:55 AM yes is in every star trek mod {xml}"AS2D error""AS2d ON""AS2d OFF"
no in costum asset do
i have nothing in costum asset
that the problem i got it now
thanks
TC01 Sep 27, 2009, 10:04 AM So, to be perfectly clear... when you go into Assets\XML\Audio2DScripts.xml, the second and third entries are this?
<Script2DSound>
<ScriptID>AS2D_CLOAK_ON</ScriptID>
<SoundID>SND_CLOAK_ON</SoundID>
<SoundType>GAME_MUSIC</SoundType>
<iMinVolume>80</iMinVolume>
<iMaxVolume>80</iMaxVolume>
<iPitchChangeDown>0</iPitchChangeDown>
<iPitchChangeUp>0</iPitchChangeUp>
<iMinLeftPan>-1</iMinLeftPan>
<iMaxLeftPan>-1</iMaxLeftPan>
<iMinRightPan>-1</iMinRightPan>
<iMaxRightPan>-1</iMaxRightPan>
<bLooping>0</bLooping>
<iMinTimeDelay>0</iMinTimeDelay>
<iMaxTimeDelay>0</iMaxTimeDelay>
<bTaperForSoundtracks>0</bTaperForSoundtracks>
<iLengthOfSound>0</iLengthOfSound>
<fMinDryLevel>1.0</fMinDryLevel>
<fMaxDryLevel>1.0</fMaxDryLevel>
<fMinWetLevel>0.0</fMinWetLevel>
<fMaxWetLevel>0.0</fMaxWetLevel>
<iNotPlayPercent>0</iNotPlayPercent>
</Script2DSound>
<Script2DSound>
<ScriptID>AS2D_CLOAK_OFF</ScriptID>
<SoundID>SND_CLOAK_OFF</SoundID>
<SoundType>GAME_MUSIC</SoundType>
<iMinVolume>80</iMinVolume>
<iMaxVolume>80</iMaxVolume>
<iPitchChangeDown>0</iPitchChangeDown>
<iPitchChangeUp>0</iPitchChangeUp>
<iMinLeftPan>-1</iMinLeftPan>
<iMaxLeftPan>-1</iMaxLeftPan>
<iMinRightPan>-1</iMinRightPan>
<iMaxRightPan>-1</iMaxRightPan>
<bLooping>0</bLooping>
<iMinTimeDelay>0</iMinTimeDelay>
<iMaxTimeDelay>0</iMaxTimeDelay>
<bTaperForSoundtracks>0</bTaperForSoundtracks>
<iLengthOfSound>0</iLengthOfSound>
<fMinDryLevel>1.0</fMinDryLevel>
<fMaxDryLevel>1.0</fMaxDryLevel>
<fMinWetLevel>0.0</fMinWetLevel>
<fMaxWetLevel>0.0</fMaxWetLevel>
<iNotPlayPercent>0</iNotPlayPercent>
</Script2DSound>
And when you go into AudioDefines.xml, located in the same folder, the second and third entries are this?
<SoundData>
<SoundID>SND_CLOAK_ON</SoundID>
<Filename>Sounds/CloakOn</Filename>
<LoadType>DYNAMIC_RES</LoadType>
<bIsCompressed>1</bIsCompressed>
<bInGeneric>1</bInGeneric>
</SoundData>
<SoundData>
<SoundID>SND_CLOAK_OFF</SoundID>
<Filename>Sounds/CloakOff</Filename>
<LoadType>DYNAMIC_RES</LoadType>
<bIsCompressed>1</bIsCompressed>
<bInGeneric>1</bInGeneric>
</SoundData>
However, in your My Games\Beyond the Sword\CustomAssets\Sounds folder, you do not have a CloakOn.wav and a CloakOff.wav file?
Did you install the mod correctly? Step 3, from the readme, is: "Copy the "Art" and "Sounds" folders to My Games\Beyond the Sword\customAssets." Inside the Sounds folder there should be CloakOn.wav, CloakOff.wav, TechDing.mp3, along with several folders...
Pablod Sep 27, 2009, 10:53 AM yes when i install 3.19 it deleted my costum assets
deanej Nov 01, 2009, 04:42 PM I've merged this into 3.0 (with the exception of the AI stuff) with my modifications (the buttons are available to any unit when the cloaking device tech is researched) and it works fine (with the exception of an attribute clone on my end, which doesn't concern any of your code), but I want to change it to give a different promotion (without the attack penalty) for a couple of specific units (the klingon and romulan UUs). Do you have any idea of how I could do this? I'm not familiar enough with actions buttons to make the change.
PS: How are the intended changes to the worldbuilder modmod going?
TC01 Nov 02, 2009, 06:36 AM I've merged this into 3.0 (with the exception of the AI stuff) with my modifications (the buttons are available to any unit when the cloaking device tech is researched) and it works fine (with the exception of an attribute clone on my end, which doesn't concern any of your code), but I want to change it to give a different promotion (without the attack penalty) for a couple of specific units (the klingon and romulan UUs). Do you have any idea of how I could do this? I'm not familiar enough with actions buttons to make the change.
PS: How are the intended changes to the worldbuilder modmod going?
The promotions are applied in handleInput, located in CvMainInterface.py. After my changes to it below, there's some Final Frontier specific code for the city screen
# Will handle the input for this screen...
def handleInput (self, inputClass):
# PROTO
print("\n\n\ngetNotifyCode: %s" %(inputClass.getNotifyCode()))
print("getData: %s" %(inputClass.getData()))
print("getFlags: %s" %(inputClass.getFlags()))
print("getID: %s" %(inputClass.getID()))
print("getFunctionName: %s" %(inputClass.getFunctionName()))
print("getButtonType: %s" %(inputClass.getButtonType()))
print("getData1: %s" %(inputClass.getData1()))
print("getData2: %s" %(inputClass.getData2()))
print("getOption: %s" %(inputClass.getOption()))
print("isShiftKeyDown: %s" %(inputClass.isShiftKeyDown()))
print("isCtrlKeyDown: %s" %(inputClass.isCtrlKeyDown()))
#Added in Cloaking Devices -- TC01
if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 660 and inputClass.getData2() == 660):
self.iPushedButtonUnit = g_pSelectedUnit
self.iPushedButtonUnit.setHasPromotion(gc.getInfoT ypeForString('PROMOTION_CLOAK'), true)
g_pSelectedUnit.changeMoves(60)
CyAudioGame().Play2DSound('AS2D_CLOAK_ON')
if (inputClass.getNotifyCode() == 11 and inputClass.getData1() == 661 and inputClass.getData2() == 661):
self.iPushedButtonUnit = g_pSelectedUnit
self.iPushedButtonUnit.setHasPromotion(gc.getInfoT ypeForString('PROMOTION_CLOAK'), false)
g_pSelectedUnit.changeMoves(60)
CyAudioGame().Play2DSound('AS2D_CLOAK_OFF')
#End of Cloaking Device code -- TC01
You could add an if statement to get the unit's civilization, and add a different promotion depending on which civilization it was, like this bit of code for the decloak button:
if self.iPushedButtonUnit.getOwner() == gc.getInfoTypeForString('CIVILIZATION_ROMULAN') or self.iPushedButtonUnit.getOwner() == gc.getInfoTypeForString('CIVILIZATION_KLINGON')):
self.iPushedButtonUnit.setHasPromotion(gc.getInfoT ypeForString('PROMOTION_CLOAK_2'), false)
else:
self.iPushedButtonUnit.setHasPromotion(gc.getInfoT ypeForString('PROMOTION_CLOAK'), false)
I haven't had much free time to mod, and so haven't made much progress with the worldbuilder. But this week I should have some more time, and that's one of several projects I intend to work on.
deanej Nov 02, 2009, 04:32 PM Managed to get it with a couple if statements. Thanks! Look forward to seeing the worldbuilder changes (I finally have enough time to work on the mod properly again, so I'm getting "the fundamentals" in before working on the new civs, wonders, and traits).
This new way of working with cloaking should hopefully change the dynamic with regards to the Klingon and Romulan UUs and make them more interesting.
JEELEN Nov 06, 2009, 02:53 PM I reckon so - not too mention it's both much more Trek-like and more fun to be able to turn Cloak on/off! :thumbsup:
TC01 Nov 12, 2009, 04:51 PM Since you're no longer using the promotion, how have you restricted cloaking to specific units? By specifying units that you want to be able to cloak in CvMainInterface.py (where I had the promotion check?)
If you haven't done so already, it might be nice to add a bCloak tag (or something like that) to CIV4UnitInfos.xml, and then have bCloak do nothing but be used here, so you could say "if pUnit.isCloak()" instead of individually checking units. That would help make things more modder-friendly- all they have to do is set bCloak to 1 in CIV4UnitInfos to make a unit able to cloak.
Also, I just released v1.0 of the Worldbuilder utility. I don't think there's anything else I need to do for that, except possibly fix some bugs...
deanej Nov 13, 2009, 10:36 PM I'm adding a bNoCloaking tag and will restrict some units (including possibly the Borg as it would be an interesting trade-off, no cloaking but powerful ships and an assimilation ability, but it's subject to forum review) but I'm having SDK issues again...:wallbash: When will I be able to add something to the SDK on my own without issues?
JareshInyo Jan 09, 2010, 11:25 AM I installed cloaking devices version 1.2 and I can conquer star systems while cloaked or uncloaked. However, if my unit decloaks, he cannot conquer cities or be seen by barbarians anymore, from that point forward. ???
deanej Jan 09, 2010, 12:40 PM Are you sure you don't mean when the unit cloaks? A cloaked unit is invisible (like a submarine in base BtS, except without destroyers). Invisible units cannot capture cities or defend unless another unit sees them.
JareshInyo Jan 11, 2010, 05:11 PM No. I conducted a few tests via the World builder. When my ship was newly created with the cloaking device promotion, I could then attack normally, or cloak, and still attack normally. But after that, if I decloak or cloak again at all for the rest of the game, I cannot conquer star systems. It is as though I am not actually decloaking.
zoommooz Feb 19, 2010, 06:47 AM Have you tested the combat change? I think the way you have it will work fine, but I'm not an expert on how combat works (iCombatPercent is the only modifier that applies directly to the unit at all times - with everything else applying to the defender, I think the only interference will be from combat promotions, as the percents may add instead of multiply). For 3.0 I plan to clone bOnlyDefensive to the promotions.
I thought it would work too. But after a few tests it seems like it might not be working... the promotion is definitely giving minus 100% strength, but it doesn't seem to be stopping me from attacking and destroying a 1 strength shuttle with my 5-strength cloaked Prometheus (this was done in Millennium since my Star Trek mod has Wormholes installed and I haven't made the two modcomps compatible) with 99.99% odds. Which shouldn't be happening. But, same cloaked Prometheus (well, a different one, but I did the same thing) has 0.19% odds against a fellow Prometheus that I gave to the barbarians.
Not sure what is happening.
When the iCombat is a negative number, it works by the following equation, where to find the modified strenghth you: -100% = x/2, where x is the initial strenghth vaule. Consequently, -200% = x/4 and so forth. As you can see, no matter what you set this iCombat to, a unit will still be able to attack (in terms of being allowed, as their strenghth value will never be zero using this method. If you want a 'practical' zero a -10000% iCombat basically makes any unit useless in combat (Such a large number is need, due to the fact that a borg tataical cube 2, for instance, start with such a high strength value, that even with a -1000% iCombat modifier, it still will have a combat strenghth of 2.5.
In addition to this I have been observing the AI behavior with the 1.2 mod, and it does seem to be working (to some degree). I think the question we need to ask is, 'How best to set up cloaking, so that the AI can successfully use it, and to use it as an advantage, not a hinderance. Because I am no expert of how (or if even possible) to code the AI to use cloaking in even an elementary way (when compared to a cagey human) I think perhaps the following set up could be used.
1. Cloaking device should be given to units as a starting promotion only, according to cannon (And perhaps the cloaking tech could be used for the drill1, drill2 avalibility, and a new building that gives these{I have done this in may current game and seems to be working well, however, I was able to add only one promotion for this building "Espionage Centre-+2 espionage, +1 great spy points, 10% thwart spies, drill1 promotion for ships built, cost 120, availible with cloaking", does anyone know how to add two promotions with a building?}.
2. Allow all cloaked ships to fire while cloaked with a -25% to -75% (not sure needs to be balanced and tested) iCombat modifier. Yes I know this is not cannon, but I cannot see the poor AI being able to use it effectively otherwise. So, with the decloak in solar system setting, the AI get a ships that it can really use, full strenghth on the defence (in system) and a ship that can pick of weak or undefended units while skulking around. (Just as a side note, how can we get a cloked ship to be able to enter neutral territory without a DOW?)
3. As, TC01 suggested, moving the cloaking device to future tech worked well with the above mods.
Anyway, these are just my ideas, and in the games I played they seem to be working fairly well, thoughts?
trils0n May 18, 2010, 03:48 PM No. I conducted a few tests via the World builder. When my ship was newly created with the cloaking device promotion, I could then attack normally, or cloak, and still attack normally. But after that, if I decloak or cloak again at all for the rest of the game, I cannot conquer star systems. It is as though I am not actually decloaking.
I tested this as well in Star Trek 3.00 ("Star Trek" Mod). Decloaking doesn't work properly. After decloaking ships cannot conquer or defend star systems.
deanej May 18, 2010, 03:59 PM OK, no idea why it's not working. I might as well post a thread about it, but I doubt I'll get any assistance (never do).
deanej May 23, 2010, 06:03 PM I've managed to fix this. All it took was re-writing the entire code for the cloaked and Tachyon Detector promotions (and units with Tachyon Detector becoming limited to seeing cloaked unit in adjacent plots, since I couldn't figure out how the seeInvisible code works).
jfby May 24, 2010, 08:54 AM It seems my problem still exists; each time I research cloaking devices, I gain the ability to cloak every unit unless the 'bcannotcloak' is flagged. I tried a 'clean install' of 3.0 and then patched up to 3.23, but the issue still exists. I don't have all my game discs available at the moment, but I was going to try a complete reinstall of Civ 4. I have tried modding the cloaking promotion in the units folder, but none of the changes show up in game. Any tips, or should I just try and clean install?
TC01 May 24, 2010, 03:53 PM It seems my problem still exists; each time I research cloaking devices, I gain the ability to cloak every unit unless the 'bcannotcloak' is flagged. I tried a 'clean install' of 3.0 and then patched up to 3.23, but the issue still exists. I don't have all my game discs available at the moment, but I was going to try a complete reinstall of Civ 4. I have tried modding the cloaking promotion in the units folder, but none of the changes show up in game. Any tips, or should I just try and clean install?
The way the game is set up in 3.0, all units are able to cloak unless bCannotCloak is flagged. That is deanej's intention.
My intention, when I wrote this mod, was to only allow cloaking if the unit had a Cloaking Device promotion. That is not the way it is set up in Star Trek 3.0. Maybe I could release another version of this mod that would set it up that way.
So you're not actually having a "problem".
(The problem we were having was that despite "Decloaking", invisibility was not actually being removed from a unit).
jfby May 24, 2010, 05:19 PM I understand now. I modified the python file to look for the promotion and added cost requirement to the XML. I wanted it to be more exclusive but I can see the desire to have it for everyone to use.
Actually my knowledege of Python is very limited, so I would GREATLY appreciate it if you could release a version that has the cloaking attached to the promotion and not the tech... thanks!
jfby May 30, 2010, 02:11 PM I tried to add bNoCloaking to the units and now I am getting a schema issue when launching the mod. I have several questions:
1- is there a apecific place to add the bnocloaking; I put it after bnoreveal but maybe should I should put it elsewhere
2- are there some units that do not need or can't accept the bnocloaking?
Thanks everyone for putting up with my noob questions... I am going to look at the schema file to try and figure it out but help is always greatly appreciated.
TC01 May 30, 2010, 10:19 PM I tried to add bNoCloaking to the units and now I am getting a schema issue when launching the mod. I have several questions:
1- is there a apecific place to add the bnocloaking; I put it after bnoreveal but maybe should I should put it elsewhere
2- are there some units that do not need or can't accept the bnocloaking?
Thanks everyone for putting up with my noob questions... I am going to look at the schema file to try and figure it out but help is always greatly appreciated.
1. Yes, there is a specific place. Tags need to follow the order of the tags in the schema file.
However, that should be the correct plase for the tag.
Do you have the right number of tabs? And is it written correctly? Like this?
[TAB][TAB]<bNoCloaking>1</bNoCloaking>
(No units would be exempt from the tag unless an exception was hardcoded in Python for them.)
jfby May 30, 2010, 10:33 PM Thanks for the information. After reviewing the file, I found that I added an additional tag to a unit that already had the tag, and the error was cleared up. Again thank you very much.
TC01 Jun 07, 2010, 09:25 PM There's really no reason for me to keep the download up anymore (now that 3.25 has fixed the Cloaking Device bugs that were present even in Cloaking Devices 1.2), so I've removed it.
If you really, really, really want the Python source code of how I set things up (as opposed to the modified version in 3.0), just ask and I'll post it. But you probably can figure it out from what is present in 3.0. So... not really necessary.
deanej Jun 25, 2010, 05:09 PM Do you still have the AI code you used for the 2.37 version? For 4.0 I was hoping to add cloaking AI for ranged units and ships that pillage.
Also, does Final Frontier Plus have an AI for sensor stations? I'm hoping to add an AI for building those too, but that will be more complicated.
TC01 Jun 25, 2010, 06:53 PM Do you still have the AI code you used for the 2.37 version? For 4.0 I was hoping to add cloaking AI for ranged units and ships that pillage.
The only AI code I used was the "force cloak on normal space, force decloak on solar systems". I was working on something more complicated, but I couldn't get it to work.
I do still have the former, but not the latter.
Also, does Final Frontier Plus have an AI for sensor stations? I'm hoping to add an AI for building those too, but that will be more complicated.
Not at the moment, no. But I did recently take a look about restructuring the construction ship AI so that you could easily swap in additional station types, via functions similar to doStarbaseNeed (and findBestResourcePlot). The code for that is written, yet untested, and I haven't written any specific conditions for sensor stations yet.
deanej Jun 25, 2010, 07:20 PM Basically my idea is just a forced cloak when a unit in ranged or has a pillage AI when outside of its own territory. I just don't remember where you had the code for that.
What I have now for a sensor station AI is to rank plots according to a point value for features within a 2 tile radius: 3 nebula, 2 other damaging feature, 1 asteroids; the idea is to try to detect choke points and put a sensor station on them. Haven't done any thought yet on how to code this.
TC01 Jun 26, 2010, 06:53 AM Basically my idea is just a forced cloak when a unit in ranged or has a pillage AI when outside of its own territory. I just don't remember where you had the code for that.
Oh. Well, I don't have code for it at the moment but I'm sure I could do it if you want.
What I have now for a sensor station AI is to rank plots according to a point value for features within a 2 tile radius: 3 nebula, 2 other damaging feature, 1 asteroids; the idea is to try to detect choke points and put a sensor station on them. Haven't done any thought yet on how to code this.
It would be easy to do, if you structure it the same way the starbase construction AI is done. As an example, for Wormholes, I changed the starbase code to add points if the starbase was near a Wormhole.
I'll take a look at that too, if you want.
deanej Jun 26, 2010, 10:01 PM I think I can handle the cloak one myself, but it would be nice to have the old code as a reference. I don't remember which function the AI code was built into, either (was it by any chance onBeginPlayerTurn? That's where the Morning Star AI code is).
You could work on the sensor AI; what I have probably isn't a complete system, and Final Frontier Plus needs it as much as Star Trek does.
TC01 Jun 27, 2010, 05:42 PM I think I can handle the cloak one myself, but it would be nice to have the old code as a reference. I don't remember which function the AI code was built into, either (was it by any chance onBeginPlayerTurn? That's where the Morning Star AI code is).
I did it in onUnitMove. However, it would be better to do it in AI_unitUpdate().
The old code looked like this, but you would want to get rid of the checks for the actual cloaking device.
#Added in Cloaking Devices -- TC01
if (gc.getPlayer(pUnit.getOwner())).isHuman() == false:
if self.canDecloak(pUnit):
if pPlot.getFeatureType() == gc.getInfoTypeForString('FEATURE_SOLAR_SYSTEM'):
pUnit.changeMoves(60)
pUnit.setHasPromotion(gc.getInfoTypeForString('PRO MOTION_CLOAK'), false)
if self.canCloak(pUnit):
if not pPlot.getFeatureType() == gc.getInfoTypeForString('FEATURE_SOLAR_SYSTEM'):
pUnit.changeMoves(60)
pUnit.setHasPromotion(gc.getInfoTypeForString('PRO MOTION_CLOAK'), true)
#End of Cloaking Devices
#Cloaking Device functions (used to check if an AI unit can cloak)
def canDecloak(self, pUnit):
if pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_CLOAK')):
if pUnit.getMoves() > 0:
return true
return false
def canCloak(self, pUnit):
if pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_CLOAK_DEVICE')):
if not pUnit.isHasPromotion(gc.getInfoTypeForString('PROM OTION_CLOAK')):
if pUnit.getMoves() > 0:
return true
return false
#End of Cloaking Device Functions
You could work on the sensor AI; what I have probably isn't a complete system, and Final Frontier Plus needs it as much as Star Trek does.
Alright, I'll work on it.
|
|