Guest User

fsedcxzedscx

a guest
Feb 11th, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.63 KB | None | 0 0
  1.  
  2. datablock AudioProfile(PitchforkactivateSound)
  3. {
  4. filename = "./activate.wav";
  5. description = AudioClose3d;
  6. preload = true;
  7. };
  8.  
  9. datablock AudioProfile(pitchforkhitSound)
  10. {
  11. filename = "./pitchforkhit.wav";
  12. description = AudioClose3d;
  13. preload = true;
  14. };
  15.  
  16. //effects
  17. datablock ParticleData(PitchforkExplosionParticle)
  18. {
  19. dragCoefficient = 2;
  20. gravityCoefficient = 1.0;
  21. inheritedVelFactor = 0.2;
  22. constantAcceleration = 0.0;
  23. spinRandomMin = -90;
  24. spinRandomMax = 90;
  25. lifetimeMS = 500;
  26. lifetimeVarianceMS = 300;
  27. textureName = "base/data/particles/chunk";
  28. colors[0] = "0.7 0.7 0.9 0.9";
  29. colors[1] = "0.9 0.9 0.9 0.0";
  30. sizes[0] = 0.5;
  31. sizes[1] = 0.25;
  32. };
  33. datablock ParticleEmitterData(PitchforkExplosionEmitter)
  34. {
  35. ejectionPeriodMS = 7;
  36. periodVarianceMS = 0;
  37. ejectionVelocity = 8;
  38. velocityVariance = 1.0;
  39. ejectionOffset = 0.0;
  40. thetaMin = 0;
  41. thetaMax = 60;
  42. phiReferenceVel = 0;
  43. phiVariance = 360;
  44. overrideAdvance = false;
  45. particles = "PitchforkExplosionParticle";
  46.  
  47. uiName = "Pitchfork Hit";
  48. };
  49.  
  50. datablock ExplosionData(PitchforkExplosion)
  51. {
  52. //explosionShape = "";
  53. lifeTimeMS = 500;
  54.  
  55. soundProfile = PitchforkHitSound;
  56.  
  57. particleEmitter = PitchforkExplosionEmitter;
  58. particleDensity = 10;
  59. particleRadius = 0.2;
  60.  
  61. faceViewer = true;
  62. explosionScale = "1 1 1";
  63.  
  64. shakeCamera = true;
  65. camShakeFreq = "20.0 22.0 20.0";
  66. camShakeAmp = "1.0 1.0 1.0";
  67. camShakeDuration = 0.5;
  68. camShakeRadius = 10.0;
  69.  
  70. // Dynamic light
  71. lightStartRadius = 3;
  72. lightEndRadius = 0;
  73. lightStartColor = "00.0 0.2 0.6";
  74. lightEndColor = "0 0 0";
  75. };
  76.  
  77.  
  78.  
  79.  
  80.  
  81. //Pitchfork trail
  82.  
  83.  
  84.  
  85.  
  86.  
  87. //projectile
  88. AddDamageType("PitchforkDirect", '<bitmap:add-ons/Weapon_Pitchfork/CI_Pitchfork> %1', '%2 <bitmap:add-ons/Weapon_Pitchfork/CI_Pitchfork> %1',1,1);
  89.  
  90. datablock ProjectileData(PitchforkProjectile)
  91. {
  92.  
  93. directDamage = 30;
  94. directDamageType = $DamageType::PitchforkDirect;
  95.  
  96. explosion = PitchforkExplosion;
  97. //particleEmitter = PitchforkExplosionEmitter;
  98.  
  99. muzzleVelocity = 50;
  100. velInheritFactor = 1;
  101.  
  102. armingDelay = 0;
  103. lifetime = 100;
  104. fadeDelay = 70;
  105. bounceElasticity = 0;
  106. bounceFriction = 0;
  107. isBallistic = false;
  108. gravityMod = 0.0;
  109.  
  110. hasLight = false;
  111. lightRadius = 3.0;
  112. lightColor = "0 0 0.5";
  113. };
  114.  
  115. //////////
  116. // item //
  117. //////////
  118. datablock ItemData(PitchforkItem)
  119. {
  120. category = "Weapon"; // Mission editor category
  121. className = "Weapon"; // For inventory system
  122.  
  123. // Basic Item Properties
  124. shapeFile = "./Pitchfork.dts";
  125. mass = 1;
  126. density = 0.2;
  127. elasticity = 0.2;
  128. friction = 0.6;
  129. emap = true;
  130.  
  131. //gui stuff
  132. uiName = "Pitchfork";
  133. iconName = "./Pitchfork";
  134. doColorShift = false;
  135. colorShiftColor = "0.400 0.196 0 1.000";
  136.  
  137. // Dynamic properties defined by the scripts
  138. image = PitchforkImage;
  139. canDrop = true;
  140. };
  141.  
  142. //function butterflyknife::onUse(%this,%user)
  143. //{
  144. // //mount the image in the right hand slot
  145. // %user.mountimage(%this.image, $RightHandSlot);
  146. //}
  147.  
  148. ////////////////
  149. //weapon image//
  150. ////////////////
  151. datablock ShapeBaseImageData(PitchforkImage)
  152. {
  153. // Basic Item properties
  154. shapeFile = "./Pitchfork.dts";
  155. emap = true;
  156.  
  157. // Specify mount point & offset for 3rd person, and eye offset
  158. // for first person rendering.
  159. mountPoint = 0;
  160. offset = "0 0 0";
  161. //eyeOffset = "0.1 0.2 -0.55";
  162.  
  163. // When firing from a point offset from the eye, muzzle correction
  164. // will adjust the muzzle vector to point to the eye LOS point.
  165. // Since this weapon doesn't actually fire from the muzzle point,
  166. // we need to turn this off.
  167. correctMuzzleVector = true;
  168.  
  169. // Add the WeaponImage namespace as a parent, WeaponImage namespace
  170. // provides some hooks into the inventory system.
  171. className = "WeaponImage";
  172.  
  173. // Projectile && Ammo.
  174. item = PitchforkItem;
  175. ammo = " ";
  176. projectile = PitchforkProjectile;
  177. projectileType = Projectile;
  178.  
  179. //melee particles shoot from eye node for consistancy
  180. melee = false;
  181. //raise your arm up or not
  182. armReady = true;
  183.  
  184. //casing = " ";
  185. doColorShift = true;
  186. colorShiftColor = "0.400 0.196 0 1.000";
  187.  
  188. // Images have a state system which controls how the animations
  189. // are run, which sounds are played, script callbacks, etc. This
  190. // state system is downloaded to the client so that clients can
  191. // predict state changes and animate accordingly. The following
  192. // system supports basic ready->fire->reload transitions as
  193. // well as a no-ammo->dryfire idle state.
  194.  
  195. // Initial start up state
  196. stateName[0] = "Activate";
  197. stateTimeoutValue[0] = 0.1;
  198. stateTransitionOnTimeout[0] = "Ready";
  199. stateSequence[0] = "ready";
  200. stateSound[0] = pitchforkactivateSound;
  201.  
  202. stateName[1] = "Ready";
  203. stateTransitionOnTriggerDown[1] = "Charge";
  204. stateAllowImageChange[1] = true;
  205.  
  206. stateName[2] = "Charge";
  207. stateTransitionOnTimeout[2] = "Armed";
  208. stateTimeoutValue[2] = 0.7;
  209. stateWaitForTimeout[2] = false;
  210. stateTransitionOnTriggerUp[2] = "AbortCharge";
  211. stateScript[2] = "onCharge";
  212. stateAllowImageChange[2] = false;
  213.  
  214. stateName[3] = "AbortCharge";
  215. stateTransitionOnTimeout[3] = "Ready";
  216. stateTimeoutValue[3] = 0.3;
  217. stateWaitForTimeout[3] = true;
  218. stateScript[3] = "onAbortCharge";
  219. stateAllowImageChange[3] = false;
  220. stateSound[3] = pitchforkhitSound;
  221.  
  222. stateName[4] = "Armed";
  223. stateTransitionOnTriggerUp[4] = "Fire";
  224. stateAllowImageChange[4] = false;
  225.  
  226. stateName[5] = "Fire";
  227. stateTransitionOnTimeout[5] = "Ready";
  228. stateTimeoutValue[5] = 0.5;
  229. stateFire[5] = true;
  230. stateSequence[5] = "fire";
  231. stateScript[5] = "onFire";
  232. stateWaitForTimeout[5] = true;
  233. stateAllowImageChange[5] = false;
  234. stateSound[5] = pitchforkhitSound;
  235. stateName[5] = "Fire";
  236. stateSound[5] = pitchforkhitSound;
  237. };
  238.  
  239. function Pitchforkprojectile::onCollision(%this, %obj, %col, %fade, %pos, %normal, %velocity)
  240. {
  241. Parent::onCollision(%this, %obj, %col, %fade, %pos, %normal, %velocity);
  242.  
  243. ServerPlay3D(pitchforkhitSound, %pos);
  244. }
  245.  
  246. function pitchforkImage::onCharge(%this, %obj, %slot)
  247. {
  248. %obj.playthread(2, spearReady);
  249. }
  250.  
  251. function pitchforkImage::onAbortCharge(%this, %obj, %slot)
  252. {
  253. %obj.playthread(2, root);
  254. }
  255.  
  256.  
  257.  
  258. function PitchforkImage::onFire(%this, %obj, %slot)
  259. {
  260. %obj.playthread(2, spearThrow);
  261. Parent::onFire(%this, %obj, %slot);
  262. }
  263. function PitchforkImage::onFiretwo(%this,%obj,%slot)
  264. {
  265.  
  266.  
  267.  
  268. %projectile = Pitchforkprojectile;
  269. %spread = 0.00001;
  270. %shellcount = 1;
  271.  
  272. for(%shell=0; %shell<%shellcount; %shell++)
  273. {
  274. %vector = %obj.getMuzzleVector(%slot);
  275. %objectVelocity = %obj.getVelocity();
  276. %vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
  277. %vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
  278. %velocity = VectorAdd(%vector1,%vector2);
  279. %x = (getRandom() - 0.5) * 2 * 3.1415926 * %spread;
  280. %y = (getRandom() - 0.5) * 2 * 3.1415926 * %spread;
  281. %z = (getRandom() - 0.5) * 2 * 3.1415926 * %spread;
  282. %mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
  283. %velocity = MatrixMulVector(%mat, %velocity);
  284.  
  285. %p = new (%this.projectileType)()
  286. {
  287. dataBlock = %projectile;
  288. initialVelocity = %velocity;
  289. initialPosition = %obj.getMuzzlePoint(%slot);
  290. sourceObject = %obj;
  291. sourceSlot = %slot;
  292. client = %obj.client;
  293. };
  294. MissionCleanup.add(%p);
  295. }
  296. return %p;
  297. }
Advertisement
Add Comment
Please, Sign In to add comment