Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. function AIPlayer::Muttering(%this)
  2. {
  3. if (%this.mutterTime == 0) %this.mutterTime = $Sim::Time;
  4. if (($Sim::Time - %this.mutterTime)> %this.mutterFreq)
  5. {
  6. if (getrandom() < (%this.mutterProb))
  7. {
  8. %trackNum = getrandom(5);
  9. if (%this.irritated) %trackNum +=5;
  10. %track = %this.mutter @ %trackNum;
  11. ServerPlay3D(%track,%this.getTransform());
  12. }
  13. %this.mutterTime = $Sim::Time;
  14. }
  15. }
  16.  
  17.  
  18. //planning
  19. function AIPlayer::aiDecide(%this)
  20. {
  21. if(!isObject(%this)||(%this.getState() $="Dead")) return;
  22. %this.Muttering();
  23. //...
  24. }
  25.  
  26. function Player::playPain(%this)
  27. {
  28. %this.playAudio(0, %this.getDatablock().painsound);
  29. }
  30.  
  31. function PlayerData::onDamage(%this, %obj, %delta)
  32. {
  33. // This method is invoked by the ShapeBase code whenever the
  34. // object's damage level changes.
  35. if (%delta > 0 && %obj.getState() !$= "Dead")
  36. {
  37. // Apply a damage flash
  38. %obj.setDamageFlash(1);
  39.  
  40. %obj.damagemark+=%delta;
  41. // If the pain is excessive, let's hear about it.
  42. if ((%obj.damagemark > (%this.maxDamage/3))||(%delta > 10))
  43. %obj.playPain();
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement