adapt a script

A tab should be its own ASCII character. Will depend on the editor how wide it looks. If your editor converts tabs to spaces, that's also fine. It looks like it, maybe some having been converted to 4 spaces, others to 8. I'd try to keep that consistent, although excess indentation at the start of a block is not an error. But each block needs to maintain the same indentation throughout. Maybe the only real problem now is that the "if eUnit" line is one space too far to the right, if I see that correctly. The error messages (indentation error, syntax error) should also indicate which line is causing problems.

Edit: The updated version looks correct. I guess tabs being replaced by spaces was the main point of confusion.
 
thank you so much, you have so much patience in putting up with me :)
For now it seems to work well, it doesn't give me any errors. In case I can help you improve your Italian :))
 
unfortunately it doesn't have any effect, from what I understand if I have a religion, it shouldn't make me discover others even if I discover the technology, instead I discovered three different ones and all of them and three are holy cities, most likely it is unadaptable with realism invictus :(

perhaps it would be useful to limit the control only to the technology that discovers the religion, and if you already have one, don't let another one be discovered, I think that as realism invictus is it would be enough
 

Attachments

  • Screenshot 2024-06-27 235616.png
    Screenshot 2024-06-27 235616.png
    1.6 MB · Views: 5,543
Last edited:
I found why it didn't work, now it seems to work perfectly, the change to GlobalDefinesAlt was missing, as in the attached screen.
as always, without your help I would never have succeeded, thanks to people like you that civilization 4 still survives the passing of time
 

Attachments

  • Screenshot 2024-06-28 162530.png
    Screenshot 2024-06-28 162530.png
    32.6 KB · Views: 19
HI. I wanted to know if I can add another building to this script, in this mode would be fine?. script original n. 1 , script modify n. 2.
thx
 

Attachments

  • Screenshot 2024-06-29 232943.png
    Screenshot 2024-06-29 232943.png
    35.6 KB · Views: 23
  • 2.png
    2.png
    86.6 KB · Views: 23
Last edited:
Yes, that should work. Perhaps worth noting that enabling USE_UNIT_CANNOT_MOVE_INTO_CALLBACK in PythonCallbackDefines.xml might slow the game down noticeably because can-move-into checks get made frequently during AI pathfinding. Well, if you ever find that AI turns take too long, you could try disabling that callback to see if it makes a difference. Maybe only a problem if unitCannotMoveInto does something slow in Python (not the case currently – for most plots it'll only check whether there's a city), although just making the DLL-to-Python call at all takes up some time already.
 
Hi, I need help. I'm basically adapting shock religion, on the version of realism invictus 3.4, which I play, now it gives me an error, due to the option part of the game, which I would like to eliminate. if possible. Thank yo

I made one screenshot of the error and another of the script. Thank you
 

Attachments

  • Screenshot 2024-10-04 121530.png
    Screenshot 2024-10-04 121530.png
    779.5 KB · Views: 9
  • Screenshot 2024-10-04 121711.png
    Screenshot 2024-10-04 121711.png
    36.2 KB · Views: 9
To reference a new game option through GameOptionTypes, a change to the DLL would be needed (in CvEnums.h and CyEnumsInterface.cpp specifically). But you should be able to work around that by using gc.getInfoTypeForString("GAMEOPTION_NO_RELIGION_SHOCK") instead of GameOptionTypes.GAMEOPTION_NO_RELIGION_SHOCK – provided that the game option is defined in XML. Or, if you don't even want there to be an option, you could also replace all gc.getGame().isOption(...NO_RELIGION_SHOCK) calls with just False .
 
THX,. I try now, this is ok?
 

Attachments

  • Screenshot 2024-10-05 140301.png
    Screenshot 2024-10-05 140301.png
    15.4 KB · Views: 9
Last edited:
I saw it in the dbg log, it seems to work from what I read, but I don't know if I know how to read that log well.
Thx
 

Attachments

  • Screenshot 2024-10-05 160219.png
    Screenshot 2024-10-05 160219.png
    33.7 KB · Views: 6
I tried to adapt this script on two of my buildings, now it doesn't give me any errors, but it doesn't seem to do anything, did I make some mistakes? Thank you
first original image, second is my adapted one.
<Tag>TXT_KEY_BUILDING_NEUSCHWANSTEIN_HELP</Tag>
<English>[ICON_BULLET]Enemies take 10%% Damage for attacking Cities</English>
This is what it's supposed to do, maybe I didn't understand what it does. maybe it's extra damage to the attacking unit? or does it damage all the troops in the plot?

the original script of the walls of Babylon, unfortunately, is not understood by artificial intelligence, which does not attack
 

Attachments

  • 1.png
    1.png
    68.2 KB · Views: 6
  • 2.png
    2.png
    78.4 KB · Views: 8
Looks good. When a city defender gets killed, the attacking unit is supposed to take 10 extra damage. A healthy unit has 100 hitpoints, so this isn't a lot. E.g. an Axeman that survived at 2.7/5 strength, i.e. 54 hitpoints, should go down to 2.2/5. May have to consult the Combat Log (I mean the one that's part of the Event/ Turn Log on the upper left; Ctrl+Tab) to check how much health the attacker had left at the end of combat.
the original script of the walls of Babylon, unfortunately, is not understood by artificial intelligence, which does not attack
:confused: I would, on the contrary, expect the AI to attack without any regard for the extra damage.
 
back then the original Wall of Babylon script practically didn't allow attacking, before the defense dropped to 10%, but after my numerous tests, the A.I. he doesn't understand it, and so he doesn't even try to attack, I tested with mega armies with 30 catapults, but no attack was carried out, the army stopped at two squares and stationed them for dozens of turns, so I replaced that script with this one :). original script attached
 

Attachments

  • Screenshot 2024-06-29 232943.png
    Screenshot 2024-06-29 232943.png
    35.6 KB · Views: 10
Oh, that was with a different ability, I see. Yes, looks like it could've maybe worked – but also not shocking that the AI won't bombard a tile it can't (presently) enter.
 
Hi, I wanted to ask if in your opinion these scripts as I attached in the photo can work, I divided them into two parts because they didn't fit in a single script, I indicated the added parts in orange, thanks
can I replace unit_settler with unitclass_settler?because every civilization has its own unity
 

Attachments

  • 1.png
    1.png
    80 KB · Views: 7
  • 2.png
    2.png
    46.9 KB · Views: 7
Last edited:
gc.getUnitInfo(eUnit).getUnitClassType() should give you the unit class ID, which can be compared with the ID (i.e. getInfoTypeForString) of UNITCLASS_SETTLER. The BUG integration looks good apart from the C of onCityBuilt not being capitalized in the addEventHandler call. And USE_CANNOT_TRAIN_CALLBACK will need to be enabled in XML. Don't know if the head-selected unit will still exist when onCityBuilt gets called; I guess it'll be OK, i.e. the unit is dead but its data not yet deleted – probably the original author of the code has verified that this works. Your cannot-train condition seems to say no more settlers after 5 cities and neither settlers nor colonists after 7. Not sure if that's the intention.
 
If I understand correctly, I have to replace the string indicated in red with this?if pUnit.getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_SETTLER")


my problem is because in realism invictus every civilization has its own settler, so I'm forced to use unitclass, while for colonist it works well because it's unique for all civilizations
the intention is no more settler after 5 cities, and only colonist from 6 to 7 cities, and neither of both after 7 cities
 

Attachments

  • 1.png
    1.png
    20.5 KB · Views: 6
Last edited:
Back
Top Bottom