Cavalli Musket Projectile - More Questions

Discussion in 'Modding' started by Ftoomsh, Feb 8, 2018.

  1. Ftoomsh

    Ftoomsh Well-Known Member

    I am still hoping for some more discussion on this. :)

    Currently, I find in TestBed3 that muskets will not fire through friendly structures but they will fire through enemy structures killing some enemy and doing some structure damage. This is a situation I want to correct. If musket fire should not go through a structure, for example a stone wall, then no musket fire from either side should go through it. The same should apply to a large, solid building like Town Centre or Barracks.

    So, what is the ideal set-up, if it could be coded? I think it is;

    (a) No musket fire from either side goes through stone walls. It also causes minimal to no damage to the wall.

    (b) No musket fire from either side goes through structures. It causes light damage to structures.

    (c) Some musket fire might go through flimsy structures like houses but this is not strictly necessary as they have a small obstructing footprint anyway.

    (d) Wood walls present a special case. Could musket fire be permitted to go through wood walls at some rate like 50% and also do some damage? Could defenders differentially be permitted to get more fire through friendly wood walls? Could muskets differentially be permitted to get more fire through wood walls when standing right up at them? Some of these things are probably too much to hope for.


    I am fairly sure the necessary fixes must be done in misc.script. I just have to figure out how with my rather poor coding abilities. Any hints from Cavalli and other better modders will be much appreciated. :)

    I should add that these are the two statements I don't fully understand because I don't understand the syntax.

    var mmask : Integer = (1 shl gc_obj_material_building) or (1 shl gc_obj_material_wood) or (1 shl gc_obj_material_stone) or (1 shl gc_obj_material_woodwall) or (1 shl gc_obj_material_body) or (1 shl gc_obj_material_iron);


    and this;

    if (gObjProp[cid, id].bBuilding) or (gObjProp[cid, id].media=gc_obj_media_water) or (gObjProp[cid, id].media=gc_obj_media_land) then
    begin
    if ((enemyplmask and gPlayer[TObj(pObj).pl].myplmask)=0) then // is friend
     
    Last edited: Feb 8, 2018
  2. Rhayn

    Rhayn Member

    The first could probably be the function which sets the resource cost of units or buildings, to be sure, can you tell where you extracted that line from?
     
  3. Ftoomsh

    Ftoomsh Well-Known Member

    These lines are in misc.script. I think the first one sets a mask of some kind. I mean a mask like an array table which overlays terrain items with an array of values. But I am just guessing.

    The resource costs of unit and buildings are set in unit.script. Here's the line that sets the cost of a pikeman, in this case, (OCMOD3 values).

    SetObjBasePrice(objbase, 50, 0, 0, 5, 15, 0); {The values are food,wood,stone,gold,iron,coal.}

    Here is a town centre;

    SetObjBuildingExtProperties(objprop, objbase, 10000, 500, 300, True, 1000, gc_obj_usage_center, 0, 700, 700, 0, 0, 0);

    The relevant function higher up in the file is;

    procedure SetObjBuildingExtProperties(var objprop : TObjProp; var objbase : TObjBase; maxhp, buildtime : Integer; costpercent : Float; bcapture : Boolean; score, usage : Integer; food, wood, stone, gold, iron, coal : Integer);
    begin
    SetObjBuildingBaseSettings(objprop, bcapture, score, usage);
    SetObjBuildingProperties(objprop, objbase, maxhp, buildtime, costpercent);
    SetObjBasePrice(objbase, food, wood, stone, gold, iron, coal);
    end;

    And there are defining functions above that obviously.