Quick Modding Questions Thread

is it possible to have a unit have multiple unit classes i.e. a mounted melee unit?
 
is it possible to have a unit have multiple unit classes i.e. a mounted melee unit?

Nope, not possible.
Theoretically you could maybe with lots of C++ knowledge code something like that, but it would take quite some time, and would probably not be worth it.
 
is it possible to have a unit have multiple unit classes i.e. a mounted melee unit?

We just added that feature in C2C! It's been unimaginably helpful but we haven't fully integrated all the capabilities its going to allow us yet.
 
Thank you for the help with audio issues, The_J. Still haven't quite figured it out, but I'll get it solved eventually.

On another note, is it possible to add a trait that would, for example, result in a relations loss(or boost) with all other leaders without modifying the SDK in order to add an XML value? For example, adding a trait that would result in a minus four relations loss with everyone else. (This is for an LP for RPing purposes.)
 
As it's not good to have a question as a last reply on last page I will quote myself:

(1- GC.getGameINLINE().getSorenRandNum(2, "NameYourRandomCallHere"))
 
On another note, is it possible to add a trait that would, for example, result in a relations loss(or boost) with all other leaders without modifying the SDK in order to add an XML value? For example, adding a trait that would result in a minus four relations loss with everyone else. (This is for an LP for RPing purposes.)

Can be done via Python.
I have a small mod component to demonstrate it here.
 
(1- GC.getGameINLINE().getSorenRandNum(2, "NameYourRandomCallHere"))

I think you'll find the net results of that to be the same as just:
GC.getGameINLINE().getSorenRandNum(2, "NameYourRandomCallHere")

In either case you get only the number 0 or 1, 50% of either. Your version just flips each 0 to a 1 and each 1 to a 0.

The getSorenRandNum(N,"foo") function returns a random number with N possible values. Those values are all integers, start with 0, and don't skip any values therefore the possible results are integers from 0 to N-1.

I'm not sure, but it sounded to me like LuKo wanted floating point values between 0 and 1 rather than an integer that could be 0 or 1. No exact specification was made, so I am going with the half open range [0,1). A good approximation can be made for that via:
fValue = (float)GC.getGameINLINE().getSorenRandNum(10000,"foo")/10000.0
to get values from (and including) 0.0 to about .9999 (roughly, due to the inexact binary representation of the decimal values).

If you want the possibility of getting the value 1 (i.e. the closed range [0,1]) then you'd divide by 9999 instead of 10000.
 
@The_J and dacubz
I will guess def placeUpgradesTo(self): of CvPediaUnit
 
I think you'll find the net results of that to be the same as just:
GC.getGameINLINE().getSorenRandNum(2, "NameYourRandomCallHere")

In either case you get only the number 0 or 1, 50% of either. Your version just flips each 0 to a 1 and each 1 to a 0.

The getSorenRandNum(N,"foo") function returns a random number with N possible values. Those values are all integers, start with 0, and don't skip any values therefore the possible results are integers from 0 to N-1.

I'm not sure, but it sounded to me like LuKo wanted floating point values between 0 and 1 rather than an integer that could be 0 or 1. No exact specification was made, so I am going with the half open range [0,1). A good approximation can be made for that via:
fValue = (float)GC.getGameINLINE().getSorenRandNum(10000,"foo")/10000.0
to get values from (and including) 0.0 to about .9999 (roughly, due to the inexact binary representation of the decimal values).

If you want the possibility of getting the value 1 (i.e. the closed range [0,1]) then you'd divide by 9999 instead of 10000.

You're right... I gave a hasty answer.
 
does anyone know of a mod that makes it so upgrading units gives them appropriate promotions (example, toku upgrading a pikeman to a rifleman yields a city-defender 1 and drill 1 that it should have)
 
Oops wrong game. I thought this was for CiV.
 
does anyone know of a mod that makes it so upgrading units gives them appropriate promotions (example, toku upgrading a pikeman to a rifleman yields a city-defender 1 and drill 1 that it should have)

You could cheat and make a UU that the particular units upgrade to that is only avialable to the factions that you want. A bit messy but it is an xml only solution
 
I think you'll find the net results of that to be the same as just:
GC.getGameINLINE().getSorenRandNum(2, "NameYourRandomCallHere")

In either case you get only the number 0 or 1, 50% of either. Your version just flips each 0 to a 1 and each 1 to a 0.

The getSorenRandNum(N,"foo") function returns a random number with N possible values. Those values are all integers, start with 0, and don't skip any values therefore the possible results are integers from 0 to N-1.

I'm not sure, but it sounded to me like LuKo wanted floating point values between 0 and 1 rather than an integer that could be 0 or 1. No exact specification was made, so I am going with the half open range [0,1). A good approximation can be made for that via:
fValue = (float)GC.getGameINLINE().getSorenRandNum(10000,"foo")/10000.0
to get values from (and including) 0.0 to about .9999 (roughly, due to the inexact binary representation of the decimal values).

If you want the possibility of getting the value 1 (i.e. the closed range [0,1]) then you'd divide by 9999 instead of 10000.

Thank you!
 
Top Bottom