Operation Flashpoint Dragon Rising OFDR Forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

I have some questions to ask...

+2
TheGeneral
Morieza
6 posters

Page 3 of 3 Previous  1, 2, 3

Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by runerback Fri 29 Aug 2014, 15:54

I just wrote some functions, then suddenly I find you have done this long long time ago... I'm wondering which particle effect you used in SAM missle launcher model.
It seems that my friends have no interest in it, so I want to paste a gif picture here but I failed... 
In any case, this stimulated me because I can write model as same as yours with a low quality. Very Happy

runerback

Location : China
Points : 153
Reputation : 5
Join date : 2014-06-18

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by runerback Sat 30 Aug 2014, 01:21

I found the way to make soldiers jump in game.
Code:
function onMissionStart()   
   if not hidden then
      hidden=true
      OFP:activateEntitySet("hid")
   end
   OFP:setInvulnerable("ip06plfldr",true)
end

function jump(jumper)
   if isJumper(jumper) then
      local x,y,z=OFP:getPosition(jumper)
      EDX:serialTimer("startJump",500,OFP:spawnEntitySetAtLocation("blocker",x,y+0.65,z),jumper)
   else
      return
   end
end

function startJump(id,jumper,timerID)
   OFP:destroyEntitySet(id)
end

function isJumper(unitName)
   if OFP:getBroadUnitCategory(unitName)=="BROAD_UNIT_SOLDIER" then      
      if OFP:getStance(unitName)=="EStanding" then
         return true
      else
         return false
      end
   else
      return false
   end
end

function numpad0()
   jump("ip06plfldr")
end

blocker:
I have some questions to ask... - Page 3 Aoe10

runerback

Location : China
Points : 153
Reputation : 5
Join date : 2014-06-18

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by runerback Sat 30 Aug 2014, 02:48

I have a problem in a dropping fire ball model. 

I have some questions to ask... - Page 3 0012

When the fire get to ground, it should be an explosion there, but sometimes it doesn't work or exploded at wrong entity position.
I'll show my code for a solution.

Code:
function lineInit()
   if not initline then
      Line={}
      OFP:addTimer("lineStart",1000)
      initline=true
   end
end

function newLine(x,y,z,h_dir,v_dir,speed)
   if not initline then
      lineInit()
   end
   local newLine={}
   newLine.x=x
   newLine.y=y+OFP:getTerrainHeight(x,z)
   newLine.z=z
   newLine.h_dir=h_dir
   newLine.v_dir=v_dir
   newLine.speed=speed
   newLine.boom=false
   newLine.state=true
   table.insert(Line,newLine)
end

function lineStart()
   OFP:setTimer("lineStart",100)
   for line_k,line_v in pairs(Line) do
      if line_v.state then
         if math.mod(line_v.v_dir,90)==0 then
            line_v.x=line_v.x
            line_v.z=line_v.z
         else
            line_v.x=line_v.x+(line_v.speed*math.cos(math.rad(line_v.v_dir)))*math.sin(math.rad(line_v.h_dir))
            line_v.z=line_v.z-(line_v.speed*math.cos(math.rad(line_v.v_dir)))*math.cos(math.rad(line_v.h_dir))
         end
         line_v.y=line_v.y+line_v.speed*math.sin(math.rad(line_v.v_dir))
         OFP:destroyEntitySet(OFP:spawnEntitySetAtLocation("flare",line_v.x,line_v.y,line_v.z))
      end
   end
end

function onSpawnedReady( setName, setID, tableOfEntities, errorCode )
   if setName=="flare" then
      if setID then
         for line_k,line_v in pairs(Line) do
            if line_v.state then
               if line_v.y<=OFP:getTerrainHeight(line_v.x,line_v.z)+1 then
                  if not line_v.boom then
                     line_v.boom=true
                     local dist=OFP:getDistance(tableOfEntities[1],EDX:getPrimaryPlayer())
                     if dist<=10 then
                        OFP:damage(EDX:getPrimaryPlayer(),bodyzone[math.random(1,#bodyzone)],5)
                     end
                     if dist > 1500 then
                        dist=1500
                     end
                     OFP:playOneShotSound("flashpoint2","exp","explosion",line_v.x,line_v.y,line_v.z,math.random(5,11),dist,0)
                     local posx,posy,posz=OFP:getPosition(tableOfEntities[1])
                     if posy<=OFP:getTerrainHeight(posx,posz)+10 then
                        OFP:doParticleEffect("X_EXPL_HMORT_Master1",tableOfEntities[1])
                     end
                     line_v.boom=false
                     table.remove(Line,line_k)
                     line_v.state=nil
                  end
               end
            end
         end
         OFP:doParticleEffect("X_IMPT_EXPL_Master1",tableOfEntities[1])
      end
   end
end

There is a reconPoint in entity set "flare".
Code:
function onMissionStart()
   OFP:addTimer("t0",6000)
end

function t0()
   newLine(6000,100,-11610,90,-90,1)
   newLine(6000,115,-11675,90,-50,1)
   newLine(6000,135,-11625,90,-60,1)
   newLine(6000,175,-11600,90,-70,1)
   newLine(6000,200,-11635,90,-80,1)
end

I have some questions to ask... - Page 3 010

I have some questions to ask... - Page 3 112

runerback

Location : China
Points : 153
Reputation : 5
Join date : 2014-06-18

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by tvig0r0us Sat 30 Aug 2014, 05:58

I wish I had more time to look over your code and help you out. I'm back in school and just have too much on my plate right now. If I have a chance tomorrow I'll post the camera examples and try to analyze this a bit for you. Sorry.

Cheers Very Happy
tvig0r0us
tvig0r0us
Admin

Location : Nky
Points : 266
Reputation : 29
Join date : 2013-10-16

http://www.moddb.com/members/tvig0r0us

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by runerback Sat 30 Aug 2014, 06:59

Never mind. I'm not hurry.

I just uploaded a vedio.   Cool Stole from you.....

Another SAM

runerback

Location : China
Points : 153
Reputation : 5
Join date : 2014-06-18

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by TheGeneral Sat 30 Aug 2014, 11:39

I see the jump thing being interesting but you haven't really described what the motivation or how you can do this from a non coders point of view. 

Does the user have to press a key or something to fucntion this???  There is already a function in game as everyone knows to climb over stuff.
TheGeneral
TheGeneral
Admin

Points : 780
Reputation : 35
Join date : 2012-12-15

http://maniacaldog.wix.com/keepdralive

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by runerback Sat 30 Aug 2014, 13:49

I'm using EDX and hotkey. So when press numpad0 the soldier will jump.
When spawned some objects at soldier's head position, this character will bend his legs, then destroy entity set which spawned before, this soldier will jump. In my code soldier will jump to ten meters tall air...

runerback

Location : China
Points : 153
Reputation : 5
Join date : 2014-06-18

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by TheGeneral Sat 30 Aug 2014, 14:06

sounds like a pretty cool achievement! well done!
TheGeneral
TheGeneral
Admin

Points : 780
Reputation : 35
Join date : 2012-12-15

http://maniacaldog.wix.com/keepdralive

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by runerback Sat 30 Aug 2014, 14:22

I uploaded a vedio about "jump" yesterday. Another is uploading.

Watch here

Be advised, poor quality... 

runerback

Location : China
Points : 153
Reputation : 5
Join date : 2014-06-18

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by John J. Stevens Sun 31 Aug 2014, 00:51

if spawning an object under a soldiers feet "bumped them up" a bit - I can see how that would feel a lot like a jump to the player
John J. Stevens
John J. Stevens
Admin

Location : WV/PA
Points : 285
Reputation : 22
Join date : 2012-12-19

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by runerback Tue 23 Sep 2014, 15:18

I want to use 'OFP:registerOnReconFunction()' for a sniper map, but it dosen't work until I put this function into Level.lua. How to use it in secondary scripts?

runerback

Location : China
Points : 153
Reputation : 5
Join date : 2014-06-18

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by tvig0r0us Tue 23 Sep 2014, 17:57

This is one of the rare instances when you will need to use Level.lua to script. The reason for this is that the game is coded to make these native calls to the level script. In most cases for the EDX they are also made on the waypoints script or I have created pointers to fire the native functions on the waypoints script. In the case of recon points, the function is specified by the user and therefore must be created on the level script since there is no mechanism built into the EDX to intercept the function call and redirect it to the other secondary scripts. One way to do this on your own is to create your function on the level script and inside of it use EDX:distributeFunction("yourFunctionName", "yourVars"...); This will fire a function on all scripts where the function exists by the name specified in the call. You can pass the variables straight from the function into distributeFunction call.  Hope this helps Smile

Cheers Very Happy
tvig0r0us
tvig0r0us
Admin

Location : Nky
Points : 266
Reputation : 29
Join date : 2013-10-16

http://www.moddb.com/members/tvig0r0us

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by runerback Wed 24 Sep 2014, 02:06

Thanks! I figured it out. Smile

I have another question about 'OFP:registerOnReconFunction()'. This function only return unitName which triggered reconFunction, but I want to know which target the player is aiming at in game. I regist reconFunction then insert the reconPointName to a table, so when the trigger function is called I will know which reconPoint is triggered. In this way I can only regist one reconFunction at the same time. Is there a better way?

runerback

Location : China
Points : 153
Reputation : 5
Join date : 2014-06-18

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by runerback Sun 28 Sep 2014, 05:52

When helicopters are hit, why 'onHit' event will be triggered twice?

runerback

Location : China
Points : 153
Reputation : 5
Join date : 2014-06-18

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by runerback Sun 05 Oct 2014, 02:47

I made a telepot system in game, maybe it's boring...

Download

runerback

Location : China
Points : 153
Reputation : 5
Join date : 2014-06-18

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by runerback Sun 05 Oct 2014, 06:38

One question about EDX:

I want to damage the unit who entered fire zone, and stop damaging when leave.
Code:
function onEnter(zoneName, unitName)
   if string.sub(zoneName,1,3)=='fir' then
      EDX:serialTimer('firedamage',100,zoneName, unitName)
   end
end

function firedamage(zone,victim,timerID)
   EDX:setTimer(timerID,160,victim)
   if OFP:isInTrigger(victim,zone) then
      OFP:damage(victim,gamedata.bodyzone[math.random(1,#gamedata.bodyzone)],1)
   else
      EDX:deleteTimerVar(timerID,zone,victim)
   end
end

But there is a wrong message...

runerback

Location : China
Points : 153
Reputation : 5
Join date : 2014-06-18

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by Palyarmerc Sun 05 Oct 2014, 13:36

I'm not using EDX, but with my limited scripting knowledge i have created this alternative

Assumes team1 as the Echelon name, with units us1 and us2 as players, and a triggerzone called firezone

Code:
        function onEnter_firezone(zoneName, unitName)  
          if OFP:isEchelon("team1") then
            OFP:displaySystemMessage("RADIATION...GET OUT OF HERE NOW...!!")
          OFP:addTimer("firezone",100)
          --repeating trigger, no OFP:disableEvent
           end
        end
      
        function  onTimer_firezone() 
        OFP:removeTimer("firezone");   -- not sure if this line is needed
           if OFP:isInTrigger("team1","firezone") then
            if OFP:isUnit("us1") then OFP:damage("us1","chestzone",5) end
            if OFP:isUnit("us2") then OFP:damage("us2","chestzone",5) end
            if OFP:isUnit("us3") then OFP:damage("us3","chestzone",5) end
            if OFP:isUnit("us4") then OFP:damage("us4","chestzone",5) end
          -- Repeat process     
          OFP:displaySystemMessage("...WARNING...WARNING !!")   
          OFP:addTimer("firezone",10000) 
         
          -------------------------------------------------------
        -- zonetiming =  OFP:getTimer ("firezone")
       --  zonetiming = zonetiming/1000;
        --  OFP:displaySystemMessage("Next Lethal Dose In "..zonetiming.."seconds")      
          ----------------------------------------------------------------------
         else
          --end process   
        OFP:removeTimer("firezone");  
       -- OFP:displaySystemMessage("..YOU ARE CLEAR OF THE ZONE...!!")
            end
     end
    
            function onLeave_firezone(zoneName, unitName) 
           if not OFP:isInTrigger("team1","firezone") then
                 OFP:displaySystemMessage("..YOU ARE CLEAR OF THE ZONE...!!")
           end
     
end
Palyarmerc
Palyarmerc

Location : Cheltenham
Points : 50
Reputation : 2
Join date : 2013-05-13

http://nomandown.co.uk

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by tvig0r0us Sun 05 Oct 2014, 15:23

runerback wrote:One question about EDX:

I want to damage the unit who entered fire zone, and stop damaging when leave.
Code:
function onEnter(zoneName, unitName)
   if string.sub(zoneName,1,3)=='fir' then
      EDX:serialTimer('firedamage',100,zoneName, unitName)
   end
end

function firedamage(zone,victim,timerID)
   EDX:setTimer(timerID,160,victim)
   if OFP:isInTrigger(victim,zone) then
      OFP:damage(victim,gamedata.bodyzone[math.random(1,#gamedata.bodyzone)],1)
   else
      EDX:deleteTimerVar(timerID,zone,victim)
   end
end

But there is a wrong message...
The error is in the EDX:setTimer function, you only reloaded one of the parameters. With the EDX you don't need to reload the parameters, but if you do you have to reload all of them. You also only need to pass the timerID in the delete timer function. Hope this helps.

Cheers Very Happy
tvig0r0us
tvig0r0us
Admin

Location : Nky
Points : 266
Reputation : 29
Join date : 2013-10-16

http://www.moddb.com/members/tvig0r0us

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by runerback Mon 06 Oct 2014, 05:49

Ah, I need a document about EDX, I think...

Below is the code, and EDX really make things simple.   Smile
Code:
--[[
firedamagezone={
   'headzone',
   'chestzone',
   'abdomenzone',
   'larmzone',
   'rarmzone',
   'llegzone',
   'rlegzone',
   'llegzone',
   'rlegzone'
}
--]]

function onEnter(zoneName, unitName)
   if string.sub(zoneName,1,3)=='fir' then
      EDX:serialTimer('firedamage',100,zoneName,unitName)
   end
end

function firedamage(zone,unit,timerID)
   EDX:setTimer(timerID,160)
   if OFP:isAlive(unit) and OFP:isInTrigger(unit,zone) then
      if OFP:isPlayer(unit) or OFP:isSecondaryPlayer(unit) then
         OFP:damage(unit,firedamagezone[math.random(1,#firedamagezone)],1)
      else
         OFP:damage(unit,firedamagezone[math.random(1,#firedamagezone)],3)
      end
   else
      EDX:deleteTimer(timerID)
   end
end

runerback

Location : China
Points : 153
Reputation : 5
Join date : 2014-06-18

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by runerback Sat 11 Oct 2014, 10:35

How to set timer with 10 ms? updateFrame is slow...

runerback

Location : China
Points : 153
Reputation : 5
Join date : 2014-06-18

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by tvig0r0us Sat 11 Oct 2014, 16:58

LOL... the game only processes at the speed of the frames. You're asking the engine to do something that it won't do. Why do you need a timer firing at 10ms?? That kind of speed would probably bring this game engine to it's knees, even if you could set a time that low. The smallest time you can get in this game is 100ms, no exceptions. Using update frame will get you a slight advantage over that, but you're putting a big load on the cpu when you use it, so I would suggest keeping that set aside for very special circumstances.
tvig0r0us
tvig0r0us
Admin

Location : Nky
Points : 266
Reputation : 29
Join date : 2013-10-16

http://www.moddb.com/members/tvig0r0us

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by runerback Sun 12 Oct 2014, 03:11

I want to let cameras follow a vehicle so I can record video in different perspective, but the vehicle will "shake" all the time, even if in updataFrame function... Maybe in a 10ms timer the camera will be smooth, I guess... Neutral

runerback

Location : China
Points : 153
Reputation : 5
Join date : 2014-06-18

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by runerback Sun 12 Oct 2014, 04:11

How to create cameras controlled by numpad?

Code:
   EDX:initCams()
   local id=EDX:createCamera()
   EDX:setCamera(id,'player',1,0,180,false)
   EDX:setCameraMotion(id,1,1,1,1)
   EDX:activateControlledCamera(id)
   --EDX:activateCamera(id)

These code is not right and nothing happened in game but id with value '1'... And I find there is no codes to controll cameras move such as move forware, left, right, back with numpad. In a word, I need some description about this model, really...

Code:
   --[[
   EDX:initCams()
   EDX:disableCams()
   EDX:createCamera()
   EDX:setCamera()
   EDX:setCameraMotion()
   EDX:setCameraTarget()
   EDX:setCameraFollowTarget()
   EDX:activateCamera()
   EDX:deactivateCamera()
   EDX:deleteCamera()
   EDX:camSnapShot()
   EDX:activateControlledCamera()
   EDX:displayCameraInfo()
   EDX:getCameraPosition()
   EDX:camMoveToTarget()
   EDX:camTargetEntity()
   --]]

runerback

Location : China
Points : 153
Reputation : 5
Join date : 2014-06-18

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by John J. Stevens Sun 19 Oct 2014, 08:50

Camera control requires the use of AUTOHOTKEY to pass the keyboard controls to your script - the editor does not have any native key capture events.  There is a default .AHK script provided in TVIGs EDx files and missions.

If you start looking into the well documented language of AUTOHOTKEY, you will also notice a number of other functions available that OFDR could never master like popup graphics or even custom menu systems.
John J. Stevens
John J. Stevens
Admin

Location : WV/PA
Points : 285
Reputation : 22
Join date : 2012-12-19

Back to top Go down

I have some questions to ask... - Page 3 Empty Re: I have some questions to ask...

Post by Sponsored content


Sponsored content


Back to top Go down

Page 3 of 3 Previous  1, 2, 3

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum