Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function AIPlayer::Muttering(%this)
- {
- if (%this.mutterTime == 0) %this.mutterTime = $Sim::Time;
- if (($Sim::Time - %this.mutterTime)> %this.mutterFreq)
- {
- if (getrandom() < (%this.mutterProb))
- {
- %trackNum = getrandom(5);
- if (%this.irritated) %trackNum +=5;
- %track = %this.mutter @ %trackNum;
- ServerPlay3D(%track,%this.getTransform());
- }
- %this.mutterTime = $Sim::Time;
- }
- }
- //planning
- function AIPlayer::aiDecide(%this)
- {
- if(!isObject(%this)||(%this.getState() $="Dead")) return;
- %this.Muttering();
- //...
- }
- function Player::playPain(%this)
- {
- %this.playAudio(0, %this.getDatablock().painsound);
- }
- function PlayerData::onDamage(%this, %obj, %delta)
- {
- // This method is invoked by the ShapeBase code whenever the
- // object's damage level changes.
- if (%delta > 0 && %obj.getState() !$= "Dead")
- {
- // Apply a damage flash
- %obj.setDamageFlash(1);
- %obj.damagemark+=%delta;
- // If the pain is excessive, let's hear about it.
- if ((%obj.damagemark > (%this.maxDamage/3))||(%delta > 10))
- %obj.playPain();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement