Guest User

Untitled

a guest
Feb 21st, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. unction SetActorWeapon(AI.ActorInstance, MeshID)
  2.  
  3.     ; Free existing mesh if there is one
  4.     If AI\WeaponEN <> 0
  5.         FreeEntityEmitters(AI\WeaponEN)
  6.         FreeEntity(AI\WeaponEN)
  7.         AI\WeaponEN = 0
  8.     EndIf
  9.  
  10.     If MeshID > -1 And MeshID < 65535
  11.         AI\WeaponEN = GetMesh(MeshID)
  12.         Name$ = Upper$(GetMeshName$(MeshID))
  13.         If AI\WeaponEN = 0 Then RuntimeError("Could not load weapon mesh!")
  14.         EntityAutoFade(AI\WeaponEN, nearFadeModifier * CameraViewRange, farFadeModifier * CameraViewRange)
  15.         RHand = FindChild(AI\EN, "R_Hand")
  16.         If RHand = 0 Then RuntimeError(AI\Actor\Race$ + " actor mesh is missing an 'R_Hand' joint!")
  17.         EntityParent AI\WeaponEN, RHand, False
  18.         PositionEntity AI\WeaponEN, LoadedMeshX#(MeshID), LoadedMeshY#(MeshID), LoadedMeshZ#(MeshID)
  19.         ScaleEntity AI\WeaponEN, LoadedMeshScales#(MeshID), LoadedMeshScales#(MeshID), LoadedMeshScales#(MeshID)
  20.         ; Correct rotation for Max models
  21.         If AI\TeamID = True Then TurnEntity AI\WeaponEN, 0, 180, 90
  22.         CreateEntityEmitters(AI\WeaponEN)
  23.         ;! New Lights
  24.         If Instr(Name$, "LIGHTS\")
  25.             range# = 20
  26.             L.Lights = New Lights
  27.             L\EN = CreateLight(2, AI\WeaponEN)
  28.             LightColor(L\EN, 0, 0, 255)
  29.             LightRange L\EN,range
  30.             PositionEntity L\EN, LoadedMeshX#(MeshID), LoadedMeshY#(MeshID), LoadedMeshZ#(MeshID)
  31.             NameEntity(L\EN, Handle(L))
  32.             ShadowLight L\EN
  33.         EndIf
  34.     EndIf
  35.  
  36. End Function
Add Comment
Please, Sign In to add comment