闪点行动2吧 关注:1,973贴子:52,872
平时会做出一些奇怪的东西,我想发帖分享一下。


IP属地:四川1楼2014-05-16 09:56回复
    function onTimer_change()
    OFP:setTimer("change",5000);
    local target=OFP:getGroupMember("p",math.random(0,OFP:getGroupSize("p")-1));
    if OFP:getSide(target)==0 then
    OFP:setArmy(target,1);
    end
    if OFP:getSide(target)==1 then
    OFP:setArmy(target,0);
    end
    if OFP:getGroupSize("p")<=15 then
    local x,y,z=OFP:getPosition(target);
    add=OFP:spawnEntitySetAtLocation("E",x,y,z);
    end
    end
    function onMissionStart()
    OFP:setInvulnerable("huntercqb",true);
    OFP:addTimer("change",5000);
    end
    function onSpawnedReady( setName, setID, tableOfEntities, errorCode )
    if setID==add then
    for i=1,#tableOfEntities do
    if OFP:getBroadUnitCategory(tableOfEntities[i])=="BROAD_UNIT_SOLDIER" then
    OFP:addToGroup(tableOfEntities[i],"p");
    end
    end
    end
    end


    IP属地:四川6楼2014-05-16 10:16
    收起回复
      狙击任务
      http://pan.baidu.com/s/1pJO7uCN
      不能被发现(Identified)


      IP属地:四川7楼2014-05-16 23:36
      回复
        function onDeath(victim, killer)
        OFP:setAmmoCount("player",10);
        target=victim;
        OFP:showLetterBoxOsd(true);
        OFP:addTimer("dea",100);
        OFP:addTimer("com",1500);--应小于回收时间,否则崩溃;
        end
        function onTimer_dea()
        OFP:selectCamera(target);
        OFP:removeTimer("dea");
        end
        function onTimer_com()
        OFP:selectCamera("player");
        OFP:showLetterBoxOsd(false);
        OFP:removeTimer("com");
        end


        IP属地:四川8楼2014-05-17 13:49
        收起回复
          http://pan.baidu.com/s/1mg4uLCW
          第二个狙击任务。
          找到狙击位置之后就很简单了。


          IP属地:四川10楼2014-05-17 21:51
          回复
            打纸箱,一个无(dou)聊(bi)任务。
            function onMissionStart()
            OFP:spawnEntitySet("E");
            score=0;
            OFP:addTimer("stop",60000);
            end
            function onPlaceableKill(placeable, killer, method)
            OFP:setAmmoCount("player",10);
            score=score+5;
            x,y,z=OFP:getPosition("player");
            x=x+math.random(-10,10);
            z=z+math.random(-10,10);
            y=y+math.random(1,5);
            OFP:spawnEntitySetAtLocation("E",x,y,z);
            OFP:displaySystemMessage(score/5);
            if score==100 then
            OFP:showPopup("great"," full score ! ")
            OFP:missionCompleted();
            end
            end
            function onTimer_stop()
            OFP:showPopup("game over","your score is "..score.." !")
            if score<=55 then
            OFP:missionFailed();
            end
            if score>=60 then
            OFP:missionCompleted();
            end
            end


            IP属地:四川11楼2014-05-18 12:38
            回复
              http://pan.baidu.com/s/1ntLnIPz
              第三个狙击任务,求拓展情境


              IP属地:四川16楼2014-05-18 18:42
              收起回复
                OFP:playOneShotSound类似飞机螺旋桨转动的声音怎么写?


                IP属地:四川32楼2014-05-30 20:10
                回复
                  关于移动镜头,我就知道这么多了
                  http://pan.baidu.com/s/1jG7hKG2
                  看完就会了,真的


                  IP属地:四川35楼2014-05-31 11:20
                  收起回复
                    Timer的参数已找到:
                    onTimer(triggerTime,timerName),
                    两个变量名是我自己随便取的,个人喜好
                    triggerTime是Timer触发的时间,timerName是Timer的名字


                    IP属地:四川43楼2014-06-17 12:23
                    回复
                      火焰伤害模拟:
                      两个区域,firein和fireout

                      代码:
                      ---------------------------------------------------------------------------------------------------------------
                      target={};--要进行damage的目标表


                      onLeave_firein=function(zoneName, unitName)
                      OFP:addTimer("fire",100);
                      table.insert(target,unitName);
                      end


                      onEnter_fireout=function(zoneName, unitName)
                      OFP:addTimer("fire",100);
                      table.insert(target,unitName);
                      end


                      onEnter_firein=function(zoneName, unitName)
                      for i=1,#target do
                      if unitName==target[i] then
                      table.remove(target,i);
                      end
                      end
                      end


                      onLeave_fireout=function(zoneName, unitName)
                      for i=1,#target do
                      if unitName==target[i] then
                      table.remove(target,i);
                      end
                      end
                      end


                      bodyZone={"headzone","chestzone","abdomenzone","larmzone","rarmzone","llegzone","rlegzone"};


                      onTimer_fire=function()
                      OFP:setTimer("fire",500);
                      for i=1,#target do
                      OFP:damage(target[i],bodyZone[math.random(1,7)],5);
                      end
                      end


                      onIncap=function(victim, killer, method)
                      for i=1,#target do
                      if victim==target[i] then
                      OFP:doParticleEffect("X_SMOK_ASM_Master1",victim);
                      OFP:doParticleEffect("X_FIRE_WREK_Master1_Medium",victim);
                      end
                      end
                      end


                      onDeath=function(victim, killer)
                      for i=1,#target do
                      if victim==target[i] then
                      OFP:doParticleEffect("X_SMOK_ASM_Master1",victim);
                      OFP:doParticleEffect("X_FIRE_WREK_Master1_Medium",victim);
                      table.remove(target,i);
                      end
                      end
                      end
                      ---------------------------------------------------------------------------------------------------------------


                      IP属地:四川本楼含有高级字体44楼2014-06-26 15:23
                      收起回复
                        OFP:teleport(entityGroupOrEchelonName, targetName, issueCommandOption) ;
                        ----------------------------------------------------------------------------------------------------------------
                        teleport用法:



                        OFP:teleport(entityGroupOrEchelonName, targetName, issueCommandOption) ;
                        OFP:addTimer(timerName,500);--一般是0.2s~0.35s就传过去了,但也有例外,
                        --没有见到过超过0.5s的情况;
                        function onTimer(time,name)--onTimer的两个参数,第一个是实际触发时间,
                        --第二个是Timer名称;
                        if name==timerName then
                        #$^%%&^&^*%#;--传送之后具体要执行的命令
                        OFP:removeTimer(timerName);
                        end
                        end
                        -------------------------------------------------------------------------------------------------------------------


                        IP属地:四川本楼含有高级字体45楼2014-06-26 15:36
                        回复
                          teleport用法演示+上下房顶演示:

                          视频来自:优酷


                          IP属地:四川本楼含有高级字体46楼2014-06-26 23:08
                          回复
                            会有人马克吗,哈哈


                            IP属地:四川47楼2014-06-26 23:10
                            回复
                              猜猜看这是真的还是假的??
                              视频来自:优酷


                              IP属地:四川53楼2014-06-28 16:35
                              收起回复