weapon protos

Discussion in 'Modding and Scripting Support' started by theorel, Jun 14, 2008.

Remove all ads!
Support Terra-Arcanum:

GOG.com

PayPal - The safer, easier way to pay online!
  1. theorel

    theorel New Member

    Messages:
    95
    Likes Received:
    0
    Joined:
    Apr 29, 2008
    Okay, so I've gone through the proto editing docs with a specific emphasis on weapons. I've figured out a couple things that they don't mention:
    (addresses will assume no scripts, add 0x30 to addresses if there are wieldON/OFF scripts, I've not checked if each script adds 24 addresses, or if it's something different(like 24 to add any scripts 12 for each would make sense)).
    We knew already that ammo type is in 0x22E
    The amount of ammo used wasn't mentioned, it's in 0x231
    And then in 0x235 we have the animation type thingy used for the projectile.

    Other than that I haven't found any new addresses, but I have figured out how things work, that weren't well documented. Namely art files and damage types.
    First Damage types...
    I haven't tested all possible combinations, but this seems pretty evident that it's how it works.
    For a weapon with 2 damage types and no scripts this appears in address 0x1EC, I'll assume you can find the byte which is responsible for weapon damage.
    So, if you know binary this is easy, skip the next paragraph, if not I'll explain some binary. The number one in binary is 1, 2 is 10, 3 is 11, 4 is 100, 5 is 101, etc... it's just like decimal, but instead of going up to 9 before adding a place, you only get to go up to 1.
    Okay, so in binary each bit is a 0 or 1, 0 means false 1 means true, your damage type is a 5 bit number(a binary number with 5 places). translated into hex, note: in binary 1111 is 15, the biggest single digit hex number, so our 5 digit binary number takes up 2 digits in hex, with the first digit being only 0 or 1.
    Now, the damage types are indexed in reverse, so go to worlded see the damage type order, flip it around, put a 1 if you want that damage type a 0 if you don't, you now have a 5 digit binary number, convert it to hex, and put it in the proper address. a couple examples:
    a weapon that does only health damage is 01, a weapon that does only fatigue damage is 10, one that does fatigue and electricity would be 14.
    I explained this in full detail, so that if you are trying to figure out these things on your own, you can do so in the future as well, if you want the down and dirty version. read now:
    1 is normal, 2 is poison, 4 is electrical, 8 is fire, 16(0x10) is fatigue.
    Add them together to get what you want. so poison electical is 6...etc.(make sure to translate to hex so 10 is A, 17 is 11).

    Next...art stuff
    Okay, so you can just copy whichever art you want, but this doesn't work if you want to use new art, or previously unused art...so here's how to do any piece of art you want(at least as far as weapons and projectiles go).
    Weapons first:
    there are 5 4byte places that are associated with art, for a weapon they are easy to recognize as they all end in 60(and there aren't a lot of 60s in the file).
    There must be a 6th somewhere, but I haven't found it(it's not associated with item art, but the icon in your quickbar), I haven't really looked for it either.
    So, there are 4 bytes, the first two are related, and bleed into each other. This could be confusing, so let's concentrate on the first art reference first...I believe this is the ground art.(0x48)
    let's look at a concrete example: an axe...pick any axe and look at address 0x48(it should be 00). The next address is 0x49 should read 01.
    First thing to do is reorder the bytes, so it reads 01 00. or 100.
    now drop the last 0, and it reads 10. This is hex, so it's actually reading 16.
    divide by 2...we get 8. Go to item_ground.mes in the item folder(in art), go to 80 and you'll see axes. Now if we weren't looking at address 48, but rather 0x184, you'll notice it's 0011 ** doing the same process we get 11 00 ->1100 now just drop the first bit...back to 100, continue as above. I think it has to do with which mes file we are looking at, i.e. ground, paper, etc...
    So, I would say just leave that number alone.
    Okay, so we can get to axes, but how do we get the specific axe we want? That's the third byte, it tells which axe, dagger, sword, whatever to pick. just subtract the base number (such as 80) and you'll get the number in byte 3.
    Finally byte 4 is 60.

    Hopefully that wasn't too unreadable, I'll make a doc file similar to the protodocs when I'm all done with everything, explaining in detail with a specific example, and stating what you can change.

    If you made it through that, this will be cake. Projectile art.
    So, in the word starting at 0x235 open up any item at random and you'll see FFFF FFFF (it'll be followed by FFFF FFFF). This is unless you opened weapon which does shoot, but not bullets.
    So, FFFF FFFF = -1, is the choice for shooting bullets(I think it means no art, because I think bullets don't have art...I may be wrong). So, what about Bronwyck's gun, or the tesla gun, or a bow(or dagger, chakram, etc...)
    Well, go to scenery(why are projectiles in scenery?) and look at the top. The first 30some are projectiles, each in packs of 4. Well, pick one, such as tesla(number 8). divide by 2->4. this is the important number.(Ex2: it's 14 for a boomerang). translate it into hex(if it's big enough to need it). (So, E for the boomerang).
    Now the number that goes in the last two bytes of the word beginning at 0x235 is #04# where the two #s are your hex number out of order(padded with a 0 if necessary so 4 is 04, E is 0E 10 is 10)(Ex1: 4040 for a tesla coil, Ex2: E040 for a boomerang, Ex3: 0041 for Bronwyck hex index 10).
    So in the end FFFF FFFF is replaced by something like 0000 4040 for a tesla coil.
    Note: this does nothing for an item with range 1.

    Well, if you made it all the way though my post, or just skipped to the end, I have a question. What is different for different weapons, probably related to damage, that we don't know yet how to control? It is not whether strength is added(presumably that's something automatically taken care of by range or by using ammo). I think there's only one address I don't know what it means which is only present for weapons, that changes. Addresses that are constant across all weapons, I assume to be translator related.
    Anyways, after looking through the proto-editing docs, and doing those few things, there is almost nothing a weapon is exclusively capable of, that I can think of, which I don't know how to change. So, I have a second question: what do people want to know how to change that they don't know how to change using proto files? Or perhaps better, what do people not know how to change whether they would want to or not?
     
  2. team a

    team a New Member

    Messages:
    580
    Likes Received:
    0
    Joined:
    May 10, 2007
    That looks like some really good work, theo! I can't wait to see your Proto Docs.

    I would really, really like some help with newspapers. I am trying to figure out what is determined by the game engine, which might be more than I hope. I'd like to know where in the proto newspaper type 1 (i.e. Tarant) and type 2 (i.e. Vendigroth) are determined. This would be what points to the different headlines, which can be found in gamenewspaper.mes (lines 1&3 for type 1, lines 4&5 for type 2). I'm also curious if it's possible to have a 3rd newspaper.
     
  3. theorel

    theorel New Member

    Messages:
    95
    Likes Received:
    0
    Joined:
    Apr 29, 2008
    Seems to me that just about everything is engine determined. I tried changing each bit by hand to see the effect, until eventually I just copied and pasted the whole* of the pro file from tarant newspaper to vendigroth newspaper. Unless things are interacting in a very strange way(always possible) nothing about which interface opens and what it says is contained in the pro file.
    The only changes that seemed to have any effect were the name changes(0x143) which changes the name you see in game(I assume 0x198 and 0x19C change the unknown name and internal name, or something else that you don't see in game). And 0x169, which if it is 01, with all other addresses left alone the vendigroth newspaper shows up in the book's edit(that is under book under written in worlded), though after the copy and paste it went back to unassigned.(so it's at least one documented case of the bits interacting with each other in unusual ways...I assume the same name thing is what caused it).
    Anyways I assume the bits control something, but what I can not tell.


    *- I changed the proto number at index 47 to match with the proper newspaper, but that's it.
     
Our Host!