Dev:SDK/Core - Combat

From Slavemaker Wiki
Jump to: navigation, search
<<first <prev SDK/Core - Combat next> last>>

SlaveMaker 3 SDK Combat

To fight a combat in the game there are several functions and classes

Weapons and Armour[edit]

Core Variables[edit]

worn armour
1 - Leather Armour
2 - Chain Mail
3 - Scale Mail
4 - Plate Armour
To equip armour just set
_root.ArmourType = 1;
equipped weapon
0 - Unarmed
1 - Sword
2 - Bow
3 - Whip
4 - Hammer
5 - Naginata
6 - Dagger
7 - Crossbow
To equip a weapon just set
_root.WeaponType = 1;


function IsWeaponOwned(weapon:Number) : Boolean
returns true if you own the weapon
function SetWeaponOwned(weapon:Number)
Set the weapon owned, but not equipped
function IsArmourOwned(armour:Number) : Boolean
return true if you own the armour
function SetArmourOwned(armour:Number)
Set the armour owned, but not equipped
function GetArmourName(armour:Number) : String
returns the name of the armour. Returns "" for unspecified values
Plate Armour
function GetWeaponName(weap:Number) : String
returns the name of the weapon

Fighting Combats[edit]


Start a new combat
function InitialiseCombat(startmsg:String, runawayevent:Number,

winevent:Number, loseeventhurt:Number, loseeventaroused:Number, sethealth:Boolean)

startmsg - text shown when you start fighting
runawayevent - event called when you run away
winevent - event called when you win
loseeventhurt - event when you lose by injury
loseeventaroused - event when you lose by orgasm
sethealth - true and the game initialises your health bar to your

constitution, otherwise remembers your injuries between combats, set to true for the first combat

_root.InitialiseCombat("You enter the chamber and a creature pulls free
and slides toward you."
, 145, 146, 125, 126);
function SetHealth(amt:Number)
Set or heal your slave makers health
If amt is not specified you are fully healed, otherwise increased by the

amount specified, to your maximum

Note: the sethealth parameter for InitialiseCombat
Add a tentacle monster to the combat, can be called many times to add

many monsters, you can mix monsters too

function AddMonsterTentacle(attack:Number, defence:Number,

health:Number, speed:Number, desc:String, image:Number)

attack - attack strength
defence - defence
health - hit points
speed - time between attacks, a starting Slave Maker = 30
desc - short description of the creature
image - specific image, optional, defaults to a random image
Add a Zombie, otherwise as above
function AddMonsterZombie(attack:Number, defence:Number, health:Number,

speed:Number, desc:String, image:Number)

Add a devil girl, otherwise as above
function AddMonsterDevilGirl(attack:Number, defence:Number,

health:Number, speed:Number, desc:String, image:Number)

Add a duel with Astrid, otherwise as above, but no image selection
function AddMonsterAstrid(attack:Number, defence:Number, health:Number,

speed:Number, desc:String)

Add a fight with a generic monster, you need to specify the movieclip for

the monsters image

function AddMonsterGeneric(attack:Number, defence:Number,

health:Number, speed:Number, desc:String, mc:MovieClip)

Custom Monsters[edit]

You can create your own monsters by extending the class Monster. It needs to be in the folder Scripts\Classes

Once you have done so call AddMonster to add to a combat

Add a custom monster to the combat, can be called many times to add many monsters
function AddMonster(newmonster:Monster)

eg create a duel with the knight

_root.AddMonster(new MonsterKnight(90, 90, 100, 20, "Knight"));
Class Monster
Members in grey should not be overridden. File is included in this SDK
// Monster - class defining a monster

class Scripts.Classes.Monster {
        private var MonsterAttack:Number;
        private var MonsterDefence:Number;
        private var MonsterHealth:Number;
        private var MonsterSpeed:Number;
        public var MonsterTempDefence:Number;
        public var MonsterNextAttack:Number;
        private var MonsterDescription:String;

        public function Monster(attack:Number, defence:Number, health:Number,
speed:Number, desc:String) {
                this.MonsterAttack = attack;
                this.MonsterDefence = defence;
                this.MonsterHealth = health;
                if (this.MonsterHealth > 100) this.MonsterHealth = 100;
                this.MonsterSpeed = speed;
                this.MonsterDefence = defence;
                this.MonsterDefence = defence;
                this.MonsterDescription = desc;
                this.MonsterTempDefence = defence;
                this.MonsterNextAttack = speed;
        // Show the image of the monster
        public function ShowMonster()
                _root.CombatCreatures._visible = true;
        // Hide the image of the monster
        public function HideMonster()
                _root.CombatCreatures._visible = false;
        public function GetDescription() : String
                return this.MonsterDescription;
        public function GetHealth() : Number
                return this.MonsterHealth;
        // Called when the monster is hit and damaged, dmg = number of health
points, stun = true if it is a stunning attack
        public function DamgeMonster(dmg:Number,  stun:Boolean)
                if (stun == true) {
                        this.MonsterNextAttack = this.MonsterNextAttack + dmg;
                } else {
                        this.MonsterHealth = this.MonsterHealth - dmg;
                        if (this.MonsterHealth < 0) this.MonsterHealth = 0;
        public function IsFighting() : Boolean
                return (this.MonsterHealth > 0);
        // called to play the sound when the monster is hit
        public function CombatHitSound()
                if (_root.SoundsOn) _root.Sounds.SoundGrowlPained.gotoAndPlay(2);
        protected function MonsterDoDamage(damage:Number, arousal:Number,
skill:Number, defence:Number, stun:Boolean) : Boolean
                if (defence != undefined) this.MonsterTempDefence = this.MonsterDefence
* defence;
                if (int(Math.random()*100) < (this.MonsterAttack * skill)) {
                        if (stun) {
                                _root.SMNextAttack = _root.SMNextAttack + 60;
                        } else {
                                var dmg:Number = ((this.MonsterAttack * damage) -
_root.SMCurrentDefence) + int(Math.random()*5);
                                if (dmg < 5) dmg = int(Math.random()*4) + 2;
                                if (dmg > 30) dmg = 30;
                                _root.SMHealth = _root.SMHealth - dmg;
                                if (_root.SMHealth < 0) _root.SMHealth = 0;
                                _root.SMLibido = _root.SMLibido + (this.MonsterAttack * arousal);
                                if (arousal > 0) {
                                        _root.SMNextAttack = _root.SMNextAttack + 10;
                                if (dmg > 30) _root.CombatHits.gotoAndStop(5);
                                else if (dmg > 0) _root.CombatHits.gotoAndStop(4);
                        return true;
                } else {
                        if (int(Math.random()*2) == 1)
_root.CombatMonsterAttacks.Miss1._visible = true;
                        else _root.CombatMonsterAttacks.Miss2._visible = true;
                        return false;
        // called when the monster is hit by you, weapon is the weapon type
described elsewhere, attact is zero based list of attacks
        public function Hit(weapon:Number, attack:Number)
        // called when the moster is missed by you
        public function Missed(weapon:Number, attack:Number)
        //called when the moster attacks
        public function Attack()
        // Called when you successfully run away
        public function RunAway()
        // called when you fail to run away
        public function FailedToRunAway()
        // called to reset any graphics or sounds for the monsters attacks
        public function ResetAttacks()

Start Combat[edit]

Do the event 3000 to start the combat sequence


_root.InitialiseCombat("You enter the chamber and a creature pulls free
and slides toward you."
, 311, 312, 313, 314, true);
_root.AddMonsterTentacle(40, 10, 50, 20, "Tentacle Creature");

Slave Girl Override Functions[edit]

Override this function in your slave girl's actionscript to customise the

list of attacks shown when fighting

function ShowAttackChoices(runmsg) : Boolean
runmsg - event for running away, normally 3200 or 0 if you cannot run
return true to customise the attacks, false to use the standard
function ShowAttackChoices(runmsg) : Boolean
        _root.AskHerQuestions(310, 311, 312, runmsg, "Lightning Bolt", "Fire
, "Dragon Slave", "Run Away", "What spell will you cast?");
        return true;

<<first <prev SDK/Core - Combat next> last>>