Musketeer/ Knight slot

DBA Online Armies archive page! https://web.archive.org/web/20191030215601/http://www.dbaol.com/armies.htm
Wingspalette archive https://web.archive.org/web/20200118014728/http://wp.scn.ru/en/news
 
Last edited:
It's awkward.
It must have been asked for and about a million times by now, but last time I asked about it it, hex editting was kindly done for me so I never learned how to do it myself.
Can someone plz point me to a how to setup barbarian diplomacy (alliance)?
 
It must have been asked for and about a million times by now, but last time I asked about it it, hex editting was kindly done for me so I never learned how to do it myself.
Can someone plz point me to a how to setup barbarian diplomacy (alliance)?
ToTpp allows you to setup it using the tribeId 0 ;)
 
set.tribeid0.treaties.[otherTribeid2]
?
I keep getting syntax errors on the Lua console. I think I am not doing it right.
 
set.tribeid0.treaties.[otherTribeid2]
We're using the tribe object :

tribe.treaties[otherTribe] (read and alter)

Then civ.getTribe(0).treaties[civ.getTribe(otherTribeId)] = integer corresponding to the treaties whished (bitmask shall work too I guess).

The = symbol here means allocate, thus correspond somehow to a "set"

I don't have values on mind as I did put this in generic functions for long.

If you're using @Prof. Garfield template, simple functions shall already exist to do the job ;)
 
It's awkward.
It must have been asked for and about a million times by now, but last time I asked about it it, hex editting was kindly done for me so I never learned how to do it myself.
Can someone plz point me to a how to setup barbarian diplomacy (alliance)?
We're using the tribe object :

tribe.treaties[otherTribe]

Then civ.getTribe(0).treaties[civ.getTribe(otherTribeId)] = integer (bitmask shall work too I guess).

I don't have values on mind as I did put this in functions for long.

If you're using @Prof. Garfield template, simple functions shall already exist to do the job ;)
In the Lua console, you should just be able to type the following line (replacing 0 and 1 with appropriate tribe numbers):
Code:
console.diplomacy.setAlliance(civ.getTribe(0),civ.getTribe(1))
If you get an error, try
Code:
console.diplomacy = require("diplomacy")
console.diplomacy.setAlliance(civ.getTribe(0),civ.getTribe(1))
If you still have an error, post the error and wait for advice.
 
@Prof. Garfield , @Dadais
Thank you in advance, this is what I get:
> console.diplomacy.setAlliance(civ.getTribe(0),civ.getTribe(1))
...Έγγραφα\My Games\ToT\1940\MED 1940\LuaCore\diplomacy.lua:196: attempt to index a nil value (local 'expectedTreatiesTable')
stack traceback:
...Έγγραφα\My Games\ToT\1940\MED 1940\LuaCore\diplomacy.lua:196: in upvalue 'setTreatiesBit1'
...Έγγραφα\My Games\ToT\1940\MED 1940\LuaCore\diplomacy.lua:294: in function 'diplomacy.setAlliance'
(...tail calls...)

> console.diplomacy = require("diplomacy")
> console.diplomacy.setAlliance(civ.getTribe(0),civ.getTribe(1))
...Έγγραφα\My Games\ToT\1940\MED 1940\LuaCore\diplomacy.lua:196: attempt to index a nil value (local 'expectedTreatiesTable')
stack traceback:
...Έγγραφα\My Games\ToT\1940\MED 1940\LuaCore\diplomacy.lua:196: in upvalue 'setTreatiesBit1'
...Έγγραφα\My Games\ToT\1940\MED 1940\LuaCore\diplomacy.lua:294: in function 'diplomacy.setAlliance'
(...tail calls...)
 
@Prof. Garfield , @Dadais
Thank you in advance, this is what I get:
> console.diplomacy.setAlliance(civ.getTribe(0),civ.getTribe(1))
...Έγγραφα\My Games\ToT\1940\MED 1940\LuaCore\diplomacy.lua:196: attempt to index a nil value (local 'expectedTreatiesTable')
stack traceback:
...Έγγραφα\My Games\ToT\1940\MED 1940\LuaCore\diplomacy.lua:196: in upvalue 'setTreatiesBit1'
...Έγγραφα\My Games\ToT\1940\MED 1940\LuaCore\diplomacy.lua:294: in function 'diplomacy.setAlliance'
(...tail calls...)

> console.diplomacy = require("diplomacy")
> console.diplomacy.setAlliance(civ.getTribe(0),civ.getTribe(1))
...Έγγραφα\My Games\ToT\1940\MED 1940\LuaCore\diplomacy.lua:196: attempt to index a nil value (local 'expectedTreatiesTable')
stack traceback:
...Έγγραφα\My Games\ToT\1940\MED 1940\LuaCore\diplomacy.lua:196: in upvalue 'setTreatiesBit1'
...Έγγραφα\My Games\ToT\1940\MED 1940\LuaCore\diplomacy.lua:294: in function 'diplomacy.setAlliance'
(...tail calls...)
Did the console show an error when you started the game? That would explain why the expectedTreatiesTable was never initialised, and this error happened.

In any case, here is a code that will work without any modules:
Code:
civ.getTribe(1).treaties[civ.getTribe(0)] = civ.getTribe(1).treaties[civ.getTribe(0)] | 1<<3
Code:
civ.getTribe(0).treaties[civ.getTribe(1)] = civ.getTribe(0).treaties[civ.getTribe(1)] | 1<<3
Since treaties are symmetric, you must employ both of these lines, changing out 0 and 1 for appropriate tribe values. (Note, the 1 in 1<<3 is not changed; it is actually a 1, not a tribeID.)
 
Did the console show an error when you started the game? That would explain why the expectedTreatiesTable was never initialised, and this error happened.

Yes, I had added a new unit and forgot to also add a corresponding line to the @UNITS_ADVANCED. Duh, again.
console.diplomacy.setAlliance(civ.getTribe(0),civ.getTribe(1)) worked this time., I think.
Thank you.
 
Question. Is there a non hex-edit way to set up barbarian treaties (alliance)?
 
Well, I had a crash and I am doing some stuff from scratch.That means it woks wiith barbarians too. Great, thanks @Dadais !
 
Last edited:
Top Bottom