1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Cloaking Device Modmod

Discussion in 'Civ4 - Star Trek Mod' started by TC01, Aug 7, 2009.

  1. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    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.
     
  2. Pablod

    Pablod Chieftain

    Joined:
    Sep 17, 2005
    Messages:
    294
    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
     
  3. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    So, to be perfectly clear... when you go into Assets\XML\Audio2DScripts.xml, the second and third entries are this?

    Code:
    	<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?

    Code:
    		<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...
     
  4. Pablod

    Pablod Chieftain

    Joined:
    Sep 17, 2005
    Messages:
    294
    yes when i install 3.19 it deleted my costum assets
     
  5. deanej

    deanej Chieftain

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    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?
     
  6. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    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

    Code:
    	# 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.getInfoTypeForString('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.getInfoTypeForString('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:

    Code:
    if self.iPushedButtonUnit.getOwner() == gc.getInfoTypeForString('CIVILIZATION_ROMULAN') or self.iPushedButtonUnit.getOwner() == gc.getInfoTypeForString('CIVILIZATION_KLINGON')):
    	self.iPushedButtonUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_CLOAK_2'), false)
    else:
    	self.iPushedButtonUnit.setHasPromotion(gc.getInfoTypeForString('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.
     
  7. deanej

    deanej Chieftain

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    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.
     
  8. Agent327

    Agent327 Observer

    Joined:
    Oct 28, 2006
    Messages:
    16,077
    Location:
    In orbit
    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:
     
  9. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    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...
     
  10. deanej

    deanej Chieftain

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    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?
     
  11. JareshInyo

    JareshInyo Chieftain

    Joined:
    Oct 20, 2008
    Messages:
    29
    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. ???
     
  12. deanej

    deanej Chieftain

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    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.
     
  13. JareshInyo

    JareshInyo Chieftain

    Joined:
    Oct 20, 2008
    Messages:
    29
    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.
     
  14. zoommooz

    zoommooz Chieftain

    Joined:
    Nov 28, 2005
    Messages:
    182
    Location:
    N.S.W, Australia
    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?
     
  15. trils0n

    trils0n Chieftain

    Joined:
    May 18, 2010
    Messages:
    1

    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.
     
  16. deanej

    deanej Chieftain

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    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).
     
  17. deanej

    deanej Chieftain

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    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).
     
  18. jfby

    jfby Chieftain

    Joined:
    Jun 17, 2008
    Messages:
    196
    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?
     
  19. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    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).
     
  20. jfby

    jfby Chieftain

    Joined:
    Jun 17, 2008
    Messages:
    196
    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!
     

Share This Page