Really Fast Car

View previous topic View next topic Go down

Really Fast Car

Post by speak51 on Sat May 07, 2011 4:59 pm

Original model by kyata

Code:
// [RCD] F50kVer3/kyata
// X&ªFƒAƒNƒZƒ‹A©¨Fƒnƒ“ƒhƒ‹AZFƒuƒŒ[ƒLACFˆêŽž“I‚É‹­—̓_ƒEƒ“ƒtƒH[ƒX
// A/DFƒ_ƒEƒ“ƒtƒH[ƒX’²®Žã‚­/‹­‚­ V:’è’nù‰ñ@B:ƒRƒA—£’E
Val
{
AIR(default=1, min=1, max=30)
AIRH(default=0, max=20, step=2)
AIRH2(default=0, max=20)
AIRM(default=0, min=1, max=20)
BRK(default=0, max=220, step=50, disp=0)
ENG1(default=0, min=-70, max=100, step=10, disp=0)
ENG2(default=1, min=1, max=50, disp=0)
ENGFL(default=0, min=-60000, max=200000)
ENGFR(default=0, min=-60000, max=200000)
ENGINE(default=0, min=-60000, max=200000, disp=0)
ENGRL(default=0, min=-60000, max=200000)
ENGRR(default=0, min=-60000, max=200000)
FLBRK(default=0, max=2000)
FRBRK(default=0, max=2000)
HANDLE(default=0, min=-24, max=24, step=3)
LHANDLE(default=175, min=140, max=210)
RHANDLE(default=185, min=150, max=220)
RLBRK(default=0, max=2000)
RRBRK(default=0, max=2000)
}
Key
{
6:AIRH(step=4)
}
Body
{
Core(color=#000000) {
 N:Frame() {
  N:Frame() {
  N:Frame() {
    N:TrimF(angle=-90) {
    N:TrimF(angle=90) {
      W:Trim(angle=AIRM, color=#000000) {
      W:RudderF(angle=LHandle) {
        E:Wheel(angle=90, power=-EngFL, brake=FLbrk, effect=2, name=WFL) { }
      }
      N:Cowl(angle=-170, color=#000000) { }
      }
      E:Trim(angle=-AIRM, color=#000000) {
      E:RudderF(angle=RHandle) {
        W:Wheel(angle=90, power=EngFR, brake=FRbrk, effect=2, name=WFR) { }
      }
      N:Cowl(angle=-170, color=#000000) { }
      }
      N:Cowl(angle=-160) {
      W:Cowl(angle=-90, option=3) { }
      E:Cowl(angle=-90, option=4) { }
      N:Cowl(angle=-9, color=#000080) {
        N:Cowl(angle=-9, color=#000080) {
        W:Cowl(angle=-90, option=4, color=#000080) { }
        E:Cowl(angle=-90, option=3, color=#000080) { }
        N:Cowl() {
          N:Cowl() {
          E:Cowl(angle=-90) { }
          }
          E:Cowl(angle=-90) { }
        }
        E:Cowl(angle=-90) { }
        W:Cowl(angle=-90) {
          N:Cowl() {
          N:Cowl() {
            W:Cowl(angle=-90) {
            S:Cowl() {
              S:Cowl() { }
            }
            }
          }
          }
        }
        }
        W:Cowl(angle=-90, option=3, color=#000080) { }
        E:Cowl(angle=-90, option=4, color=#000080) { }
        E:Cowl(angle=-90) { }
        W:Cowl(angle=-90) {
        W:Cowl(angle=-90) { }
        }
      }
      }
    }
    N:Chip(angle=HANDLE) { }
    }
  }
  }
  E:Trim(angle=-AIRM, color=#000000) {
  E:Wheel(angle=90, power=EngRR, brake=RRbrk, effect=3, name=WRR) { }
  S:Trim(angle=-90, color=#000000) {
    W:Cowl(angle=90) {
    W:Cowl() { }
    }
  }
  N:Cowl(angle=19, color=#000000) { }
  }
  W:Trim(angle=AIRM, color=#000000) {
  S:Trim(angle=-90, color=#000000) { }
  W:Wheel(angle=90, power=-EngRL, brake=RLbrk, effect=3, name=WRL) { }
  N:Cowl(angle=19, color=#000000) { }
  }
 }
}
}
Lua
{

function handle()--ƒnƒ“ƒhƒ‹--------------------------------
if(_KEY(2)==1 and _KEY(3)==0)then HANDLE=HANDLE-2 end
if(_KEY(3)==1 and _KEY(2)==0)then HANDLE=HANDLE+2 end
if(HANDLE > 0)then
 RHANDLE = HANDLE + 185
 LHANDLE = HANDLE + 175
else
 RHANDLE = HANDLE + 185
 LHANDLE = HANDLE + 175
end
end

def=0.28

function engine()--ƒGƒ“ƒWƒ“o—Í---------------------------------------
if((_KEY(5)==1 or _KEY(0)==1)and _KEY(1)==0)then ENG1=ENG1+5 end
if(_KEY(1)==1 and _KEY(5)==0 and _KEY(0)==0)then ENG1=ENG1-5 end


ENG2=1.0+(math.abs(_VZ(1))*0.035)--‘¬“x‚ɉž‚¶‚ďo—͂𒲐®
ENGINE=(ENG1*100)*ENG2

if(HANDLE<0 and _VZ(1)<0) then  engl=ENGINE*(1-def); engr=ENGINE*(1+def)
elseif(HANDLE>0 and _VZ(1)<0) then engr=ENGINE*(1-def); engl=ENGINE*(1+def)
else          engl=ENGINE    ; engr=ENGINE end

--engl=ENGINE; engr=ENGINE
trc()

end

slip={}
tc={}
bc={}

function trc()

trcstat="on"
for i=1,4 do
 if slip[i]>3.65 then
  trcstat="off"
  tc[i]=math.max(3.0/slip[i],0.1)
 else
  tc[i]=1
 end
end
if ENG1==0 then trcstat="on" end


ENGFL=engl*tc[1]
ENGFR=engr*tc[2]

ENGRL=engl*tc[3]
ENGRR=engr*tc[4]


end

function brake()
if _KEY(4)==1 then BRK=BRK+30 end

absstat="on"
if _VZ(1)<-3 then
 for i=1,4 do
  if slip[i]<3.3 then
  absstat="off"
  bc[i]=math.max(slip[i]/(3.35),0.1)
  else
  bc[i]=1
  end
 end
else
 bc={1,1,1,1}
end

if BRK==0 then absstat="on" end

FLBRK=BRK*bc[1]
FRBRK=BRK*bc[2]
             
RLBRK=BRK*bc[3]
RRBRK=BRK*bc[4]

end

function teiti()--’è’nù‰ñ----------------------------------------------

if(_KEY(2)==1) then
 engl=-8000
 engr=8000
elseif (_KEY(3)==1) then
 engl=8000
 engr=-8000
else
 engl = 0
 engr = 0
end

ENGFL=engl
ENGFR=engr
ENGRL=engl
ENGRR=engr
end

function main()
vel=math.sqrt( _VX(1)^2 + _VY(1)^2 + _VZ(1)^2 )

if _KEY(11)==1 then
 _SPLIT(1)
end

AIR = 200 - vel
AIR = AIR / 10
AIRM = AIR + AIRH

if _KEY(2)==1 or _KEY(3)==1 then
 AIRH2 = 20 - AIR
 AIRH2 = AIRH2 / 15
 AIRH = AIRH + AIRH2
end

if _VZ(1)==0 then
 for i=1,i<4 do
  slip[i]=0
 end
else
 slip[1]=math.abs(_WY(WFL)/_VZ(1))
 slip[2]=math.abs(_WY(WFR)/_VZ(1))
 slip[3]=math.abs(_WY(WRL)/_VZ(1))
 slip[4]=math.abs(_WY(WRR)/_VZ(1))
end


handle() --ƒXƒeƒAƒŠƒ“ƒO

if _KEY(10) == 1 then
 teiti() --’è’nù‰ñ
else
 engine() --ƒGƒ“ƒWƒ“ƒpƒ[
end

brake()

dmy=_ZOOM(80)

out(0,string.format("&FPS:%2.1f  SPEED:%.2f",_FPS(),vel*3.6))
end
}


avatar
speak51
Car
Car

Posts : 9
Join date : 2011-05-07

View user profile

Back to top Go down

Re: Really Fast Car

Post by Timothy Ashtön on Sat May 07, 2011 8:18 pm

Welcome to RC/LB forums. Though we use an code box instead of posting the entire code loosely. [code] *your chip code here* [/kode] ( c not k the second one to make it work)

Another thing, I know this code, it's a Japanese model please be sure to mention somewhere in your topic post so other don't accidentally mistake that.
avatar
Timothy Ashtön
Walker
Walker

Posts : 289
Join date : 2010-07-17
Age : 25
Location : Ontario

View user profile http://wildfrontierguidecomplete.blogspot.com/

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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