工人物语吧 关注:3,739贴子:31,880
  • 6回复贴,共1

永远的工4——解读jobInfo.xml

取消只看楼主收藏回复

修改党 没啥好说的 不喜右上角点X
工人物语4里 每个小人都有个职业,比如伐木工、锯木工、屠夫、面包师等等。。。这些职业信息就存在JOBINFO.xml中,通过修改其中的编程内容可以修改小人的动作,简单易改,而且不容易出错。通过修改JOBINFO和buildinginfo可以创造个性的独特的工4,玩转自编地图。
本人只是抛砖引玉,只授予渔,繁琐的事自己研究吧。


IP属地:福建1楼2013-07-06 21:43回复
    例子:伐木小屋
    <job id="JOB_WOODCUTTER_WORK">
    <node>
    <jobPart>WC_WALK</jobPart>
    <task>CEntityTask::GO_TO_TARGET</task>
    <x>9</x>
    <y>9</y>
    <duration>-1</duration>
    <dir>-1</dir>
    <useWork>false</useWork>
    <forward>1</forward>
    <visible>1</visible>
    </node>
    <node>
    <jobPart>WC_CUT_TREE</jobPart>
    <task>CEntityTask::WORK_ON_ENTITY</task>
    <x>1</x>
    <y>1</y>
    <duration>35</duration>
    <dir>4</dir>
    <useWork>true</useWork>
    <forward>1</forward>
    <visible>1</visible>
    </node>
    <node>
    <jobPart>WC_WALK</jobPart>
    <task>CEntityTask::GO_VIRTUAL</task>
    <x>1</x>
    <y>0</y>
    <duration>-1</duration>
    <dir>5</dir>
    <useWork>true</useWork>
    <forward>1</forward>
    <visible>1</visible>
    </node>
    <node>
    <jobPart>WC_CUT_TREE</jobPart>
    <task>CEntityTask::WORK_ON_ENTITY_VIRTUAL</task>
    <x>1</x>
    <y>0</y>
    <duration>33</duration>
    <dir>4</dir>
    <useWork>true</useWork>
    <forward>1</forward>
    <visible>1</visible>
    </node>
    <node>
    <jobPart>WC_WALK</jobPart>
    <task>CEntityTask::GO_VIRTUAL</task>
    <x>1</x>
    <y>-2</y>
    <duration>-1</duration>
    <dir>5</dir>
    <useWork>true</useWork>
    <forward>1</forward>
    <visible>1</visible>
    </node>
    <node>
    <jobPart>WC_CUT_TREE</jobPart>
    <task>CEntityTask::WORK_ON_ENTITY_VIRTUAL</task>
    <x>1</x>
    <y>-2</y>
    <duration>22</duration>
    <dir>4</dir>
    <useWork>true</useWork>
    <forward>1</forward>
    <visible>1</visible>
    </node>
    <node>
    <jobPart>WC_WALK</jobPart>
    <task>CEntityTask::GO_VIRTUAL</task>
    <x>-1</x>
    <y>-4</y>
    <duration>-1</duration>
    <dir>4</dir>
    <useWork>true</useWork>
    <forward>1</forward>
    <visible>1</visible>
    </node>
    <node>
    <jobPart>WC_CUT_TREE</jobPart>
    <task>CEntityTask::WORK_ON_ENTITY_VIRTUAL</task>
    <x>-1</x>
    <y>-4</y>
    <duration>10</duration>
    <dir>1</dir>
    <useWork>true</useWork>
    <forward>1</forward>
    <visible>1</visible>
    </node>
    <node>
    <jobPart>WC_WALK</jobPart>
    <task>CEntityTask::GO_VIRTUAL</task>
    <x>-1</x>
    <y>-2</y>
    <duration>-1</duration>
    <dir>2</dir>
    <useWork>true</useWork>
    <forward>1</forward>
    <visible>1</visible>
    </node>
    <node>
    <jobPart>WC_PICKUP_LOG</jobPart>
    <task>CEntityTask::RESOURCE_GATHERING_VIRTUAL</task>
    <x>-1</x>
    <y>-2</y>
    <duration>0</duration>
    <dir>1</dir>
    <useWork>true</useWork>
    <forward>1</forward>
    <visible>1</visible>
    <entity>GOOD_LOG</entity>
    </node>
    <node>
    <jobPart>WC_WALK_LOG</jobPart>
    <task>CEntityTask::GO_VIRTUAL</task>
    <x>1</x>
    <y>0</y>
    <duration>-1</duration>
    <dir>1</dir>
    <useWork>true</useWork>
    <forward>1</forward>
    <visible>1</visible>
    </node>
    <node>
    <jobPart>WC_WALK_LOG</jobPart>
    <task>CEntityTask::GO_VIRTUAL</task>
    <x>1</x>
    <y>1</y>
    <duration>-1</duration>
    <dir>2</dir>
    <useWork>true</useWork>
    <forward>1</forward>
    <visible>1</visible>
    </node>
    <node>
    <jobPart>WC_WALK_LOG</jobPart>
    <task>CEntityTask::GO_TO_DESTINATION_PILE</task>
    <x>5</x>
    <y>3</y>
    <duration>-1</duration>
    <dir>-1</dir>
    <useWork>false</useWork>
    <forward>1</forward>
    <visible>1</visible>
    </node>
    <node>
    <jobPart>WC_PICKUP_LOG</jobPart>
    <task>CEntityTask::PUT_GOOD</task>
    <x>5</x>
    <y>3</y>
    <duration>0</duration>
    <dir>-1</dir>
    <useWork>false</useWork>
    <forward>0</forward>
    <visible>1</visible>
    <entity>GOOD_LOG</entity>
    </node>
    <node>
    <jobPart>WC_WALK</jobPart>
    <task>CEntityTask::GO_HOME</task>
    <x>1</x>
    <y>2</y>
    <duration>-1</duration>
    <dir>-1</dir>
    <useWork>false</useWork>
    <forward>1</forward>
    <visible>1</visible>
    </node>
    <node>
    <jobPart>WC_WALK</jobPart>
    <task>CEntityTask::CHECKIN</task>
    <x>1</x>
    <y>2</y>
    <duration>0</duration>
    <dir>1</dir>
    <useWork>false</useWork>
    <forward>1</forward>
    <visible>0</visible>
    </node>
    </job>


    IP属地:福建2楼2013-07-06 21:46
    回复
      <node>
      <jobPart>WC_WALK</jobPart> 这段定义的是动作类型 WALK表示走动
      <task>CEntityTask::GO_TO_TARGET</task> 表示上一个动作的标靶或者目的 例句里是 走到目标(树)
      <x>9</x> 坐标不需要修改的
      <y>9</y>
      <duration>-1</duration>
      <dir>-1</dir>
      <useWork>false</useWork>
      <forward>1</forward>
      <visible>1</visible>
      </node>
      前后<node>表示一个动作段落


      IP属地:福建3楼2013-07-06 21:51
      回复
        <node>
        <jobPart>WC_CUT_TREE</jobPart> 砍树的动作一次
        <task>CEntityTask::WORK_ON_ENTITY</task>
        <x>1</x>
        <y>1</y>
        <duration>35</duration>
        <dir>4</dir>
        <useWork>true</useWork>
        <forward>1</forward>
        <visible>1</visible>
        </node>


        IP属地:福建4楼2013-07-06 21:53
        回复
          知道前面的基础后就可以开始动手修改了 其实就只要删除 连复制黏贴都不用(当然如果你要修改高级的还是需要的 这里只说基础)


          IP属地:福建5楼2013-07-06 22:18
          回复
            最近比较忙 晚上抽时间补完


            IP属地:福建来自手机贴吧8楼2013-07-07 17:03
            收起回复
              继续
              由于伐木小屋比较特殊伐先给出极端情况
              <job id="JOB_WOODCUTTER_WORK">
              <node>
              <jobPart>WC_PICKUP_LOG</jobPart>
              <task>CEntityTask::RESOURCE_GATHERING_VIRTUAL</task>
              <x>-1</x>
              <y>-2</y>
              <duration>0</duration>
              <dir>1</dir>
              <useWork>true</useWork>
              <forward>1</forward>
              <visible>1</visible>
              <entity>GOOD_LOG</entity>
              </node>
              <node>
              <jobPart>WC_WALK_LOG</jobPart>
              <task>CEntityTask::GO_TO_DESTINATION_PILE</task>
              <x>5</x>
              <y>3</y>
              <duration>-1</duration>
              <dir>-1</dir>
              <useWork>false</useWork>
              <forward>1</forward>
              <visible>1</visible>
              </node>
              <node>
              <jobPart>WC_PICKUP_LOG</jobPart>
              <task>CEntityTask::PUT_GOOD</task>
              <x>5</x>
              <y>3</y>
              <duration>0</duration>
              <dir>-1</dir>
              <useWork>false</useWork>
              <forward>0</forward>
              <visible>1</visible>
              <entity>GOOD_LOG</entity>
              </node>
              <node>
              <jobPart>WC_WALK</jobPart>
              <task>CEntityTask::GO_HOME</task>
              <x>1</x>
              <y>2</y>
              <duration>-1</duration>
              <dir>-1</dir>
              <useWork>false</useWork>
              <forward>1</forward>
              <visible>1</visible>
              </node>
              <node>
              <jobPart>WC_WALK</jobPart>
              <task>CEntityTask::CHECKIN</task>
              <x>1</x>
              <y>2</y>
              <duration>0</duration>
              <dir>1</dir>
              <useWork>false</useWork>
              <forward>1</forward>
              <visible>0</visible>
              </node>
              </job>
              这样修改过的伐木工 会砍树 但是前面说了 伐木小屋很特殊 在于如果没砍树的动作 树的尸体不会消失 所以这样简化是会有问题的 就是树尸体不会消失 举这个例子的原因在于说明有些部分不能极端简化 否则会出问题


              IP属地:福建9楼2013-07-07 21:32
              回复