Frame 1
function GetTimeStamp() {
var _local1 = new Date();
var _local2 = _local1.getTime();
return(_local2);
}
function MinMax(val, min, max) {
if (val > max) {
val = max;
}
if (val < min) {
val = min;
}
return(val);
}
function StatusTube(target, percent) {
var _local1 = Math.ceil((percent * target._totalframes) / 100);
_local1 = MinMax(_local1, 1, target._totalframes);
target.gotoAndStop(_local1);
}
function Preloader() {
this.total = _root.getBytesTotal();
this.loaded = 0;
this.percentage = 0;
this.startTime = GetTimeStamp();
}
Preloader.prototype.update = function () {
this.loaded = _root.getBytesLoaded();
this.percentage = (this.loaded / this.total) * 100;
return(this.loaded >= this.total);
};
var pl = new Preloader();
Frame 2
_global.UPSELL_BUY = "";
_global.UPSELL_DOWNLOAD = "";
_global.UPSELL_TARGET = "";
XMLNode.prototype.findNode = function (name, id) {
var _local2 = this.firstChild;
while (_local2) {
if (_local2.nodeName == name) {
if ((id != null) && (_local2.attributes.id != id)) {
_local2 = _local2.nextSibling;
continue;
}
return(_local2);
}
_local2 = _local2.nextSibling;
}
return(null);
};
var xml = new XML();
xml.onLoad = function (success) {
if (!success) {
UPSELL_BUY = "http://www.ldwsoftware.com/";
UPSELL_DOWNLOAD = "http://www.ldwsoftware.com/";
UPSELL_TARGET = "_parent";
return(undefined);
}
var _local3 = this.firstChild;
while (_local3) {
var _local4 = _local3.nodeName.toLowerCase();
var _local2 = _local3.firstChild;
if (_local4 == "links") {
_local3 = _local2;
} else if (_local4 == "buy") {
if (_local2.nodeValue) {
UPSELL_BUY = _local2.nodeValue.toString();
}
} else if (_local4 == "download") {
if (_local2.nodeValue) {
UPSELL_DOWNLOAD = _local2.nodeValue.toString();
}
} else if (_local4 == "target") {
if (_local2.nodeValue) {
UPSELL_TARGET = _local2.nodeValue.toString();
}
}
_local3 = _local3.nextSibling;
}
};
xml.load("links.xml");
var xmlHelp = new XML();
xmlHelp.load("help.xml");
Frame 4
play();
if (pl.update()) {
if ((GetTimeStamp() - pl.startTime) > 0) {
delete pl;
gotoAndPlay ("scripts");
}
}
StatusTube(progressBar, pl.percentage);
Frame 5
prevFrame();
Frame 9
_global.VERSION = 0.93;
_global.SHARED_OBJECT = "virtualvillagers" + VERSION;
_global.SCREEN_WIDTH = 580;
_global.SCREEN_HEIGHT = 450;
_global.DEBUG = 0;
_global.AMBIENT = 1;
if (DEBUG) {
_global.TRACE_MOUSE = 0;
_global.TRACE_PATH = 1;
_global.SHOW_PATHS = 1;
}
_global.ONE_SECOND = 1000;
_global.FIVE_SECONDS = 1 * ONE_SECOND;
_global.ONE_MINUTE = 60 * ONE_SECOND;
_global.FIVE_MINUTES = ONE_MINUTE * 5;
_global.TEN_MINUTES = ONE_MINUTE * 10;
_global.FIFTEEN_MINUTES = ONE_MINUTE * 15;
_global.TWENTY_MINUTES = ONE_MINUTE * 20;
_global.ONE_HOUR = ONE_MINUTE * 60;
_global.ONE_DAY = ONE_HOUR * 24;
_global.DORMANT = ONE_DAY * 2;
_global.UPDATE_INTERVAL = ONE_MINUTE;
_global.TUTORIAL_DELAY = 3;
_global.TSCALE_ONE_YEAR = ONE_HOUR;
_global.TSCALE_SIX_MONTHS = TSCALE_ONE_YEAR / 2;
_global.AGE_TO_BIRTH = 1;
_global.AGE_TO_TEEN = 14;
_global.AGE_TO_ADULT = 18;
_global.AGE_TO_ELDERLY = 50;
_global.AGE_TO_MORTALITY = 60;
_global.FOOD_CONSUMPTION = 2;
_global.FOOD_LOW_LEVEL = 50;
_global.FOOD_OK_LEVEL = 400;
_global.FOOD_ABUNDANT = 2000;
_global.CHANCE_HEAL = 50;
_global.CHANCE_DISEASE_DAMAGE = 70;
_global.CHANCE_STARVE_DAMAGE = 75;
_global.HEALTH_MERCY = 20;
_global.STAND_SPEED = 0.8;
_global.WALK_SPEED = 1.5;
_global.RUN_SPEED = 6;
_global.SCROLL_LENGTH = 10;
_global.SCROLL_SPEED = 8;
var DIR_EAST = 0;
var DIR_SOUTH = 1;
var DIR_WEST = 2;
var DIR_NORTH = 3;
_global.NOWHERE = 0;
_global.OPEN_FIELD = 1;
_global.BUSH = 2;
_global.TABLE = 3;
_global.NEW_HUT = 4;
_global.MAIN_HUT = 5;
_global.SMALL_HUT = 6;
_global.FOOD_BASKET = 7;
_global.LAUNTRY_HUT = 8;
_global.FARM_FIELD = 9;
_global.WELL = 10;
_global.FOOD_BASKET_EAT = 11;
_global.RUINS = 12;
_global.STATUE = 13;
_global.ROCKS = 14;
_global.STORAGE = 15;
_global.STORAGE_WELL = 16;
_global.DEBRIS = 17;
_global.BOULDER = 18;
_global.STORAGE_DEBRIS = 19;
_global.CACTUS = 20;
_global.PLANT = 21;
_global.LILY = 22;
_global.ROSE = 23;
_global.LARGE_ROCK = 24;
_global.WHITE_SAND = 25;
_global.NOTHING = 0;
_global.FORAGING = 1;
_global.FARMING = 2;
_global.WATER_FIELD = 3;
_global.CLEARING_ROCKS = 4;
_global.RESEARCHING = 5;
_global.BREEDING = 6;
_global.STROLLING = 7;
_global.CLEARING_WELL = 8;
_global.DISCOVER_SCHOOL = 9;
_global.CLEARING_DEBRIS = 10;
_global.STORING_FOOD = 11;
_global.PUSHING_BOULDER = 12;
_global.STUDY_STATUE = 13;
_global.EATING = 14;
_global.BUILDING_HUT = 15;
_global.GOING_INDOORS = 16;
_global.CONFUSED = 17;
_global.CURIOUS_RUINS = 18;
_global.CURIOUS_ROCK = 19;
_global.CURIOUS_PLANT = 20;
_global.CURIOUS_CACTUS = 21;
_global.CURIOUS_ROSE = 22;
_global.CURIOUS_LILY = 23;
_global.RUNNING_AWAY = 24;
_global.PUSH_BOULDER = 25;
_global.ACTION_NOTHING = 0;
_global.ACTION_WALK = 1;
_global.ACTION_CROUCH = 2;
_global.ACTION_WORK = 3;
_global.ACTION_SIT = 4;
_global.ACTION_COMMIT = 5;
_global.ACTION_STAND = 6;
_global.ITEM_BERRIES = 2;
_global.ITEM_ROCK = 3;
_global.ITEM_VEGGIES = 4;
_global.ITEM_BABY = 5;
_global.ITEM_LOG = 6;
_global.ITEM_WATER = 12;
_global.ITEM_SKELS = 13;
_global.FARMER = 0;
_global.BUILDER = 1;
_global.RESEARCHER = 2;
_global.HEALER = 3;
_global.BREEDER = 4;
_global.PRIEST = 5;
_global.LEVEL_TRAINEE = 10;
_global.LEVEL_ADEPT = 40;
_global.LEVEL_MASTER = 80;
_global.UNTRAINED = 6;
_global.CENTER_X = 566;
_global.CENTER_Y = 498;
_global.PATH_ACCURACY = 30;
_global.PATH_WALKAROUND = PATH_ACCURACY * (100 / PATH_ACCURACY);
_global.MAX_BERRIES = 2000;
_global.PARTICLE_INDEX = 1500;
Frame 10
function CPoint(x, y, z) {
this.x = x;
this.y = y;
this.z = z;
if (z == null) {
this.z = 0;
}
}
function SetPoint(p, x, y, z) {
p.x = Number(x);
p.y = Number(y);
p.z = Number(z);
}
function CreatePoint(x, y, z) {
var _local1 = new CPoint();
SetPoint(_local1, x, y, z);
return(_local1);
}
function CopyPoint(p) {
return(CreatePoint(p.x, p.y, p.z));
}
function OffsetPoint(p, Offset) {
p.x = p.x + Offset.x;
p.y = p.y + Offset.y;
p.z = p.z + Offset.z;
}
function ScalePoint(p, s) {
p.x = p.x * s;
p.y = p.y * s;
p.z = p.z * s;
}
function GetLength(p) {
return(Math.sqrt(((p.x * p.x) + (p.y * p.y)) + (p.z * p.z)));
}
function GetLengthXY(p) {
return(Math.sqrt((p.x * p.x) + (p.y * p.y)));
}
function GetDistance(p1, p2) {
var _local2 = p1.x - p2.x;
var _local1 = p1.y - p2.y;
return(Math.sqrt((_local2 * _local2) + (_local1 * _local1)));
}
function GetQuickDistance(p1, p2) {
var _local2 = p1.x - p2.x;
var _local1 = p1.y - p2.y;
return((_local2 * _local2) + (_local1 * _local1));
}
function GetDistance3D(p1, p2) {
var _local3 = p1.x - p2.x;
var _local2 = p1.y - p2.y;
var _local1 = p1.z - p2.z;
return(Math.sqrt(((_local3 * _local3) + (_local2 * _local2)) + (_local1 * _local1)));
}
function GetSlope(p1, p2) {
return((p2.y - p1.y) / (p2.x - p1.x));
}
function NormalizePoint(p) {
var _local1 = GetLength(p);
if (_local1 == 0) {
return(undefined);
}
p.x = p.x / _local1;
p.z = p.z / _local1;
p.y = p.y / _local1;
}
function AimTo(from, to) {
var _local1 = CopyPoint(to);
_local1.x = _local1.x - from.x;
_local1.y = _local1.y - from.y;
_local1.z = _local1.z - from.z;
NormalizePoint(_local1);
return(_local1);
}
function GetDirection(vector) {
if (!vector) {
var _local2 = Math.random() * 100;
if (_local2 < 50) {
return(DIR_SOUTH);
}
return(DIR_WEST);
}
if (vector.x > 0) {
if (vector.y > 0) {
return(DIR_SOUTH);
}
return(DIR_EAST);
}
if (vector.y > 0) {
return(DIR_WEST);
}
return(DIR_NORTH);
}
function CRect(l, t, r, b) {
this.left = l;
this.top = t;
this.right = r;
this.bottom = b;
}
function GetWidth(r) {
return(r.right - r.left);
}
function GetHeight(r) {
return(r.bottom - r.top);
}
function PointInRect(r, p) {
return((((r.left <= p.x) && (r.top <= p.y)) && (r.right >= p.x)) && (r.bottom >= p.y));
}
function RectIntersect(r1, r2) {
if (PointInRect(r1, new CPoint(r2.left, r2.top))) {
return(true);
}
if (PointInRect(r1, new CPoint(r2.left, r2.bottom))) {
return(true);
}
if (PointInRect(r1, new CPoint(r2.right, r2.top))) {
return(true);
}
if (PointInRect(r1, new CPoint(r2.right, r2.bottom))) {
return(true);
}
return(false);
}
function DrawLine(target, p1, p2, color) {
target.lineStyle(1, color, 255);
target.moveTo(p1.x, p1.y);
target.lineTo(p2.x, p2.y);
}
function DrawRect(target, rect, color) {
target.lineStyle(2, color, 255);
target.moveTo(rect.left, rect.top);
target.lineTo(rect.right, rect.top);
target.lineTo(rect.right, rect.bottom);
target.lineTo(rect.left, rect.bottom);
target.lineTo(rect.left, rect.top);
}
function DrawCircle(target, pos, radius, color) {
var _local2 = pos.x;
var _local1 = pos.y;
var _local3 = radius;
var _local6 = _local3 * 0.414213562373095;
var _local5 = (_local3 * Math.SQRT2) / 2;
target.lineStyle(2, color, 255);
target.moveTo(_local2 + _local3, _local1);
target.curveTo(_local2 + _local3, _local1 + _local6, _local2 + _local5, _local1 + _local5);
target.curveTo(_local2 + _local6, _local1 + _local3, _local2, _local1 + _local3);
target.curveTo(_local2 - _local6, _local1 + _local3, _local2 - _local5, _local1 + _local5);
target.curveTo(_local2 - _local3, _local1 + _local6, _local2 - _local3, _local1);
target.curveTo(_local2 - _local3, _local1 - _local6, _local2 - _local5, _local1 - _local5);
target.curveTo(_local2 - _local6, _local1 - _local3, _local2, _local1 - _local3);
target.curveTo(_local2 + _local6, _local1 - _local3, _local2 + _local5, _local1 - _local5);
target.curveTo(_local2 + _local3, _local1 - _local6, _local2 + _local3, _local1);
}
function RandomPointInRect(rect) {
var _local3 = rect.left + Math.round(GetWidth(rect) * Math.random());
var _local2 = rect.top + Math.round(GetHeight(rect) * Math.random());
return(new CPoint(_local3, _local2));
}
function InArray(arr, text) {
var _local1 = 0;
while (_local1 < arr.length) {
var _local2 = arr[_local1];
if (_local2 == text) {
return(true);
}
_local1++;
}
return(false);
}
function CreateParticle(target, template, level, x, y) {
var _local2 = "gPtx" + level;
target.attachMovie(template, _local2, level);
var _local1 = target[_local2];
if (!_local1) {
return(null);
}
_local1._x = x;
_local1._y = y;
return(_local1);
}
function Rnd(n) {
return(Math.floor(Math.random() * n));
}
function BoolRnd(n) {
return(Rnd(100) > n);
}
function ControlLock(show) {
controlLock._visible = show;
}
function GetGlobalPoint(mc) {
var _local2 = new CPoint(mc._x, mc._y);
if (mc._parent) {
OffsetPoint(_local2, GetGlobalPoint(mc._parent));
}
return(_local2);
}
CPoint.prototype.toString = function () {
var _local3 = this.x;
var _local2 = this.y;
var _local4 = this.z;
_local3 = Math.round(_local3 * 10) / 10;
_local2 = Math.round(_local2 * 10) / 10;
_local4 = Math.round(_local4 * 10) / 10;
return(((("(" + _local3) + ", ") + _local2) + ") ");
};
String.prototype.replace = function (search, replace) {
var _local2 = this.split(search);
return(_local2.join(replace));
};
Frame 11
function Villager(age) {
var _local3 = ["M", "F"];
this.gender = _local3[Math.floor(Math.random() * 2)];
this.name = RandomName(this.gender);
this.age = MinMax(Math.random() * 20, 1, 16);
if (age) {
this.age = age;
}
this.skinHead = Math.floor(Math.random() * 10);
this.skinBody = Math.floor(Math.random() * 10);
this.ageToBirth = 0;
this.health = 50;
this.food = 100;
this.sick = 0;
this.skills = new Array(0, 0, 0, 0, 0, 0);
this.skill = PRIEST;
this.task = NOTHING;
this.workDone = 0;
this.action = null;
this.actionQueue = new Array();
var _local2 = GetHotspot(OPEN_FIELD);
this.pos = RandomPointInRect(_local2.hotspot);
this.aim = null;
this.path = null;
this.dir = GetDirection(null);
RandomLikes(this);
}
function SelectVillager(char) {
if (char.health <= 0) {
GameStatus("That villager is dead.");
selectedChar = null;
return(undefined);
}
selectedChar = char;
if (char.workDone > 0) {
}
if (TRACE_PATH) {
TracePath(gameMap.gfx.drawArea, char.path);
}
if (selectedChar) {
ShowHelp(2.1);
}
}
function CountAlive() {
var _local5 = GetGame();
var _local3 = _local5.villagers;
var _local4 = 0;
var _local1 = 0;
while (_local1 < _local3.length) {
var _local2 = _local3[_local1];
if (_local2.health > 0) {
_local4++;
}
_local1++;
}
return(_local4);
}
function IsSelected(char) {
return(selectedChar == char);
}
function InitVillagers() {
var _local3 = new Array();
var _local2;
_local2 = new Villager(24);
_local2.gender = "M";
_local2.skills[BUILDER] = 30;
_local2.skill = BUILDER;
_local3.push(_local2);
_local2 = new Villager(23);
_local2.gender = "F";
_local3.push(_local2);
_local2 = new Villager(5);
_local3.push(_local2);
var _local1 = 0;
while (_local1 < 4) {
_local2 = new Villager(18 + (Math.random() * 5));
_local3.push(_local2);
_local1++;
}
return(_local3);
}
function GetRandomVillager() {
var _local4 = GetGame();
var _local3 = _local4.villagers;
if (!CountAlive()) {
return(null);
}
while (true) {
var _local2 = Math.floor(Math.random() * _local3.length);
var _local1 = _local3[_local2];
if (_local1.health > 0) {
return(_local1);
}
}
}
function UpdateVillager(char, elapsed) {
var _local2 = GetGame();
var _local5 = elapsed / TSCALE_ONE_YEAR;
char.age = char.age + _local5;
if (char.health == 0) {
return(undefined);
}
if (char.ageToBirth > 0) {
char.ageToBirth = char.ageToBirth - _local5;
if (char.ageToBirth <= 0) {
char.ageToBirth = 0;
var _local4 = new Villager(2);
_local2.villagers.push(_local4);
if (gamemap) {
gameMap.addVillagerClip(_local4);
}
ClearActions(char, NOTHING);
}
}
var _local3 = Math.random() * 100;
if ((_local2.food > (FOOD_OK_LEVEL / 2)) || (_local3 < 50)) {
_local2.food = _local2.food - FOOD_CONSUMPTION;
} else {
char.health--;
}
if (_local2.food > FOOD_ABUNDANT) {
if (_local3 <= 75) {
_local2.food = _local2.food - FOOD_CONSUMPTION;
}
}
if (_local2.food <= 0) {
_local2.food = 0;
if (_local3 <= 50) {
char.health--;
}
}
if (char.food < 20) {
char.task = EATING;
}
if (char.health <= 0) {
char.health = 0;
} else if (char.health <= 96) {
if (Rnd(100) > 50) {
if (_local2.food > FOOD_OK_LEVEL) {
char.health++;
}
if (_local2.food > FOOD_ABUNDANT_LEVEL) {
char.health = char.health + 2;
}
}
}
var _local7 = 0;
if (char.age > (AGE_TO_MORTALITY + _local7)) {
var _local6 = Math.random() * 100;
if (_local6 > 20) {
char.health = 0;
}
}
}
function RandomTask(char) {
char.task = NOTHING;
char.action = null;
if (char.ageToBirth > 0) {
char.task = BREEDING;
return(undefined);
}
var _local5 = GetTasks();
var _local4 = new Array();
var _local2 = 0;
while (_local2 < _local5.length) {
var _local1 = _local5[_local2];
if (_local1.assigned == null) {
_local4.push(_local1);
}
if (_local1.assigned == char.skill) {
if (char.skills[char.skill] >= LEVEL_ADEPT) {
_local4.push(_local1);
}
}
_local2++;
}
if (_local4.length > 0) {
var _local6 = _local4[Math.floor(Math.random() * _local4.length)];
char.task = _local6.task;
}
}
function UpdateAction(char) {
if (char.health <= 0) {
return(undefined);
}
char.action = char.actionQueue[0];
if (char.action == 0) {
RandomTask(char);
}
if (char.action == null) {
GenerateActions(char);
char.action = char.actionQueue[0];
animation = char.action.animation;
}
switch (char.action.animation) {
case ACTION_WALK :
UpdatePosition(char);
break;
case ACTION_COMMIT :
CommitWork(char);
break;
case ACTION_STAND :
case ACTION_CROUCH :
case ACTION_WORK :
UpdateWork(char);
}
}
function UpdateWork(char) {
var _local1 = char.actionQueue[0];
if (_local1.length == 0) {
AttemptSkill(char);
return(undefined);
}
if ((_local1.counter++) > _local1.length) {
ClearCurrentAction(char);
}
}
function CommitWork(char) {
var _local2 = GetGame();
ClearCurrentAction(char);
switch (char.task) {
case FORAGING :
_local2.food = _local2.food + char.workDone;
_local2.berries = MinMax(_local2.berries - char.workDone, 0, MAX_BERRIES);
break;
case RESEARCHING :
_local2.tech = _local2.tech + char.workDone;
}
var _local3 = GetTask(char.task);
if (_local3) {
_local3.progress = _local3.progress + char.workDone;
if (_local3.progress > _local3.length) {
Celebrate(char);
}
}
char.workDone = 0;
}
function UpdatePosition(char) {
if (char.path == null) {
var _local8 = GetPathFinder();
var _local6 = GetHotspot(char.action.area);
char.path = _local8.findPath(char.pos, RandomPointInRect(_local6.workarea));
if ((char.action.item == null) && (char.action.area == OPEN_FIELD)) {
while (char.path.length > 5) {
char.path.pop();
}
}
}
var _local5 = char.pos;
var _local3 = char.path[0];
var _local9 = char.actionQueue[0];
var _local4 = WALK_SPEED;
char.run = false;
if (InArray(char.likes, "Running")) {
char.run = true;
}
if ((char.task == RUNNING) || (char.task == RUNNING_AWAY)) {
char.run = true;
}
if (char.age < AGE_TO_TEEN) {
char.run = true;
}
if (char.run) {
_local4 = RUN_SPEED;
}
if ((char.ageToBirth > 0) && (_local9.area != SMALL_HUT)) {
_local4 = STAND_SPEED;
char.run = false;
}
var _local2 = char.aim;
if (!_local2) {
if (char.path.length > 1) {
_local3.x = _local3.x - (5 + (Math.random() * 10));
_local3.y = _local3.y - (5 + (Math.random() * 10));
}
_local2 = AimTo(_local5, _local3);
ScalePoint(_local2, _local4);
char.aim = _local2;
char.dir = GetDirection(_local2);
}
if (_local2) {
OffsetPoint(_local5, _local2);
}
var _local7 = GetQuickDistance(_local5, _local3);
if (_local7 < 100) {
char.aim = null;
char.path.shift();
}
if (char.path.length == 0) {
ClearCurrentAction(char);
}
}
function AttemptBreed(char1, char2) {
var _local3 = char2;
if (char1.gender == "F") {
_local3 = char1;
}
if (_local3.ageToBirth > 0) {
GameStatus("She is nursing a baby!");
ClearActions(char2);
char2.task = RUNNING_AWAY;
PlayCharSound(char2, 0);
return(undefined);
}
if (char1.gender == char2.gender) {
GameStatus("These villagers are both of the same gender!");
ClearActions(char2);
char2.task = RUNNING_AWAY;
PlayCharSound(char2, 0);
return(undefined);
}
if ((char1.age < AGE_TO_ADULT) || (char2.age < AGE_TO_ADULT)) {
GameStatus("The villager is still too young!");
ClearActions(char2);
char2.task = RUNNING_AWAY;
ShowHelp(8.2);
PlayCharSound(char2, 0);
return(undefined);
}
var _local8 = GetGame();
var _local5 = GetTask(BUILDING_HUT);
var _local4 = CountAlive();
if (((_local5.progress < _local5.length) && (_local4 > 8)) || (_local4 > 16)) {
GameStatus("There isn't enough housing!");
PlayCharSound(char2, 0);
return(undefined);
}
var _local7 = char1.skills[BREEDER] + (Math.random() * 60);
var _local6 = 1;
if (char1.skill == BREEDER) {
_local6 = MinMax((100 - (char1.skills[BREEDER] * 2)) / 10, 2, 10);
}
char1.skills[BREEDER] = MinMax(char1.skills[BREEDER] + _local6, 0, 100);
if (_local7 < 55) {
GameStatus("The villager was unsuccessful this time.");
PlayCharSound(char1, 0);
ShowHelp(8.2);
return(undefined);
}
ClearActions(char1);
ClearActions(char2);
char1.task = GOING_INDOORS;
char2.task = GOING_INDOORS;
_local3.ageToBirth = AGE_TO_BIRTH;
PlayCharSound(char1, 1);
ShowHelp(8.1);
}
function OnShowHelpTask(e) {
var _local1 = e.param;
RemoveEvent(e);
if (HasPopup()) {
ShowHelpTask(_local1.task, _local1.success);
return(undefined);
}
var _local2 = 0;
if (_local1.success) {
_local2 = 0.1;
}
var _local3 = GetGame();
if (_local3.help) {
switch (_local1.task) {
case FORAGING :
ShowHelp(4.2 + _local2);
break;
case RESEARCHING :
ShowHelp(5.2 + _local2);
break;
case CLEARING_WELL :
ShowHelp(7.1);
}
}
}
function ShowHelpTask(task, success) {
var _local2 = GetGame();
if (!_local2.help) {
return(undefined);
}
DelayEvent(5);
var _local1 = new Object();
_local1.task = task;
_local1.success = success;
AddEvent(OnShowHelpTask, _local1);
}
function AttemptSkill(char) {
var _local8 = GetGame();
var _local6 = GetTask(char.task);
if ((char.task == FORAGING) && (_local8.berries == 0)) {
ShowHelpTask(char.task, 0);
ShakeHead(char);
GameStatus("No more berries");
return(undefined);
}
var _local7 = true;
var _local5 = _local6.increment;
var _local1 = 0;
while (_local1 < PRIEST) {
if (_local6.skills[_local1] > 0) {
if (((char.skills[_local1] < LEVEL_TRAINEE) && (char.skill != _local1)) && (_local1 == BUILDER)) {
var _local4 = GetProfession(_local1);
GameStatus(("Only " + _local4) + " can attempt this.");
ShowHelpTask(char.task, 0);
char.task = NOTHING;
if (BoolRnd(60)) {
ShakeHead(char);
return(undefined);
}
}
_local7 = _local7 & (char.skills[_local1] >= _local6.skills[_local1]);
var _local3 = 2;
if (char.skill == _local1) {
_local5 = _local5 + ((char.skills[_local1] * 30) / 100);
_local3 = MinMax((100 - (char.skills[_local1] * 2)) / 10, 2, 10);
} else {
_local5 = 1 + Rnd(5);
}
char.skills[_local1] = MinMax(char.skills[_local1] + _local3, 0, 100);
}
_local1++;
}
char.workDone = _local5;
var _local9 = char.actionQueue[0];
_local9.length = 5 + (Math.random() * 10);
if (!_local7) {
if (BoolRnd(80)) {
ShowHelpTask(char.task, 0);
ShakeHead(char);
return(undefined);
}
}
ShowHelpTask(char.task, 1);
}
function CharSick(char) {
var _local1 = Math.random() * 20;
char.health = MinMax((char.health - 50) - _local1, 5, 100);
}
function CharLoseSkill(char) {
var _local1 = Math.random() * PRIEST;
var _local2 = 25 + (Math.random() * 25);
char.skill[_local1] = MinMax(char.skill[_local1] - _local2, 0, 100);
}
function CharAcquireSkill(char) {
var _local1 = Math.random() * PRIEST;
var _local2 = 25 + (Math.random() * 25);
char.skill[_local1] = MinMax(char.skill[_local1] + _local2, 0, 100);
}
function CharToMaster(char, task) {
var _local1 = Math.random() * PRIEST;
if ((task != null) && (task != undefined)) {
_local1 = task;
}
char.skill = _local1;
char.skill[_local1] = 100;
}
function ShowCharGfx(gfx, c, scale) {
gfx.stop();
gfx.charData = c;
gfx.loadGfx(c.gender, c.skinHead, c.skinBody);
gfx.gfxBody.gfx.gotoAndStop(2);
gfx.gfxHead.gfx.gotoAndStop(3);
gfx.setFrame(gfx.gfxBody, 9);
gfx.setFrame(gfx.gfxHead, 2);
gfx.adjustHeight();
gfx._xscale = gfx._xscale * scale;
gfx._yscale = gfx._yscale * scale;
gfx._visible = true;
}
_global.selectedChar = null;
Frame 12
function InitEventManager() {
var _local1 = new EventManager();
return(_local1);
}
function GetEventsManager() {
return(_global.em);
}
function Event(c, p) {
this.callback = c;
this.param = p;
}
function EventManager() {
this.events = new Array();
this.lastUpdate = 0;
this.index = 0;
}
function AddEvent(c, p) {
var _local1 = GetEventsManager();
_local1.addEvent(c, p);
}
function RemoveEvent(e) {
var _local1 = GetEventsManager();
_local1.removeEvent(e);
}
function DelayEvent(count) {
AddEvent(OnDelayEvent, count);
}
function OnDelayEvent(e) {
RemoveEvent(e);
if (e.param > 0) {
DelayEvent(e.param - 1);
}
}
function UpdateEvents() {
var _local1 = GetEventsManager();
_local1.update();
}
EventManager.prototype.addEvent = function (c, p) {
var _local2 = new Event(c, p);
this.events.push(_local2);
};
EventManager.prototype.removeEvent = function (e) {
this.events.shift();
};
EventManager.prototype.update = function () {
var _local4 = this.events;
if (_local4.length == 0) {
return(undefined);
}
var _local3 = GetTimeStamp();
var _local5 = _local3 - this.lastUpdate;
if (_local5 < FIVE_SECONDS) {
return(undefined);
}
this.lastUpdate = _local3;
var _local2 = _local4[0];
_local2.callback(_local2);
};
_global.em = InitEventManager();
Frame 13
function InitSounds() {
_global.gSounds = new Object();
if (AMBIENT) {
_global.gAmbient = new Sound();
gAmbient.loadSound("song1.mp3", true);
gAmbient.start(0, 9999);
}
var _local3 = ["femaleno", "maleno", "ohkid", "ohwoman", "ohman", "chimes", "button"];
for (var _local4 in _local3) {
var _local2 = _local3[_local4];
gSounds[_local2] = new Sound();
gSounds[_local2].attachSound(_local2);
}
}
function SetVolume(v) {
var _local1 = GetGame();
var _local3 = new Sound();
if (v == null) {
v = Math.round(_local1.sound);
}
_local3.setVolume(v);
return(_local1.sound);
}
function PlaySound(snd, v) {
if (!SetVolume(v)) {
return(undefined);
}
gSounds[snd].start();
}
function PlayMusic(v) {
if (!AMBIENT) {
return(undefined);
}
var _local2 = GetGame();
if (v == undefined) {
v = _local2.music;
}
gAmbient.setVolume(v);
}
function PlayCharSound(char, which) {
if (char.gender == "M") {
var _local2 = ["maleno", "ohman"];
} else {
var _local2 = ["femaleno", "ohwoman"];
}
var _local1 = _local2[which];
if (char.age < AGE_TO_TEEN) {
_local1 = "ohkid";
}
PlaySound(_local1);
}
_global.lastAmbient = 0;
InitSounds();
Frame 14
function Task(task, assigned, length, increment, skills, techs) {
this.task = task;
this.assigned = assigned;
this.progress = 0;
this.length = length;
this.increment = increment;
this.skills = skills;
this.techs = techs;
}
function InitTasks() {
var _local1 = new Array();
_local1.push(new Task(FORAGING, FARMER, 1000, 10, new Array(LEVEL_TRAINEE, 0, 0, 0, 0), null));
_local1.push(new Task(RESEARCHING, RESEARCHER, 100000, 20, new Array(0, 0, LEVEL_TRAINEE, 0, 0), null));
_local1.push(new Task(CLEARING_WELL, BUILDER, 100, 100, new Array(0, LEVEL_TRAINEE, 0, 0, 0), null));
_local1.push(new Task(CLEARING_DEBRIS, BUILDER, 500, 10, new Array(0, LEVEL_TRAINEE, 0, 0, 0), null));
_local1.push(new Task(DISCOVER_SCHOOL, RESEARCHER, 100, 100, new Array(0, 0, LEVEL_MASTER, 0, 0), null));
_local1.push(new Task(BUILDING_HUT, BUILDER, 500, 10, new Array(0, LEVEL_ADEPT, 0, 0, 0), null));
_local1.push(new Task(EATING, null, 1));
_local1.push(new Task(CURIOUS_ROCK, null, 1));
_local1.push(new Task(CURIOUS_RUINS, null, 1));
_local1.push(new Task(PUSH_BOULDER, null, 1));
_local1.push(new Task(CURIOUS_CACTUS, null, 1));
_local1.push(new Task(CURIOUS_ROSE, null, 1));
_local1.push(new Task(CURIOUS_PLANT, null, 1));
_local1.push(new Task(CURIOUS_LILY, null, 1));
_local1.push(new Task(CONFUSED, -1, 1));
return(_local1);
}
function GetTasks() {
var _local1 = GetGame();
return(_local1.tasks);
}
function GetTask(id) {
var _local3 = GetTasks();
var _local1 = 0;
while (_local1 < _local3.length) {
var _local2 = _local3[_local1];
if (_local2.task == id) {
return(_local2);
}
_local1++;
}
return(null);
}
Frame 15
function Tech(tech, cost) {
this.tech = tech;
this.cost = cost;
}
function InitTechs() {
var _local1 = new Array();
_local1.push(new Tech(FARMER, new Array(0, 6000, 50000)));
_local1.push(new Tech(RESEARCHER, new Array(0, 12000, 150000)));
_local1.push(new Tech(BUILDER, new Array(0, 2500, 80000)));
_local1.push(new Tech(HEALER, new Array(0, 15000, 250000)));
_local1.push(new Tech(BREEDER, new Array(0, 11000, 240000)));
_local1.push(new Tech(PRIEST, new Array(0, 5000, 80000)));
return(_local1);
}
function GetTechs() {
return(_global.techs);
}
function GetTech(tech) {
var _local3 = GetTechs();
var _local1 = 0;
while (_local1 < _local3.length) {
var _local2 = _local3[_local1];
if (_local2.tech == tech) {
return(_local2);
}
_local1++;
}
return(null);
}
function BuyTech(id) {
ShowUpsell();
return(undefined);
}
_global.techs = InitTechs();
Frame 16
function HotSpot(task, hotspot, workarea) {
this.task = task;
this.hotspot = hotspot;
this.workarea = workarea;
if (!this.workarea) {
this.workarea = this.hotspot;
}
}
function InitHotspots() {
var _local1 = new Array();
_local1[BUSH] = new HotSpot(FORAGING, new CRect(460, 230, 620, 320), new CRect(470, 325, 610, 345));
_local1[TABLE] = new HotSpot(RESEARCHING, new CRect(345, 760, 515, 805), new CRect(365, 810, 510, 820));
_local1[STATUE] = new HotSpot(CONFUSED, new CRect(265, 420, 320, 515), new CRect(265, 520, 330, 535));
_local1[MAIN_HUT] = new HotSpot(DISCOVER_SCHOOL, new CRect(330, 610, 545, 695), new CRect(330, 710, 535, 740));
_local1[WELL] = new HotSpot(CLEARING_WELL, new CRect(710, 360, 825, 405), new CRect(710, 395, 825, 405));
_local1[SMALL_HUT] = new HotSpot(NOTHING, new CRect(780, 640, 885, 735), new CRect(848, 740, 872, 750));
_local1[FOOD_BASKET] = new HotSpot(NOTHING, new CRect(780, 810, 860, 810), new CRect(860, 850, 870, 880));
_local1[LAUNTRY_HUT] = new HotSpot(NOTHING, new CRect(550, 905, 650, 995));
_local1[FARM_FIELD] = new HotSpot(NOTHING, new CRect(260, 915, 505, 970), new CRect(270, 935, 500, 970));
_local1[RUINS] = new HotSpot(CONFUSED, new CRect(955, 940, 1100, 1060));
_local1[NEW_HUT] = new HotSpot(BUILDING_HUT, new CRect(565, 765, 665, 845), new CRect(585, 850, 645, 860));
_local1[ROCKS] = new HotSpot(CONFUSED, new CRect(160, 130, 240, 190), new CRect(235, 160, 250, 190));
_local1[STORAGE] = new HotSpot(NOTHING, new CRect(1077, 807, 1130, 856));
_local1[OPEN_FIELD] = new HotSpot(NOTHING, new CRect(455, 420, 670, 570), null);
_local1[STORAGE_WELL] = new HotSpot(NOTHING, new CRect(910, 430, 920, 440), null);
_local1[DEBRIS] = new HotSpot(CLEARING_DEBRIS, new CRect(175, 1051, 395, 1154), new CRect(270, 1080, 330, 1100));
_local1[BOULDER] = new HotSpot(CONFUSED, new CRect(720, 45, 829, 121), new CRect(720, 121, 829, 140));
_local1[STORAGE_DEBRIS] = new HotSpot(NOTHING, new CRect(99, 726, 146, 778), null);
_local1[FOOD_BASKET_EAT] = new HotSpot(EATING, new CRect(780, 810, 860, 890), new CRect(740, 856, 783, 894));
_local1[CACTUS] = new HotSpot(CONFUSED, new CRect(627, 100, 676, 163), new CRect(627, 163, 676, 173));
_local1[ROSE] = new HotSpot(CONFUSED, new CRect(407, 100, 456, 156), new CRect(407, 156, 456, 166));
_local1[PLANT] = new HotSpot(CONFUSED, new CRect(273, 100, 344, 159), new CRect(273, 159, 344, 169));
_local1[LILY] = new HotSpot(CONFUSED, new CRect(1078, 359, 1117, 404), new CRect(1078, 404, 1117, 414));
_local1[LARGE_ROCK] = new HotSpot(NOTHING, new CRect(960, 520, 1200, 600), null);
_local1[WHITE_SAND] = new HotSpot(NOTHING, new CRect(450, 1051, 795, 1154), null);
return(_local1);
}
function GetTaskLocation(task) {
var _local3 = GetHotspots();
var _local1 = 0;
while (_local1 < _local3.length) {
var _local2 = _local3[_local1];
if (_local2.task == task) {
return(_local1);
}
_local1++;
}
return(OPEN_FIELD);
}
function CheckBlock(cx, cy) {
var _local5 = gameMap;
if (!_local5) {
return(false);
}
var _local7 = (cx + _local5._x) + _local5.gfx._x;
var _local6 = (cy + _local5._y) + _local5.gfx._y;
var _local4 = 0;
while (_local4 < 4) {
var _local1 = 0;
while (_local1 < 4) {
var _local3 = ("gMap" + _local4) + _local1;
var _local2 = _local5.gfx[_local3].block;
if (!_local2) {
} else if (_local2.hitTest(_local7, _local6, true)) {
return(true);
}
_local1++;
}
_local4++;
}
return(false);
}
function CheckHotspot(x, y) {
var _local3 = GetHotspots();
var _local1 = 0;
while (_local1 < _local3.length) {
var _local2 = _local3[_local1];
if (_local2 && (PointInRect(_local2.hotspot, new CPoint(x, y)))) {
return(_local2);
}
_local1++;
}
return(null);
}
function ShowHotspots(target) {
var _local3 = GetHotspots();
var _local1 = 0;
while (_local1 < _local3.length) {
var _local2 = _local3[_local1];
DrawRect(target, _local2.hotspot, 255);
DrawRect(target, _local2.workarea, 16711680);
_local1++;
}
}
function GetHotspots() {
return(_global.hotspots);
}
function GetHotspot(index) {
return(_global.hotspots[index]);
}
_global.EDGE_TOP = new CRect(150, 0, 580, 50);
_global.EDGE_BOTTOM = new CRect(150, 310, 580, 370);
_global.EDGE_LEFT = new CRect(150, 0, 200, 370);
_global.EDGE_RIGHT = new CRect(530, 0, 580, 370);
_global.hotspots = InitHotspots();
Frame 17
function PathFinder() {
}
function TracePath(target, path) {
if (!target.drawPath) {
target.createEmptyMovieClip("drawPath", 5000);
}
target = target.drawPath;
target.clear();
var _local1 = 0;
while (_local1 < path.length) {
if (path[_local1] == null) {
trace("path error!");
} else {
var _local3 = 255;
if (path[_local1].z == -1) {
_local3 = _local3 << 8;
}
DrawCircle(target, path[_local1], 5, _local3);
}
_local1++;
}
}
function TracePathTest(target) {
if (!target.drawPath) {
target.createEmptyMovieClip("drawPath", 5000);
}
target = target.drawPath;
target.clear();
var _local5 = GetGame();
var _local7 = GetPathFinder();
var _local6 = CopyPoint(_local5.villagers[0].pos);
var _local8 = CopyPoint(_local5.villagers[1].pos);
var _local2 = _local7.findPath(_local6, _local8);
var _local1 = 0;
while (_local1 < _local2.length) {
if (_local2[_local1] == null) {
} else {
var _local3 = 255;
if (_local2[_local1].z == -1) {
_local3 = _local3 << 8;
}
DrawCircle(target, _local2[_local1], 5, _local3);
}
_local1++;
}
}
function InitPathFinder() {
var _local1 = new PathFinder();
return(_local1);
}
function GetPathFinder() {
return(_global.pathfinder);
}
PathFinder.prototype.findPath = function (pos, to) {
var _local3 = CopyPoint(pos);
var _local8 = GetDistance(_local3, to);
var _local6 = Math.floor(_local8 / PATH_ACCURACY);
var _local2 = new Array(CopyPoint(_local3), CopyPoint(_local3));
var _local5 = AimTo(_local3, to);
ScalePoint(_local5, PATH_ACCURACY);
var _local4 = 0;
while (_local4 < _local6) {
OffsetPoint(_local3, _local5);
if (!this.checkWalkArea(_local3)) {
if (_local2[_local2.length - 1] != null) {
_local2.push(null);
}
} else {
_local2.push(CopyPoint(_local3));
}
_local4++;
}
_local2.push(CopyPoint(to));
_local2.push(CopyPoint(to));
this.checkWalkAround(_local5, _local2);
_local2 = this.cleanPath(_local2);
return(_local2);
};
PathFinder.prototype.checkWalkArea = function (pos) {
var _local3 = GetHotspots();
var _local1 = 0;
while (_local1 < _local3.length) {
var _local2 = _local3[_local1];
switch (_local1) {
case OPEN_FIELD :
case FARM_FIELD :
case STORAGE :
case STORAGE_WELL :
case STORAGE_DEBRIS :
case RUINS :
case DEBRIS :
case WHITE_SAND :
break;
default :
if (!_local2) {
} else {
if (!PointInRect(_local2.hotspot, pos)) {
break;
}
return(false);
}
}
_local1++;
}
return(true);
};
PathFinder.prototype.hasWalkLine = function (pos, to) {
var _local3 = CopyPoint(pos);
var _local6 = GetDistance(_local3, to);
var _local5 = Math.floor(_local6 / PATH_ACCURACY);
var _local4 = AimTo(_local3, to);
ScalePoint(_local4, PATH_ACCURACY);
var _local2 = 0;
while (_local2 < _local5) {
OffsetPoint(_local3, _local4);
if (!this.checkWalkArea(_local3)) {
return(false);
}
_local2++;
}
return(true);
};
PathFinder.prototype.doWalkAround = function (aim, p1, p2) {
OffsetPoint(p1, aim);
p1.z = -1;
OffsetPoint(p2, aim);
p2.z = -1;
};
PathFinder.prototype.checkWalkAround = function (aim, path) {
var _local13 = aim.x / aim.y;
var _local12 = Math.atan(_local13);
var _local11 = new CPoint(Math.sin(_local12 + 1.57), Math.cos(_local12 + 1.57));
ScalePoint(_local11, PATH_ACCURACY);
var _local10 = new CPoint(Math.sin(_local12 - 1.57), Math.cos(_local12 - 1.57));
ScalePoint(_local10, PATH_ACCURACY);
var _local2 = 0;
while (_local2 < path.length) {
var _local9 = path[_local2];
if (_local9 == null) {
var _local7 = CopyPoint(path[_local2 - 1]);
var _local6 = CopyPoint(path[_local2 + 1]);
var _local5 = CopyPoint(path[_local2 - 1]);
var _local4 = CopyPoint(path[_local2 + 1]);
var _local8 = 0;
while (_local8 < PATH_WALKAROUND) {
this.doWalkAround(_local11, _local7, _local6);
if (this.hasWalkLine(_local7, _local6)) {
SetPoint(path[_local2 - 1], _local7.x, _local7.y, -1);
SetPoint(path[_local2 + 1], _local6.x, _local6.y, -1);
break;
}
this.doWalkAround(_local10, _local5, _local4);
if (this.hasWalkLine(_local5, _local4)) {
SetPoint(path[_local2 - 1], _local5.x, _local5.y, -1);
SetPoint(path[_local2 + 1], _local4.x, _local4.y, -1);
break;
}
_local8++;
}
}
_local2++;
}
return(path);
};
PathFinder.prototype.cleanPath = function (path) {
var _local4 = new Array(CopyPoint(path[0]));
var _local1 = 0;
while (_local1 < path.length) {
var _local2 = path[_local1];
if (!_local2) {
} else {
_local4.push(_local2);
}
_local1++;
}
return(_local4);
};
PathFinder.prototype.shortenPath = function (path) {
var _local8 = new Array(CopyPoint(path[0]));
var _local4 = 0;
while (_local4 < path.length) {
var _local6 = path[_local4];
if (!_local6) {
} else {
var _local7 = CopyPoint(_local6);
var _local2 = _local4 + 1;
while (_local2 < path.length) {
var _local3 = path[_local2];
if (!_local3) {
} else if (this.hasWalkLine(_local6, _local3)) {
_local7 = CopyPoint(_local3);
_local4++;
} else {
_local2 = path.length;
}
_local2++;
}
_local8.push(CopyPoint(_local7));
}
_local4++;
}
return(_local8);
};
_global.pathfinder = InitPathFinder();
Frame 18
function Gfx(id, gfx, pos) {
this.id = id;
this.gfx = gfx;
this.pos = pos;
}
function InitGfx() {
var _local1 = new Array();
_local1.push(new Gfx(FORAGING, "berries", new CPoint(460, 220)));
_local1.push(new Gfx(RESEARCHING));
_local1.push(new Gfx(CLEARING_ROCKS, "blockage", new CPoint(150, 120)));
_local1.push(new Gfx(CLEARING_WELL, "log", new CPoint(750, 370)));
_local1.push(new Gfx(CLEARING_DEBRIS, "debris", new CPoint(160, 1060)));
_local1.push(new Gfx(DISCOVER_SCHOOL, "drums", new CPoint(530, 670)));
_local1.push(new Gfx(STORING_FOOD, "food", new CPoint(791, 808)));
_local1.push(new Gfx(PUSHING_BOULDER, "boulder", new CPoint(720, 45)));
_local1.push(new Gfx(STUDY_STATUE, "idol", new CPoint(265, 410)));
_local1.push(new Gfx(BUILDING_HUT, "hut", new CPoint(555, 745)));
return(_local1);
}
function GetGfxObjects() {
return(_global.gfxObjects);
}
function GetGfx(id) {
var _local3 = GetGfxObjects();
var _local1 = 0;
while (_local1 < _local3.length) {
var _local2 = _local3[_local1];
if (_local2.id == id) {
return(_local2);
}
_local1++;
}
return(null);
}
_global.gfxObjects = InitGfx();
Frame 19
function LangGender(g) {
if (g == "M") {
return("Male");
}
return("Female");
}
function LangHealth(char) {
if (char.age >= AGE_TO_ELDERLY) {
return("Elderly");
}
if (char.health < 40) {
return("Unhealthy");
}
return("Healthy");
}
function LangSkill(char) {
var _local2 = "Untrained";
var _local3 = char.skills[char.skill];
var _local1 = "";
if (_local3 >= LEVEL_TRAINEE) {
_local2 = "Trainee ";
if (_local3 >= LEVEL_ADEPT) {
_local2 = "Adept ";
}
if (_local3 >= LEVEL_MASTER) {
_local2 = "Master ";
}
switch (char.skill) {
case FARMER :
_local1 = "Farmer";
break;
case RESEARCHER :
_local1 = "Scientist";
break;
case BUILDER :
_local1 = "Builder";
break;
case HEALER :
_local1 = "Doctor";
break;
case BREEDER :
_local1 = "Parent";
}
}
return(_local2 + _local1);
}
function LangAction(char) {
var _local2 = char.task;
var _local1 = char.actionQueue[0];
if (_local1) {
if (_local1.comment != null) {
return(_local1.comment);
}
}
switch (_local2) {
case BREEDING :
return("Nursing a child");
case FORAGING :
return("Foraging");
case CLEARING_DEBRIS :
return("Clearing debris");
case CLEARING_WELL :
return("Clearing well");
case BUILDING_HUT :
return("Building small hut");
case DISCOVER_SCHOOL :
case RESEARCHING :
return("Researching");
}
return("Nothing");
}
function RandomName(gender) {
var _local1 = new Array();
_local1.M = ["Ahi ", "Ahmik", "Ahote", "Aitu", "Akan", "Aneko", "Ariki", "Azizi", "Babu", "Bem", "Biko", "Bobo", "Bruk", "Cheop", "Chiko", "Duto", "Eko", "Elaku", "Elki", "Etini", "Ghali", "Gin", "Hakan", "Hiji", "Hoani", "Hokou", "Howi", "Iniko", "Iyasu", "Jomo", "Juro", "Kayak", "Keopi", "Kin", "Kito", "Kobbi", "Kumi", "Kupe", "Kupi", "Kuruk", "Kwaku", "Lanu", "Lanu", "Liko", "Malik", "Manu", "Masou", "Maui", "Mazi", "Mikio", "Moki", "Naki", "Nawat", "Nitis", "Nuru", "Okwui", "Olu", "Paco", "Pawin", "Pili", "Ponui", "Rangi ", "Rongo", "Rudo", "Sef", "Silko", "Suzo", "Tanak", "Tano", "Tau", "Thabo", "Tofu", "Tomi", "Turi", "Tutu", "Uan", "Usutu", "Vanui", "Wabu", "Elan", "Naoko", "Dulu", "Kenan", "Yahto", "Akil", "Kwame", "Idowu", "Amaci", "Seven"];
_local1.F = ["Aki", "Akika", "Alawa", "Amaci", "Amina", "Aponi", "Ashby", "Atepa", "Aziza", "Banga", "Chapa", "Chepi", "Chika", "City", "Dada", "Dofi", "Ema", "Etini", "Fatai", "Gzifa", "Hika", "Hokua", "Iruwa", "Isi", "Kaia", "Kaimi", "Kasa", "Keiki", "Kinga", "Kiri", "Kissa", "Kita", "Kukua", "Layla", "Leia", "Lisha", "Maiya", "Mamba", "Meka", "Mina", "Naki", "Nina", "Nishi", "Nunai", "Nyota", "Onawa", "Pakwa", "Penyo", "Poema", "Pupa", "Qwara", "Raha", "Rusha", "Saka", "Sanje", "Sekai", "Shuka", "Sitsi", "Tala", "Teata", "Tiki", "Tonga", "Tronga", "Tuna", "Ulu", "Unagi", "Vava", "Yoki", "Zen", "Zola", "Zuna", "Hawa", "Kai", "Koka", "Mali", "Imala", "Itchi", "Kifa", "Lala", "Suki", "Aika", "Waka", "Mika", "Huata"];
n = _local1[gender];
return(n[Math.floor(Math.random() * n.length)]);
}
function PuzzleText(id) {
switch (id) {
case CLEARING_WELL :
return("<p align='center'>The Well</p>\nYour builder removed the cover from the well and now your tribe has fresh, clean water.\n");
case BUILDING_HUT :
return("<p align='center'>The Hut</p>\nYour builders constructed a new hut! Your village can support a larger population now.\n");
case DISCOVER_SCHOOL :
return("<p align='center'>The School</p>\nOne of your master scientists founded a school! Children will now be born with more skills.\n");
case CLEARING_DEBRIS :
return("<p align='center'>The Beach</p>\nYour builders cleared away the debris and smashed boat pieces from the beach. The ocean is much more accessible now.\n");
}
return("");
}
function GetProfession(id) {
var _local1 = ["farmer", "builder", "scientist", "doctor", "breeder"];
return(_local1[id]);
}
function GetHeShe(char, ucase) {
if (ucase == undefined) {
ucase = 0;
}
if (char.gender == "M") {
var _local2 = ["he", "He"];
} else {
var _local2 = ["she", "She"];
}
return(_local2[ucase]);
}
function RandomLikes(char) {
var _local6 = ["Running", "Exploring", "Berries", "Lifting", "Swimming", "Flowers", "Bushes", "Resting", "Drums", "Rocks", "Caves", "Flies", "Crowds", "Jokes", "Monkeys", "Wind", "Fish", "Birds", "Butterflies", "Sunlight", "Dancing", "The Ocean", "Playing", "Work", "Fruit"];
var _local2 = new Array();
var _local1 = 0;
while (_local1 < 4) {
var _local4 = Math.random() * 100;
if (_local4 > 60) {
} else {
var _local3 = _local6[Math.floor(Math.random() * _local6.length)];
if (!InArray(_local2, _local3)) {
_local2.push(_local3);
}
}
_local1++;
}
char.likes = new Array();
char.dislikes = new Array();
_local1 = 0;
while (_local1 < _local2.length) {
var _local3 = _local2[_local1];
if (_local1 % 2) {
char.dislikes.push(_local3);
} else {
char.likes.push(_local3);
}
_local1++;
}
}
Frame 20
function CreatePopup(template, text, callback, x, y, w, h, clr, btns) {
if (!clr) {
clr = "";
}
_root.attachMovie(template, "popup", 5000);
var _local2 = _root.popup;
if (!_local2) {
return(null);
}
if (!w) {
w = _local2._width;
}
if (!h) {
h = _local2._height;
}
if (x) {
_local2._x = x;
} else {
_local2._x = (SCREEN_WIDTH / 2) - (w / 2);
}
if (y) {
_local2._y = y;
} else {
_local2._y = (SCREEN_HEIGHT / 2) - (h / 2);
}
_local2.callback = callback;
_local2.text = text;
_local2.w = w;
_local2.h = h;
_local2.clr = clr;
_local2.btns = btns;
ControlLock(true);
return(_local2);
}
function CreateEventPopup(char) {
if (_root.popup._visible) {
return(undefined);
}
var _local6 = GetHeShe(char);
var _local8 = GetHeShe(char, 1);
var _local2 = xmlEvents.randomEvent();
if (!_local2) {
var _local7 = GetGame();
_local7.lastPopup15 = 0;
return(false);
}
var _local3 = (("<p align='center'>" + _local2.title) + "</p><br/><br/><br/>") + _local2.prompt;
_local3 = _local3.replace("{name}", char.name);
_local3 = _local3.replace("{he}", _local6);
_local3 = _local3.replace("{!he}", _local8);
var _local5 = CreatePopup("popupEvent", _local3, onEventPopup, 0, 0, _local2.width, _local2.height, "O", _local2.btns);
if (!_local2.noChar) {
_local5.char = char;
}
_local2.char = char;
eventPopup = _local2;
return(true);
}
function onEventPopup(t) {
var _local1 = eventPopup;
var _local5 = "";
if (t) {
_local5 = _local1.btns[0];
var _local4 = _local1.choice1;
} else {
_local5 = _local1.btns[1];
var _local4 = _local1.choice2;
}
var _local8 = GetHeShe(_local1.char);
var _local9 = GetHeShe(_local1.char, 1);
var _local3 = _local4[Rnd(_local4.length)];
_local1.res = _local3;
var _local7 = _local3.firstChild.toString();
var _local2 = (("<p align='center'>" + _local1.title) + "</p><br/><br/><br/>") + _local7;
_local2 = _local2.replace("{name}", _local1.char.name);
_local2 = _local2.replace("{he}", _local8);
_local2 = _local2.replace("{!he}", _local9);
var _local6 = CreatePopup("popupEvent", _local2, onPopupCommit, 0, 0, _local3.attributes.width, _local3.attributes.height, "O", ["", "Ok"]);
if (!_local1.noChar) {
_local6.char = _local1.char;
}
}
function onPopupCommit() {
var _local2 = GetGame();
var _local1 = eventPopup;
var _local4 = _local1.res;
switch (_local4.attributes.effect) {
case "-age" :
_local1.char.age = MinMax(_local1.char.age * 0.6, 2, 98);
break;
case "+age" :
_local1.char.age = MinMax(_local1.char.age * 1.4, 2, 98);
break;
case "-skill" :
CharLoseSkill(_local1.char);
break;
case "+skill" :
CharAcquireSkill(_local1.char);
break;
case "-health" :
case "-health!" :
_local1.char.health = MinMax(_local1.char.health * 0.5, 5, 100);
break;
case "+health" :
_local1.char.health = MinMax(_local1.char.health * 1.5, 5, 100);
break;
case "+farmer" :
CharToMaster(_local1.char, FARMER);
break;
case "+builder" :
CharToMaster(_local1.char, BUILDER);
break;
case "+scientist" :
CharToMaster(_local1.char, RESEARCHER);
break;
case "+parent" :
CharToMaster(_local1.char, BREEDER);
break;
case "+food" :
_local2.food = _local2.food + ((2 + Rnd(5)) * 1000);
break;
case "-food" :
_local2.food = MinMax(_local2.food * 0.6, 5, 100);
break;
case "+tech" :
_local2.tech = _local2.tech + ((2 + Rnd(5)) * 1000);
break;
case "-tech" :
_local2.tech = MinMax(_local2.tech * 0.6, 5, 100);
break;
case "-person" :
break;
case "+person" :
var _local3 = new Villager(2);
_local2.villagers.push(_local3);
if (!gamemap) {
break;
}
gameMap.addVillagerClip(_local3);
}
}
function RandomPopup() {
if (_root.popup._visible) {
return(undefined);
}
var _local3 = GetGame();
var _local2 = GetTimeStamp();
var _local6 = _local2 - _local3.lastPopup15;
var _local5 = _local2 - _local3.lastPopup240;
if (_local5 > (4 * ONE_HOUR)) {
_local3.lastPopup15 = _local2;
_local3.lastPopup240 = _local2;
} else if (_local6 > FIFTEEN_MINUTES) {
_local3.lastPopup15 = _local2;
} else {
return(undefined);
}
var _local4 = GetRandomVillager();
if (!_local4) {
return(undefined);
}
CreateEventPopup(_local4);
}
function ShowUpsell() {
var _local2 = "";
var _local1 = "<p align='center'>\nThis feature is not available on the web version of this game. The desktop version has all the features. Try it now!</p><br/>" + _local2;
var _local3 = CreatePopup("popupUpsell", _local1, null, 0, 0, 0, 220);
}
function BuyGame() {
getURL (UPSELL_BUY, UPSELL_TARGET);
}
function DownloadGame() {
getURL (UPSELL_DOWNLOAD, UPSELL_TARGET);
}
function HasPopup() {
return(_root.popup._visible == true);
}
_global.eventPopup = null;
var xmlEvents = new XML();
xmlEvents.onLoad = function (success) {
if (!success) {
return(undefined);
}
this.events = new Array();
var _local2 = this.firstChild.firstChild;
while (_local2) {
if (_local2.nodeName == "event") {
this.events.push(_local2);
}
_local2 = _local2.nextSibling;
}
};
xmlEvents.randomEvent = function () {
var _local3 = new Object();
var _local6 = Rnd(this.events.length);
var _local4 = this.events[_local6];
_local3.title = _local4.findNode("title");
var _local5 = _local4.findNode("prompt");
_local3.prompt = _local5;
_local3.height = _local5.attributes.height;
_local3.width = _local5.attributes.width;
_local3.btns = new Array(_local4.findNode("button1").firstChild, _local4.findNode("button2").firstChild);
_local3.choice1 = new Array();
_local3.choice2 = new Array();
var _local2 = _local4.firstChild;
while (_local2) {
if (_local2.nodeName == "choice1") {
_local3.choice1.push(_local2);
}
if (_local2.nodeName == "choice2") {
_local3.choice2.push(_local2);
}
_local2 = _local2.nextSibling;
}
return(_local3);
};
xmlEvents.load("events.xml");
Frame 21
function ShowArrow(template, x, y) {
if (template == null) {
return(undefined);
}
_root.attachMovie(template, "arrow", 5001);
var _local2 = _root.arrow;
_local2._x = x;
_local2._y = y;
}
function HideArrow() {
var _local2 = _root.arrow;
_local2.removeMovieClip();
SaveGame();
}
function IsHelpShown(id) {
var _local1 = GetGame();
return(_local1.helpShown[id] == true);
}
function ShowHelp(id) {
var _local2 = GetGame();
if (!_local2.help) {
return(undefined);
}
if (HasPopup()) {
return(false);
}
var _local5 = Math.floor(id);
if (_local5 != id) {
if (!IsHelpShown(_local5)) {
return(false);
}
}
var _local3 = xmlHelp.firstChild.findNode("help", id);
if (!_local3) {
_local2.helpIndex++;
return(false);
}
if (IsHelpShown(id)) {
var _local4 = false;
if (IsHelpShown(id + 0.1)) {
_local4 = true;
var _local6 = xmlHelp.firstChild.findNode("help", id + 0.2);
if (_local6) {
_local4 = false;
_local4 = _local4 | IsHelpShown(id + 0.2);
_local4 = _local4 | IsHelpShown(id + 0.3);
}
}
if (_local4) {
_local2.helpIndex++;
}
return(false);
}
CreatePopup("popupMsgOk", _local3, onHelpOk, 0, 0, _local3.attributes.width, _local3.attributes.height);
ShowArrow(_local3.attributes.arrow, _local3.attributes.arrowX, _local3.attributes.arrowY);
_local2.helpShown[Math.floor(id)] = true;
_local2.helpShown[id] = true;
if ((id > 8) && (id < 9)) {
_local2.helpShown[8.1] = true;
_local2.helpShown[8.2] = true;
}
if ((_local2.helpIndex == 7) && (IsHelpShown(7.1))) {
_local2.helpIndex = 8;
}
return(true);
}
function UpdateHelp() {
var _local1 = GetGame();
if (!_local1.help) {
return(undefined);
}
if (HasPopup()) {
return(false);
}
var _local3 = GetTimeStamp();
var _local2 = _local3 - _local1.lastHelp;
var _local4 = TUTORIAL_DELAY;
if (_local2 < (ONE_SECOND * _local4)) {
return(undefined);
}
ShowHelp(_local1.helpIndex);
}
function onHelpOk() {
var _local1 = GetGame();
_local1.lastHelp = GetTimeStamp();
HideArrow();
}
Frame 22
function Action(animation, param1, param2, comment, hidden) {
this.animation = animation;
this.counter = 0;
this.length = 0;
switch (animation) {
case ACTION_WALK :
this.area = param1;
this.item = param2;
break;
case ACTION_COMMIT :
case ACTION_CROUCH :
case ACTION_WORK :
this.work = param1;
if (param2 == undefined) {
break;
}
this.length = param2;
}
this.comment = comment;
this.hidden = hidden;
}
function ClearCurrentAction(char) {
char.aim = null;
char.path = null;
char.action = null;
char.actionQueue.shift();
}
function ClearActions(char, task) {
if (task != null) {
char.task = task;
}
char.workDone = 0;
char.aim = null;
char.path = null;
char.action = null;
char.actionQueue = new Array();
}
function GenerateActions(char) {
var _local6 = GetGame();
var _local5 = GetTask(char.task);
if (_local5) {
if (_local5.progress >= _local5.length) {
char.task = NOTHING;
}
}
var _local10 = char.task;
var _local1 = new Array();
switch (_local10) {
case FORAGING :
_local1.push(new Action(ACTION_WALK, BUSH));
_local1.push(new Action(ACTION_WORK, NOTHING, 0));
_local1.push(new Action(ACTION_CROUCH, NOTHING, 30));
_local1.push(new Action(ACTION_WORK, NOTHING, 10));
_local1.push(new Action(ACTION_WALK, FOOD_BASKET, ITEM_BERRIES));
_local1.push(new Action(ACTION_CROUCH, NOTHING, 0));
_local1.push(new Action(ACTION_COMMIT, FORAGING));
break;
case RESEARCHING :
_local1.push(new Action(ACTION_WALK, TABLE));
_local1.push(new Action(ACTION_WORK, NOTHING, 0));
_local1.push(new Action(ACTION_WORK, NOTHING, 30));
_local1.push(new Action(ACTION_COMMIT, RESEARCHING));
_local1.push(new Action(ACTION_WALK, TABLE));
_local1.push(new Action(ACTION_WORK, NOTHING, 40));
break;
case CLEARING_ROCKS :
_local1.push(new Action(ACTION_WALK, ROCKS));
_local1.push(new Action(ACTION_CROUCH));
_local1.push(new Action(ACTION_WALK, STORAGE, ITEM_ROCK));
_local1.push(new Action(ACTION_CROUCH));
break;
case CLEARING_WELL :
_local1.push(new Action(ACTION_WALK, WELL));
_local1.push(new Action(ACTION_CROUCH, CLEARING_WELL, null, "Uncovering the well"));
_local1.push(new Action(ACTION_COMMIT, CLEARING_WELL));
_local1.push(new Action(ACTION_WALK, STORAGE_WELL, ITEM_LOG));
_local1.push(new Action(ACTION_CROUCH, NOTHING, 10));
_local1.push(0);
break;
case CLEARING_DEBRIS :
_local1.push(new Action(ACTION_WALK, DEBRIS));
_local1.push(new Action(ACTION_CROUCH, NOTHING, null, "Cleaning up the beach"));
_local1.push(new Action(ACTION_COMMIT, CLEARING_DEBRIS));
_local1.push(new Action(ACTION_WALK, STORAGE_DEBRIS, ITEM_LOG));
_local1.push(new Action(ACTION_CROUCH, NOTHING, 10));
break;
case GOING_INDOORS :
_local1.push(new Action(ACTION_WALK, SMALL_HUT, 0, "Going indoors"));
_local1.push(new Action(ACTION_WORK, NOTHING, 50, "...", true));
_local1.push(0);
break;
case DISCOVER_SCHOOL :
_local1.push(new Action(ACTION_WALK, MAIN_HUT));
_local1.push(new Action(ACTION_WORK, DISCOVER_SCHOOL, null, "Examining hut"));
_local1.push(new Action(ACTION_COMMIT, DISCOVER_SCHOOL));
break;
case BUILDING_HUT :
_local1.push(new Action(ACTION_WALK, NEW_HUT));
_local1.push(new Action(ACTION_CROUCH, BUILDING_HUT));
_local1.push(new Action(ACTION_COMMIT, BUILDING_HUT));
if (Rnd(10) > 5) {
_local1.push(new Action(ACTION_WALK, STORAGE));
_local1.push(new Action(ACTION_CROUCH));
_local1.push(new Action(ACTION_WALK, NEW_HUT, ITEM_ROCK));
} else {
_local1.push(new Action(ACTION_WALK, STORAGE_DEBRIS));
_local1.push(new Action(ACTION_CROUCH));
_local1.push(new Action(ACTION_WALK, NEW_HUT, ITEM_LOG));
}
break;
case BREEDING :
_local1.push(new Action(ACTION_WALK, OPEN_FIELD, ITEM_BABY));
_local1.push(new Action(ACTION_WALK, OPEN_FIELD, ITEM_BABY));
break;
case EATING :
if ((char.health < 100) && (_local6.food > 10)) {
_local1.push(new Action(ACTION_WALK, FOOD_BASKET_EAT, 0, "Eating"));
_local1.push(new Action(ACTION_WORK, NOTHING, 10, "Eating"));
_local1.push(new Action(ACTION_WALK, FOOD_BASKET_EAT, 0, "|The villager feels better after eating."));
char.health = MinMax((char.health = char.health + 2), 5, 100);
_local6.food = _local6.food - FOOD_CONSUMPTION;
}
_local1.push(new Action(ACTION_WALK, OPEN_FIELD));
_local1.push(0);
break;
case PUSH_BOULDER :
CuriousQueue(_local1, "Pushing the boulder", BOULDER);
break;
case CURIOUS_CACTUS :
CuriousQueue(_local1, "Curious about the cactus", CACTUS);
break;
case CURIOUS_ROSE :
CuriousQueue(_local1, "Curious about the large rose", ROSE);
break;
case CURIOUS_LILY :
CuriousQueue(_local1, "Curious about strange lily", LILY);
break;
case CURIOUS_PLANT :
CuriousQueue(_local1, "Curious about fruitless plant", PLANT);
break;
case CURIOUS_RUINS :
CuriousQueue(_local1, "Curious about the ruins", RUINS);
break;
case CURIOUS_ROCK :
CuriousQueue(_local1, "Curious about the rock", STATUE);
break;
case CONFUSED :
_local1.push(new Action(ACTION_WALK, OPEN_FIELD, 0, "Confused"));
_local1.push(0);
GameStatus("Perhaps more research is needed.");
break;
case RUNNING_AWAY :
_local1.push(new Action(ACTION_WALK, OPEN_FIELD, 0, "Running away"));
_local1.push(0);
break;
case NOTHING :
default :
var _local7 = [OPEN_FIELD, STORAGE, ROCKS, BUSH, FARM_FIELD, WELL, WHITE_SAND];
var _local8 = ["Nothing", "Unsure what to do"];
var _local4 = GetTask(CLEARING_WELL);
if (_local4.progress < _local4.length) {
_local8.push("Frustrated by the dirty well");
_local8.push("Nothing");
}
_local4 = GetTask(CLEARING_DEBRIS);
if (_local4.progress < _local4.length) {
_local8.push("Frustrated by the dirty beach");
_local8.push("Nothing");
}
if (_local6.food <= FOOD_LOW_LEVEL) {
var _local2 = 0;
while (_local2 < 10) {
_local8.push("Worried about food");
_local2++;
}
}
if (char.age < AGE_TO_TEEN) {
_local8 = ["Chasing butterflies", "Running", "Nothing"];
}
var _local9 = _local8[Math.floor(Math.random() * _local8.length)];
_local1.push(new Action(ACTION_WALK, _local7[Math.floor(Math.random() * _local7.length)], 0, _local9));
_local1.push(new Action(ACTION_WALK, OPEN_FIELD));
_local1.push(0);
}
char.actionQueue = _local1;
}
function CuriousQueue(queue, text, area) {
var _local1 = 0;
while (_local1 < 3) {
queue.push(new Action(ACTION_WALK, area, 0, text));
_local1++;
}
queue.push(new Action(ACTION_WORK, NOTHING, 10, text));
queue.push(new Action(ACTION_WALK, OPEN_FIELD));
queue.push(0);
}
function ShakeHead(char) {
var _local3 = char.actionQueue[0];
ClearActions(char);
_local3.length = 20 + (Math.random() * 10);
var _local1 = ["Shaking head", "Nothing"];
if (char.age < AGE_TO_ADULT) {
_local1.push("Complaining");
}
var _local4 = _local1[Math.floor(Math.random() * _local1.length)];
char.actionQueue = new Array(_local3, new Action(ACTION_WALK, OPEN_FIELD, null, _local4));
}
function Celebrate(except) {
var _local7 = GetGame();
var _local6 = _local7.villagers;
var _local3 = 0;
while (_local3 < _local6.length) {
var _local2 = _local6[_local3];
if (_local2 == except) {
} else {
_local2.path = new Array(CopyPoint(_local2.pos));
var _local4 = new Array();
var _local1 = 0;
while (_local1 < 4) {
_local4.push(new Action(ACTION_WALK, GetTaskLocation(except.task), 0, "Celebrating"));
_local1++;
}
_local2.actionQueue = _local4;
}
_local3++;
}
CreatePopup("popupMsgOk", PuzzleText(except.task));
if (_local7.help) {
if (except.task == CLEARING_WELL) {
_local7.helpShown[7] = true;
ShowHelpTask(7.1, true);
}
}
SaveGame();
}
function GatherToSchool(childrenOnly) {
var _local7 = GetGame();
var _local5 = _local7.villagers;
var _local3 = 0;
for ( ; _local3 < _local5.length ; _local3++) {
var _local2 = _local5[_local3];
if (childrenOnly) {
if (_local2.age >= AGE_TO_TEEN) {
continue;
}
} else {
_local2.path = new Array(CopyPoint(_local2.pos));
var _local4 = new Array();
var _local1 = 0;
while (_local1 < 4) {
_local4.push(new Action(ACTION_WALK, MAIN_HUT, 0, "studying at school"));
_local1++;
}
_local2.actionQueue = _local4;
}
}
}
Frame 23
function GameData() {
this.villagers = InitVillagers();
this.tech = 99;
this.food = 225;
this.berries = 2000;
this.tasks = InitTasks();
this.techs = new Array(1, 1, 1, 1, 1, 1);
this.startTime = GetTimeStamp();
this.lastSave = GetTimeStamp();
this.lastUpdate = GetTimeStamp();
this.lastPopup15 = GetTimeStamp();
this.lastPopup240 = GetTimeStamp();
this.mapPos = new CPoint(-300, -300);
this.statusText = "Welcome to Virtual Villagers.";
this.intro = false;
this.welcome = false;
this.sound = 50;
this.music = 50;
this.lastHelp = GetTimeStamp();
this.help = false;
this.helpIndex = 0;
this.helpShown = new Array();
}
function CreateGame() {
var _local1 = SharedObject.getLocal(SHARED_OBJECT);
_local1.clear();
return(new GameData());
}
function NewGame(intro, help) {
_global.game = CreateGame();
var _local2 = GetGame();
_local2.intro = intro;
_local2.help = help;
SaveGame();
}
function LoadGame() {
var _local1 = SharedObject.getLocal(SHARED_OBJECT);
if (_local1.data.version != VERSION) {
_local1.clear();
delete _local1.data.game;
}
if (_local1.data.game == undefined) {
return(CreateGame());
}
ClearAllActions();
return(_local1.data.game);
}
function SaveGame() {
var _local1 = SharedObject.getLocal(SHARED_OBJECT);
_local1.data.game = GetGame();
_local1.data.version = VERSION;
if (!_local1.flush()) {
System.showSettings(1);
return(false);
}
return(true);
}
function GetGame() {
return(_global.game);
}
function GetVillagerIndex(v) {
var _local4 = GetGame();
var _local2 = _local4.villagers;
var _local1 = 0;
while (_local1 < _local2.length) {
if (_local2[_local1] == v) {
return(_local1);
}
_local1++;
}
return(null);
}
function UpdateGame() {
if (_root.gameMap._visible) {
UpdateEvents();
UpdateHelp();
RandomPopup();
}
var _local6 = GetGame();
var _local7 = GetTimeStamp();
if (_local6.lastUpdate == 0) {
_local6.lastUpdate = _local7;
}
var _local4 = _local7 - _local6.lastUpdate;
var _local9 = false;
var _local8 = false;
if (_local4 < UPDATE_INTERVAL) {
return(undefined);
}
if (_local4 > DORMANT) {
_local8 = true;
}
if (_local4 > ONE_HOUR) {
_local9 = true;
_local4 = ONE_HOUR;
}
_local6.lastUpdate = _local6.lastUpdate + _local4;
if (_local8) {
_local6.lastUpdate = GetTimeStamp();
}
var _local5 = _local6.villagers;
var _local2 = 0;
while (_local2 < _local5.length) {
var _local3 = _local5[_local2];
UpdateVillager(_local3, _local4);
_local2++;
}
_local4 = _local7 - _local6.lastSave;
if (_local4 > ONE_MINUTE) {
_local6.lastSave = _local7;
var _local10 = Math.random() * 100;
if (_local10 > 80) {
SaveGame();
}
}
}
function UpdateBackground() {
var _local4 = GetGame();
var _local5 = _local4.villagers;
var _local7 = 0;
var _local6 = 0;
var _local3 = 0;
while (_local3 < _local5.length) {
var _local1 = _local5[_local3];
if (_local1.skill == FARMER) {
_local4.food = _local4.food + 4;
}
if (_local1.skill == RESEARCHER) {
_local4.tech = _local4.tech + 4;
}
var _local2 = GetTask(_local1.task);
if ((_local2.progress + 10) < _local2.length) {
_local2.progress = _local2.progress + 4;
}
if (_local1.health <= 96) {
if (_local4.food > FOOD_OK_LEVEL) {
_local1.health++;
}
if (_local4.food > FOOD_ABUNDANT_LEVEL) {
_local1.health = _local1.health + 2;
}
}
_local3++;
}
_local4.food = _local4.food + (4 * _local6);
_local4.tech = _local4.tech + (4 * _local7);
}
function GameStatus(s) {
var _local1 = GetGame();
_local1.statusText = s;
}
_global.game = LoadGame();
PlayMusic();
Frame 25
play();
Frame 26
function checkLoadGame() {
var _local3 = GetGame();
var _local2 = GetTimeStamp();
var _local1 = _local2 - _local3.lastUpdate;
return(_local1 < UPDATE_INTERVAL);
}
if (!checkLoadGame()) {
var i = 0;
while (i < 10) {
UpdateGame();
UpdateBackground();
i++;
}
prevFrame();
} else {
SaveGame();
}
Frame 27
function OnStartOver(ret) {
if (ret) {
NewGame();
gotoAndPlay ("newgame");
}
}
function OnQuit(ret) {
if (ret) {
SaveGame();
}
}
function TestEvent(e) {
trace(e.param);
RemoveEvent(e);
}
Instance of Symbol 42 MovieClip [placeholder] "controlLock" in Frame 27
on (press, release, releaseOutside, rollOver, rollOut, dragOver, dragOut) {
this.useHandCursor = false;
}
Frame 29
ControlLock(false);
prevFrame();
Frame 30
function updateStats() {
var _local1 = GetGame();
vPopulation.text = CountAlive();
vFood.text = Math.floor(_local1.food);
vTechPoints.text = Math.floor(_local1.tech);
}
gameMap.miniMap();
ShowHelp(12.1);
Instance of Symbol 72 MovieClip [CMap] "gameMap" in Frame 30
/* no clip actions */
Frame 32
prevFrame();
Frame 33
function showPuzzles() {
var _local7 = GetGfxObjects();
var _local2 = 0;
while (_local2 < _local7.length) {
var _local5 = _local7[_local2];
var _local6 = "puzzle_" + _local5.id;
var _local4 = false;
var _local3 = GetTask(_local5.id);
if (_local3) {
_local4 = _local3.progress >= _local3.length;
}
this[_local6]._visible = _local4;
_local2++;
}
}
showPuzzles();
ShowHelp(10.1);
Instance of Symbol 483 MovieClip "puzzle_8" in Frame 33
on (release) {
var id = Number(_name.split("_")[1]);
_root.CreatePopup("popupMsgOk", _root.PuzzleText(id));
}
Instance of Symbol 484 MovieClip "puzzle_15" in Frame 33
on (release) {
var id = Number(_name.split("_")[1]);
_root.CreatePopup("popupMsgOk", _root.PuzzleText(id));
}
Instance of Symbol 485 MovieClip "puzzle_10" in Frame 33
on (release) {
var id = Number(_name.split("_")[1]);
_root.CreatePopup("popupMsgOk", _root.PuzzleText(id));
}
Instance of Symbol 486 MovieClip "puzzle_9" in Frame 33
on (release) {
var id = Number(_name.split("_")[1]);
_root.CreatePopup("popupMsgOk", _root.PuzzleText(id));
}
Frame 35
prevFrame();
Frame 36
function RefreshTech() {
var _local2 = GetGame();
var _local1 = _local2.techs;
farmer.gotoAndStop(_local1[FARMER] + 1);
builder.gotoAndStop(_local1[BUILDER] + 1);
researcher.gotoAndStop(_local1[RESEARCHER] + 1);
healer.gotoAndStop(_local1[HEALER] + 1);
breeder.gotoAndStop(_local1[BREEDER] + 1);
priest.gotoAndStop(_local1[PRIEST] + 1);
vTechPoints.text = Math.floor(_local2.tech);
}
function PopupTechInfo(id) {
var _local5 = GetGame();
var _local1 = TechText(id);
var _local3 = GetTech(id);
var _local2 = _local5.techs[id];
_local1 = _local1 + (("<br/><br/>Your villagers have level " + _local2) + ".");
if (_local2 < 2) {
_local1 = _local1 + (("<br/>The next level costs: " + _local3.cost[_local2]) + ".");
}
CreatePopup("popupMsgOk", _local1, null, 0, 0, 0, 240);
}
function ShowTechCost(id, bShow) {
var _local6 = GetGame();
var _local4 = GetTech(id);
var _local5 = _local6.techs[id];
var _local2 = "Cost: " + _local4.cost[_local5];
if (bShow != null) {
switch (id) {
case FARMER :
_local2 = "Farming";
break;
case BUILDER :
_local2 = "Construction";
break;
case RESEARCHER :
_local2 = "Science";
break;
case HEALER :
_local2 = "Medicine";
break;
case BREEDER :
_local2 = "Fertility";
break;
case PRIEST :
_local2 = "Spirituality";
}
}
this["cost_" + id].text = _local2;
}
function TechText(id) {
switch (id) {
case FARMER :
return("<p align='center'>Farming</p><br/>Advancements in farming allow your villagers to obtain food from new sources other than berry bush.");
case BUILDER :
return("<p align='center'>Construction</p><br/>Advancements in construction allow your builders to solve more complex problems and build new types of buildings.");
case RESEARCHER :
return("<p align='center'>Science</p><br/>Advancements in science allow your villagers to gain tech points faster.");
case HEALER :
return("<p align='center'>Medicine</p><br/>Advancements in medicine reduce the frequency of disease on the island and significantly increase longevity.");
case BREEDER :
return("<p align='center'>Fertility</p><br/>Advancements in fertility increase the likelihood of a new baby each time two villagers get together.");
case PRIEST :
return("<p align='center'>Spirituality</p><br/>Spirituality plays an important role in the lives of your villagers and has an effect on many aspects of island life.");
}
}
ShowTechCost(FARMER, false);
ShowTechCost(BUILDER, false);
ShowTechCost(RESEARCHER, false);
ShowTechCost(HEALER, false);
ShowTechCost(BREEDER, false);
ShowTechCost(PRIEST, false);
ShowHelp(9.1);
RefreshTech();
Frame 38
prevFrame();
Frame 39
function ShowCharacter() {
var _local2 = selectedChar;
if (DEBUG) {
trace("farming: " + _local2.skills[FARMER]);
trace("building: " + _local2.skills[BUILDER]);
trace("research: " + _local2.skills[RESEARCHER]);
trace("health: " + _local2.health);
}
ShowCharGfx(charGfx, _local2, 2.2);
charGfx._x = 100;
charGfx._y = 230;
StatusTube(tubeHealth, _local2.health);
StatusTube(tubeFarming, _local2.skills[FARMER]);
StatusTube(tubeResearch, _local2.skills[RESEARCHER]);
StatusTube(tubeBuilding, _local2.skills[BUILDER]);
StatusTube(tubeHealing, _local2.skills[HEALER]);
StatusTube(tubeBreeding, _local2.skills[BREEDER]);
vName.text = _local2.name;
vAge.text = Math.floor(_local2.age);
vGender.text = LangGender(_local2.gender);
vStatus.text = "";
vHealthStatus.text = LangHealth(_local2);
vSubStatus.text = "";
vLikes.text = _local2.likes;
vDislikes.text = _local2.dislikes;
if (_local2.ageToBirth > 0) {
vStatus.text = "Nursing";
vSubStatus.text = Math.floor((_local2.ageToBirth * TSCALE_ONE_YEAR) / 60000) + " min";
}
var _local3 = this["btn" + _local2.skill];
checkMark._x = _local3._x - 2;
checkMark._y = _local3._y - 2;
if (DEBUG) {
vAge.text = _local2.age;
}
}
function PrevChar(c) {
selectedChar.name = vName.text;
var _local2 = GetGame();
var _local1 = GetVillagerIndex(selectedChar);
_local1--;
if (_local1 < 0) {
_local1 = _local2.villagers.length - 1;
}
SelectVillager(_local2.villagers[_local1]);
if (_local2.villagers[_local1].health <= 0) {
PrevChar();
return(undefined);
}
ShowCharacter();
}
function NextChar(c) {
selectedChar.name = vName.text;
var _local2 = GetGame();
var _local1 = GetVillagerIndex(selectedChar);
_local1++;
if (_local1 > (_local2.villagers.length - 1)) {
_local1 = 0;
}
SelectVillager(_local2.villagers[_local1]);
if (_local2.villagers[_local1].health <= 0) {
NextChar();
return(undefined);
}
ShowCharacter();
}
charGfx._visible = false;
ShowCharacter();
ShowHelp(11.1);
Frame 41
prevFrame();
Frame 42
function UpdateScore() {
var _local3 = GetGame();
vPopulation.text = CountAlive();
vFood.text = Math.floor(_local3.food);
vTechPoints.text = Math.floor(_local3.tech);
vStatus.text = _local3.statusText;
var _local1 = selectedChar;
if (_local1) {
vName.text = _local1.name;
vSkill.text = LangSkill(_local1);
var _local4 = LangAction(_local1);
var _local2 = _local4.split("|");
if (_local2.length > 1) {
vAction.text = _local2[0];
GameStatus(_local2[1]);
} else {
vAction.text = LangAction(_local1);
}
}
}
function SaveMapPos() {
var _local1 = GetGame();
_local1.mapPos.x = gameMap.gfx._x;
_local1.mapPos.y = gameMap.gfx._y;
}
function LoadMapPos() {
var _local1 = GetGame();
gameMap.gfx._x = _local1.mapPos.x;
gameMap.gfx._y = _local1.mapPos.y;
}
function SetMapPos(p) {
var _local1 = GetGame();
_local1.mapPos.x = -p.x;
_local1.mapPos.y = -p.y;
}
function ShowWelcome() {
var _local1 = GetGame();
if (_local1.welcome) {
return(undefined);
}
_local1.welcome = true;
waitHelp = true;
CreatePopup("popupMsgOk", "<p align='center'>Welcome to Virtual Villagers</p>\nYour little villagers landed on the shores of a beautiful and mysterious island called Isola. Some basic structures most likely built by the previous islanders, already exist. Your villagers are scared and disoriented. So they need your help to thrive and survive in their new home.", onHelpOk, 0, 0, 0, 260);
ShowArrow("arrowLeft", 340, 300);
}
UpdateScore();
LoadMapPos();
ShowWelcome();
GameStatus("");
if (SHOW_PATHS) {
gameMap.gfx.createEmptyMovieClip("drawArea", 9999);
ShowHotspots(gameMap.gfx.drawArea);
ShowPaths(gameMap.gfx.drawArea);
}
Frame 44
prevFrame();
Frame 45
stop();
Frame 50
stop();
Frame 51
stop();
Frame 53
prevFrame();
Symbol 40 MovieClip [slider] Frame 1
function getPosition() {
var _local2 = btn._x;
var _local1 = Math.floor(((_local2 - 5) * 100) / 230);
return(_local1);
}
function setPosition(p) {
var _local1 = Math.floor((p / 100) * 230);
btn._x = 5 + _local1;
}
Instance of Symbol 39 MovieClip "btn" in Symbol 40 MovieClip [slider] Frame 1
on (press) {
this.startDrag(false, 5, 5, 235, 5);
}
on (release, releaseOutside) {
this.stopDrag();
_parent.onUpdate();
}
Symbol 43 MovieClip [CPopup] Frame 1
#initclip 1
function CPopup() {
}
CPopup.prototype = new MovieClip();
CPopup.prototype.init = function (w, h) {
this.clr = this._parent.clr;
this.w = w;
this.h = h;
this.ow = this._width;
this.oh = this._height;
if (!this.w) {
this.w = this._width;
}
if (!this.h) {
this.h = this._height;
}
this._xscale = 100;
this._yscale = 100;
this.guide.unloadMovie();
this.drawBorders(this.w, this.h);
this.adjustButtons();
};
CPopup.prototype.adjustButtons = function () {
var _local5 = this._parent.btns;
var _local3 = 1;
while (_local3 < 4) {
var _local2 = this._parent["btn" + _local3];
var _local4 = this._parent[("btn" + _local3) + "Text"];
if (_local2 == undefined) {
break;
}
var _local6 = this.oh - _local2._y;
_local2._y = this._height - _local6;
_local4._y = (_local2._y + (_local2._height / 2)) - (_local4._height / 2);
if (_local5) {
_local4.text = _local5[_local3 - 1];
if (_local5[_local3 - 1] == "") {
_local2._visible = false;
}
}
_local3++;
}
};
CPopup.prototype.drawBorders = function (width, height) {
var _local4 = this;
var _local2;
var _local6 = width;
var _local8 = height;
if (!_local6) {
_local6 = _local4._width;
}
if (!_local8) {
_local8 = _local4._height;
}
var _local3 = 0;
var _local7 = 1;
while (_local7 < 100) {
var _local5 = 1;
while (_local5 < 100) {
_local4.attachMovie("borderBack" + this.clr, "bk" + _local3, 1100 + _local3);
_local2 = _local4["bk" + _local3];
w = _local5 * _local2._width;
h = _local7 * _local2._height;
_local3++;
_local2._x = w;
_local2._y = h;
if ((w + (_local2._width * 2)) > _local6) {
break;
}
_local5++;
}
if ((h + (_local2._height * 2)) > _local8) {
break;
}
_local7++;
}
_local7 = 1;
while (_local7 < 100) {
_local4.attachMovie("borderHorizontal" + this.clr, "bh" + _local3, 1250 + _local3);
_local2 = _local4["bh" + _local3];
_local3++;
w = _local7 * _local2._width;
_local2._x = w;
_local2._y = 0;
_local4.attachMovie("borderHorizontalBottom" + this.clr, "bh" + _local3, 1300 + _local3);
_local2 = _local4["bh" + _local3];
_local3++;
_local2._x = w;
_local2._y = _local8 - _local2._height;
if ((w + (_local2._width * 2)) > _local6) {
break;
}
_local7++;
}
_local7 = 1;
while (_local7 < 100) {
_local4.attachMovie("borderVerticalLeft" + this.clr, "bv" + _local3, 1350 + _local3);
_local2 = _local4["bv" + _local3];
h = _local7 * _local2._height;
_local2._x = 0;
_local2._y = h;
_local3++;
_local4.attachMovie("borderVertical" + this.clr, "bv" + _local3, 1400 + _local3);
_local2 = _local4["bv" + _local3];
_local2._x = _local6 - _local2._width;
_local2._y = h;
if ((h + (_local2._height * 2)) > _local8) {
break;
}
_local7++;
}
_local4.attachMovie("borderTopLeft" + this.clr, "btl", 2000);
_local2 = _local4.btl;
_local2._x = 0;
_local2._y = 0;
_local4.attachMovie("borderTopRight" + this.clr, "btr", 2001);
_local2 = _local4.btr;
_local2._x = _local6 - _local2._width;
_local2._y = 0;
_local4.attachMovie("borderBottomLeft" + this.clr, "bbl", 2002);
_local2 = _local4.bbl;
_local2._x = 0;
_local2._y = _local8 - _local2._height;
_local4.attachMovie("borderBottomRight" + this.clr, "bbr", 2003);
_local2 = _local4.bbr;
_local2._x = _local6 - _local2._width;
_local2._y = _local8 - _local2._height;
};
Object.registerClass("CPopup", CPopup);
#endinitclip
Symbol 46 MovieClip [gMH0] Frame 1
stop();
Symbol 52 MovieClip [gM1] Frame 1
stop();
Symbol 58 MovieClip [gM0] Frame 1
stop();
Symbol 67 MovieClip Frame 1
stop();
Symbol 72 MovieClip [CMap] Frame 1
#initclip 3
function CMap() {
this.game = GetGame();
this.gfxIndex = 0;
this.useHandCursor = false;
this.viewport = new CRect(0, 0, 400, 400);
this.init();
this.dragCharacter = null;
this.hitCharacter = null;
this.scrollX = 0;
this.scrollY = 0;
this.pIndex = PARTICLE_INDEX;
}
CMap.prototype.init = function () {
var _local11 = this.game;
var _local3 = 0;
while (_local3 < 4) {
var _local2 = 0;
while (_local2 < 4) {
var _local7 = ("gMap" + _local3) + _local2;
this.gfx.attachMovie(_local7, _local7, (1000 + (_local3 * 4)) + _local2);
var _local6 = this.gfx[_local7];
_local6._x = _local3 * 369;
_local6._y = _local2 * 384;
_local2++;
}
_local3++;
}
var _local10 = GetGfxObjects();
var _local5 = 0;
while (_local5 < _local10.length) {
var _local4 = _local10[_local5];
var _local7 = "gfxObj" + _local4.gfx;
this.gfx.attachMovie(_local4.gfx, _local7, 2000 + this.gfxIndex);
var _local6 = this.gfx[_local7];
_local6._x = _local4.pos.x;
_local6._y = _local4.pos.y;
this.gfxIndex++;
_local5++;
}
this.updateTaskObjects();
var _local9 = _local11.villagers;
_local5 = 0;
while (_local5 < _local9.length) {
var _local8 = _local9[_local5];
this.addVillagerClip(_local8);
_local5++;
}
};
CMap.prototype.getIndex = function () {
this.pIndex++;
if (this.pIndex > 1800) {
this.pIndex = PARTICLE_INDEX;
}
return(this.pIndex);
};
CMap.prototype.addVillagerClip = function (v) {
var _local3 = "gVill" + (this.gfxIndex++);
this.gfx.attachMovie("CVillager", _local3, 3000 + this.gfxIndex);
var _local2 = this.gfx[_local3];
_local2.init(v);
_local2.show(true);
v.clip = _local2;
_local2.update();
};
CMap.prototype.showSector = function (x, y, visible) {
var _local3 = ("gMap" + x) + y;
var _local2 = this.gfx[_local3];
if (visible) {
_local2.gotoAndStop(1);
} else {
_local2.gotoAndStop(3);
}
};
CMap.prototype.updateView = function () {
var _local3 = 0;
while (_local3 < 4) {
var _local2 = 0;
while (_local2 < 4) {
var _local4 = ("gMap" + _local3) + _local2;
var _local5 = this.gfx[_local4];
this.showSector(_local3, _local2, true);
_local2++;
}
_local3++;
}
};
CMap.prototype.onPress = function () {
GameStatus("");
if (this._xscale != 100) {
var _local3 = new CPoint(_xmouse - this._x, _ymouse - this._y);
ScalePoint(_local3, 2.4);
SetMapPos(_local3);
_root.gotoAndPlay("game");
return(undefined);
}
this.onStartDrag();
};
CMap.prototype.onRelease = function () {
this.onEndDrag();
};
CMap.prototype.onReleaseOutside = function () {
this.onEndDrag();
};
CMap.prototype.onStartDrag = function () {
this.setScroll(0, 0);
if ((this.dragCharacter = this.checkHitCharacter())) {
this.dragCharacter.onStartDrag();
return(undefined);
}
if (this.checkHitObject()) {
return(undefined);
}
this.gfx.startDrag(false, -776, -896, 0, 0);
};
CMap.prototype.onEndDrag = function () {
if (this.dragCharacter) {
this.dragCharacter.onEndDrag();
this.dragCharacter = null;
return(undefined);
}
this.gfx.stopDrag();
this.updateView();
ShowHelp(1.1);
};
CMap.prototype.checkHitCharacter = function () {
this.hitCharacter = null;
var _local4 = this.game.villagers;
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = _local4[_local2];
if (_local3.clip.hitTest(_xmouse, _ymouse, true)) {
this.hitCharacter = _local3.clip;
break;
}
_local2++;
}
return(this.hitCharacter);
};
CMap.prototype.checkHitObject = function () {
var _local8 = GetGame();
GameStatus("");
var _local6 = GetGfxObjects();
var _local3 = null;
var _local7 = false;
var _local2 = 0;
while (_local2 < _local6.length) {
_local3 = _local6[_local2];
if (_local3.gfx) {
var _local5 = "gfxObj" + _local3.gfx;
var _local4 = this.gfx[_local5];
if (_local4.hitTest(_xmouse, _ymouse)) {
_local7 = true;
break;
}
}
_local2++;
}
if (!_local7) {
return(false);
}
var _local10 = GetTask(_local3.id);
switch (_local3.gfx) {
case "drums" :
GatherToSchool(true);
break;
case "berries" :
GameStatus("Berries remaining: " + Math.floor(_local8.berries));
break;
case "food" :
GameStatus("Food available to the villagers: " + Math.floor(_local8.food));
break;
case "hut" :
var _local9 = Math.floor((_local10.progress / _local10.length) * 50) + 50;
GameStatus("Percentage construction completed: " + _local9);
default :
_local10 = GetTask(_local3.id);
if (!_local10) {
break;
}
}
return(false);
};
CMap.prototype.setScroll = function (x, y) {
this.scrollX = x;
this.scrollY = y;
};
CMap.prototype.update = function () {
this.updateTaskObjects();
UpdateGame();
UpdateScore();
if (this.gfx._y >= 0) {
this.gfx._y = 0;
this.scrollY = 0;
return(undefined);
}
if (this.gfx._x >= 0) {
this.gfx._x = 0;
this.scrollX = 0;
return(undefined);
}
if (this.gfx._x <= -776) {
this.gfx._x = -776;
this.scrollX = 0;
return(undefined);
}
if (this.gfx._y <= -896) {
this.gfx._y = -896;
this.scrollY = 0;
return(undefined);
}
if (this.scrollX > 0) {
this.scrollX--;
this.gfx._x = this.gfx._x + SCROLL_SPEED;
this.dragCharacter._x = this.dragCharacter._x - SCROLL_SPEED;
}
if (this.scrollX < 0) {
this.scrollX++;
this.gfx._x = this.gfx._x - SCROLL_SPEED;
this.dragCharacter._x = this.dragCharacter._x + SCROLL_SPEED;
}
if (this.scrollY > 0) {
this.scrollY--;
this.gfx._y = this.gfx._y + SCROLL_SPEED;
this.dragCharacter._y = this.dragCharacter._y - SCROLL_SPEED;
}
if (this.scrollY < 0) {
this.scrollY++;
this.gfx._y = this.gfx._y - SCROLL_SPEED;
this.dragCharacter._y = this.dragCharacter._y + SCROLL_SPEED;
}
SaveMapPos();
};
CMap.prototype.updateTaskObjects = function () {
var _local6 = GetGame();
var _local2 = 100;
var _local8 = GetGfxObjects();
var _local4 = 0;
while (_local4 < _local8.length) {
var _local3 = _local8[_local4];
switch (_local3.id) {
case FORAGING :
_local2 = Math.floor((MinMax(MAX_BERRIES - _local6.berries, 1, MAX_BERRIES) * 100) / MAX_BERRIES);
StatusTube(this.gfx.gfxObjberries, _local2);
break;
case STORING_FOOD :
_local2 = 0;
if (_local6.food > FOOD_LOW_LEVEL) {
_local2 = 30;
}
if (_local6.food > FOOD_OK_LEVEL) {
_local2 = 60;
}
if (_local6.food > FOOD_ABUNDANT) {
_local2 = 100;
}
StatusTube(this.gfx.gfxObjfood, _local2);
break;
default :
if (!_local3.gfx) {
break;
}
var _local5 = GetTask(_local3.id);
if (_local5) {
_local2 = Math.floor((_local5.progress / _local5.length) * 100);
_local2 = MinMax(_local2, 0, 100);
}
var _local7 = "gfxObj" + _local3.gfx;
StatusTube(this.gfx[_local7], _local2);
}
_local4++;
}
};
CMap.prototype.miniMap = function () {
this._xscale = 25;
this._yscale = 25;
this.mask._width = 1210;
this.mask._height = 1260;
this.gfx.setMask(this.mask);
};
Object.registerClass("CMap", CMap);
#endinitclip
Symbol 72 MovieClip [CMap] Frame 5
this.update();
gotoAndPlay ("animate");
Symbol 93 MovieClip [gMap00] Frame 1
stop();
Symbol 97 MovieClip [gMap01] Frame 1
stop();
Symbol 102 MovieClip [gMap02] Frame 1
stop();
Symbol 104 MovieClip [gMap03] Frame 1
stop();
Symbol 109 MovieClip [gMap10] Frame 1
stop();
Symbol 111 MovieClip [gMap11] Frame 1
stop();
Symbol 113 MovieClip [gMap12] Frame 1
stop();
Symbol 115 MovieClip [gMap13] Frame 1
stop();
Symbol 119 MovieClip [gMap20] Frame 1
stop();
Symbol 123 MovieClip [gMap21] Frame 1
stop();
Symbol 125 MovieClip [gMap22] Frame 1
stop();
Symbol 127 MovieClip [gMap23] Frame 1
stop();
Symbol 131 MovieClip [gMap30] Frame 1
stop();
Symbol 135 MovieClip [gMap31] Frame 1
stop();
Symbol 139 MovieClip [gMap32] Frame 1
stop();
Symbol 141 MovieClip [gMap33] Frame 1
stop();
Symbol 147 MovieClip Frame 1
stop();
Symbol 150 MovieClip Frame 1
stop();
Symbol 151 MovieClip [CVillager] Frame 1
#initclip 2
function CVillager() {
}
CVillager.prototype = new MovieClip();
CVillager.prototype.init = function (charData) {
this.charData = charData;
this.frame = 0;
this.headFrame = 0;
this.hidden = false;
this.isDragged = false;
this.dragSound = false;
this.inWater = false;
this.loadGfx(charData.gender, charData.skinHead, charData.skinBody);
this.checkInWater();
};
CVillager.prototype.loadGfx = function (gender, head, body) {
this.hidden = true;
var _local3 = (("g" + gender) + "H") + head;
this.gfxHead.attachMovie(_local3, "gfx", 1);
var _local2 = ("g" + gender) + body;
this.gfxBody.attachMovie(_local2, "gfx", 1);
this.loadDead();
};
CVillager.prototype.loadDead = function () {
var _local2 = this.charData;
if (_local2.health > 0) {
return(undefined);
}
this.focus._visible = false;
if (!this.gfxDead.gfx) {
this.doHide();
this.gfxDead.attachMovie("gSkels", "gfx", 1);
this._x = _local2.pos.x;
this._y = _local2.pos.y;
this._visible = true;
var _local3 = Math.floor(Math.random() * 5);
this.gfxDead.gfx.gotoAndStop(_local3);
}
};
CVillager.prototype.getCurrentAnimation = function () {
var _local3 = this.charData;
var _local2 = _local3.actionQueue[0];
if ((!_local2) || (_local2.animation == ACTION_COMMIT)) {
return(ACTION_WALK);
}
return(_local2.animation);
};
CVillager.prototype.doHide = function () {
this._visible = false;
this.gfxBody.gfx.gotoAndStop(1);
this.gfxHead.gfx.gotoAndStop(1);
this.gfxItem.gotoAndStop(1);
};
CVillager.prototype.update = function () {
this.focus.gotoAndStop(1);
if (this.inWater) {
this.checkInWater();
}
this.gfxBody._visible = !this.inWater;
this.focus._visible = !this.inWater;
if (this.isDragged) {
if ((!this.dragSound) && (Math.abs(this._x - this.charData.pos.x) > 20)) {
PlayCharSound(this.charData, 1);
this.dragSound = true;
}
this.focus.gotoAndStop(3);
return(undefined);
}
var _local2 = this.charData;
if (_local2.health <= 0) {
this.loadDead();
return(undefined);
}
this.run = _local2.run;
this.adjustHeight();
if (IsSelected(_local2)) {
this.focus.gotoAndStop(2);
}
UpdateAction(_local2);
this._x = _local2.pos.x;
this._y = _local2.pos.y;
this._visible = true;
if (this.hidden) {
this.doHide();
return(undefined);
}
var _local3 = this.getCurrentAnimation();
if (_local3 == ACTION_STAND) {
_local3 = ACTION_WALK;
this.frame = 0;
}
var _local6 = _local2.dir;
var _local4 = Array();
_local4[ACTION_WALK] = [[1, 2, 3, 4, 5, 6, 7, 8], [9, 10, 11, 12, 13, 14, 15, 16], [8, 7, 6, 5, 4, 3, 2, 1], [16, 15, 14, 13, 12, 11, 10, 9]];
_local4[ACTION_CROUCH] = [1, 2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 2, 1, 1, 1, 1, 1, 1];
_local4[ACTION_WORK] = [5, 6, 7, 8, 8, 8, 7, 6, 5];
_local4[ACTION_SIT] = [9];
var _local16 = [2, 3, 4];
var _local15 = _local16[2];
if (_local3 == ACTION_WALK) {
_local15 = _local16[Math.floor(_local6 / 2)];
}
var _local8 = _local4[_local3];
if (_local3 == ACTION_WALK) {
_local8 = _local8[_local6];
}
var _local19 = _local8.length;
if (this.frame >= _local19) {
this.frame = 0;
}
var frame = _local8[Math.floor(this.frame)];
this.gfxBody.gfx.gotoAndStop(_local15);
this.setFrame(this.gfxBody, frame);
var _local10 = [1, 2, 3, 4];
var _local17 = [1, 4];
var _local20 = [5, 6, 7];
var _local12 = [1, 0, -2, -1];
var _local11 = [-3, -2, -2, -3];
var _local7 = _local10[0];
var _local13 = 0;
var _local5 = -2;
switch (_local3) {
case ACTION_WALK :
_local7 = _local10[_local6];
_local13 = _local12[_local6];
_local5 = _local11[_local6];
break;
case ACTION_WORK :
_local7 = _local17[Math.floor(this.headFrame / (25 - (Math.random() * 5)))];
_local5 = -3;
break;
case ACTION_SIT :
_local7 = _local20[Math.floor(this.headFrame / (16 - (Math.random() * 5)))];
_local5 = 3;
break;
case ACTION_CROUCH :
_local7 = _local10[DIR_NORTH];
_local12 = [0, -1, -2, -4, -5];
_local11 = [3, 3, 3, 4, 5];
_local13 = _local12[frame];
_local5 = _local11[frame];
}
if (this.headFrame > 50) {
this.headFrame = 0;
}
this.setFrame(this.gfxHead, _local7);
this.gfxHead.gfx.gotoAndStop(2);
this.gfxHead._x = this.gfxHead._x + _local13;
this.gfxHead._y = _local5 - 37;
if (this.inWater) {
this._y = this._y + 20;
var _local14 = true;
if (this.ripple) {
if ((this.ripple._currentframe < 10) && (this.ripple._currentframe > 0)) {
_local14 = false;
}
}
if (_local14) {
var _local9 = this._parent._parent;
if (!_local9) {
return(undefined);
}
var _local18 = _local9.getIndex();
this.ripple = CreateParticle(_local9.gfx, "ripple", _local18, this._x, this._y - 30);
}
}
switch (_local3) {
case ACTION_WORK :
this.frame = this.frame + 0.25;
break;
case ACTION_NOTHING :
this.frame = this.frame + 0.01;
break;
default :
this.frame = this.frame + 0.5;
if (!this.run) {
break;
}
this.frame = this.frame + 1.5;
}
this.headFrame++;
this.showItem();
};
CVillager.prototype.setFrame = function (obj, frame) {
obj._x = ((frame - 1) * -28) - 14;
};
CVillager.prototype.onStartDrag = function () {
this.isDragged = true;
this.startDrag(false, 0, 20, 1180, 1230);
SelectVillager(this.charData);
};
CVillager.prototype.onEndDrag = function () {
this.dragSound = false;
this.stopDrag();
if (this.checkInWater()) {
var _local8 = this.charData.actionQueue[0];
var _local7 = GetTask(CLEARING_DEBRIS);
if (_local7.progress < _local7.length) {
_local8.comment = "Leaving the water";
GameStatus("There's too much debris to swim here.");
}
} else {
var _local5 = this._parent._parent;
if (_local5) {
var _local2 = 0;
while (_local2 < 4) {
var _local3 = CreateParticle(_local5.gfx, "dust", _local5.getIndex(), (this._x - 8) + (_local2 * 4), this._y + 4);
_local3._xscale = 50;
_local3._yscale = 50;
_local2++;
}
}
}
this.isDragged = false;
var _local4 = this.charData;
if (GetQuickDistance(_local4.pos, new CPoint(this._x, this._y)) < 100) {
return(undefined);
}
ClearActions(_local4);
var _local6 = CheckHotspot(this._x, this._y);
if (_local6) {
if (_local6.task) {
var _local10 = GetTask(_local6.task);
_local4.task = _local10.task;
var _local9 = GetGame();
if (_local9.help) {
switch (_local4.task) {
case FORAGING :
ShowHelp(4.1);
break;
case RESEARCHING :
ShowHelp(5.1);
break;
case BUILDING_HUT :
ShowHelp(6.1);
}
}
if (_local4.age < AGE_TO_TEEN) {
ClearActions(_local4);
_local4.task = NOTHING;
ShowHelp(4.4);
GameStatus("The villager is still too young!");
}
if (_local4.ageToBirth > 0) {
ClearActions(_local4);
GameStatus("She's is nursing a baby!");
_local4.task = BREEDING;
}
}
if (!PointInRect(_local6.workarea, new CPoint(this._x, this._y))) {
_local4.pos = RandomPointInRect(_local6.workarea);
_local4.pos.x = this._x;
this.update();
}
}
if (CheckBlock(this._x, this._y)) {
this.reposition(this._x, this._y);
return(undefined);
}
_local4.pos.x = Math.floor(this._x);
_local4.pos.y = Math.floor(this._y);
if (TRACE_MOUSE) {
trace((_local4.pos.x + ",") + _local4.pos.y);
}
this.checkHitMate();
ShowHelp(3.1);
};
CVillager.prototype.checkScroll = function () {
var _local5 = this._parent._parent;
var _local4 = 0;
var _local3 = 0;
var _local2 = GetGlobalPoint(this);
if (PointInRect(EDGE_TOP, _local2)) {
_local3 = SCROLL_LENGTH;
}
if (PointInRect(EDGE_BOTTOM, _local2)) {
_local3 = -SCROLL_LENGTH;
}
if (PointInRect(EDGE_LEFT, _local2)) {
_local4 = SCROLL_LENGTH;
}
if (PointInRect(EDGE_RIGHT, _local2)) {
_local4 = -SCROLL_LENGTH;
}
_local5.setScroll(_local4, _local3);
};
CVillager.prototype.checkDepth = function () {
if ((Math.random() * 10) > 2) {
return(undefined);
}
var _local10 = GetGame();
var _local7 = _local10.villagers;
var _local8 = this.getDepth();
var _local9 = this.charData;
var _local3 = 0;
while (_local3 < _local7.length) {
var _local2 = _local7[_local3].clip;
var _local6 = _local2.getDepth();
var _local5 = this._y;
var _local4 = _local2._y;
if (_local9.health <= 0) {
_local5 = _local5 - 100;
}
if (_local2.charData.health <= 0) {
_local4 = _local4 - 100;
}
if ((_local8 > _local6) && (_local5 < _local4)) {
_local2.swapDepths(this);
return(undefined);
}
_local3++;
}
};
CVillager.prototype.checkHitMate = function () {
var _local7 = GetGame();
var _local6 = _local7.villagers;
var _local4 = this.charData;
var _local3 = 0;
while (_local3 < _local6.length) {
var _local2 = _local6[_local3];
if (_local2 == _local4) {
} else {
var _local5 = GetQuickDistance(_local2.pos, _local4.pos);
if (_local5 < 300) {
AttemptBreed(_local4, _local2);
}
}
_local3++;
}
};
CVillager.prototype.showItem = function () {
this.gfxItem.gotoAndStop(1);
this.gfxItem2.gotoAndStop(1);
var _local2 = this.charData;
var _local4 = this.gfxItem;
if ((_local2.dir == DIR_WEST) || (_local2.dir == DIR_SOUTH)) {
_local4 = this.gfxItem2;
}
var _local3 = _local2.actionQueue[0];
if ((_local2.ageToBirth > 0) && (_local2.task != GOING_INDOORS)) {
_local3.item = ITEM_BABY;
}
if (_local3.item > 0) {
_local4.gotoAndStop(_local3.item);
}
};
CVillager.prototype.adjustHeight = function () {
var _local4 = this.charData;
var _local5 = _local4.actionQueue[0];
this.hidden = _local5.hidden;
var _local3 = 100;
var _local2 = 100;
if (_local4.age < 5) {
_local3 = 76;
_local2 = 70;
} else if (_local4.age < 8) {
_local3 = 80;
_local2 = 76;
} else if (_local4.age < 12) {
_local3 = 86;
_local2 = 82;
} else if (_local4.age < 15) {
_local3 = 90;
_local2 = 90;
} else if (_local4.age < 18) {
_local3 = 94;
_local2 = 94;
}
_local3 = _local3 + 10;
_local2 = _local2 + 10;
this._xscale = _local3;
this._yscale = _local2;
};
CVillager.prototype.reposition = function (x, y) {
var _local5 = this.charData;
var _local3 = new CPoint(x, y);
var _local4 = new CPoint(CENTER_X, CENTER_Y);
aim = AimTo(_local3, _local4);
ScalePoint(aim, 20);
var _local2 = 0;
while (_local2 < 100) {
OffsetPoint(_local3, aim);
if (!CheckBlock(_local3.x, _local3.y)) {
break;
}
_local2++;
}
_local5.pos = _local3;
};
CVillager.prototype.checkInWater = function () {
this.inWater = false;
var _local4 = this.charData;
var _local3;
var _local2;
if (this.isDragged) {
_local3 = new CPoint(this._x, this._y);
} else {
_local3 = _local4.pos;
}
_local2 = GetQuickDistance(new CPoint(100, 1210), _local3);
if (_local2 < 20000) {
this.inWater = true;
return(true);
}
_local2 = GetQuickDistance(new CPoint(1160, 1210), _local3);
if (_local2 < 10000) {
this.inWater = true;
return(true);
}
return(false);
};
Object.registerClass("CVillager", CVillager);
#endinitclip
Symbol 151 MovieClip [CVillager] Frame 5
if (this.isDragged) {
this.checkScroll();
}
this.checkDepth();
this.update();
gotoAndPlay ("animate");
Symbol 157 MovieClip [gF0] Frame 1
stop();
Symbol 163 MovieClip [gF1] Frame 1
stop();
Symbol 169 MovieClip [gF2] Frame 1
stop();
Symbol 175 MovieClip [gF3] Frame 1
stop();
Symbol 181 MovieClip [gF4] Frame 1
stop();
Symbol 187 MovieClip [gF5] Frame 1
stop();
Symbol 193 MovieClip [gF6] Frame 1
stop();
Symbol 199 MovieClip [gF7] Frame 1
stop();
Symbol 205 MovieClip [gF8] Frame 1
stop();
Symbol 211 MovieClip [gF9] Frame 1
stop();
Symbol 214 MovieClip [gFH0] Frame 1
stop();
Symbol 217 MovieClip [gFH1] Frame 1
stop();
Symbol 220 MovieClip [gFH2] Frame 1
stop();
Symbol 223 MovieClip [gFH3] Frame 1
stop();
Symbol 226 MovieClip [gFH4] Frame 1
stop();
Symbol 229 MovieClip [gFH5] Frame 1
stop();
Symbol 232 MovieClip [gFH6] Frame 1
stop();
Symbol 235 MovieClip [gFH7] Frame 1
stop();
Symbol 238 MovieClip [gFH8] Frame 1
stop();
Symbol 241 MovieClip [gFH9] Frame 1
stop();
Symbol 247 MovieClip [gM2] Frame 1
stop();
Symbol 253 MovieClip [gM3] Frame 1
stop();
Symbol 259 MovieClip [gM4] Frame 1
stop();
Symbol 260 MovieClip [gM5] Frame 1
stop();
Symbol 266 MovieClip [gM6] Frame 1
stop();
Symbol 272 MovieClip [gM7] Frame 1
stop();
Symbol 278 MovieClip [gM8] Frame 1
stop();
Symbol 284 MovieClip [gM9] Frame 1
stop();
Symbol 290 MovieClip [gMH1] Frame 1
stop();
Symbol 293 MovieClip [gMH2] Frame 1
stop();
Symbol 296 MovieClip [gMH3] Frame 1
stop();
Symbol 299 MovieClip [gMH4] Frame 1
stop();
Symbol 302 MovieClip [gMH5] Frame 1
stop();
Symbol 305 MovieClip [gMH6] Frame 1
stop();
Symbol 308 MovieClip [gMH7] Frame 1
stop();
Symbol 311 MovieClip [gMH8] Frame 1
stop();
Symbol 314 MovieClip [gMH9] Frame 1
stop();
Symbol 316 MovieClip [log] Frame 1
stop();
Symbol 328 MovieClip [debris] Frame 1
stop();
Symbol 331 MovieClip [drums] Frame 1
stop();
Symbol 350 MovieClip [berries] Frame 1
stop();
Symbol 357 MovieClip [food] Frame 1
stop();
Symbol 360 MovieClip [boulder] Frame 1
stop();
Symbol 366 MovieClip [blockage] Frame 1
stop();
Symbol 369 Button
on (release) {
_root.ControlLock(false);
if (this.callback) {
this.callback(true);
}
this.removeMovieClip();
}
Symbol 371 MovieClip [popupMsgOk] Frame 1
vMessage.htmlText = text;
this.bg.init(this.w, this.h);
stop();
Symbol 374 Button
on (release) {
_root.ControlLock(false);
if (this.callback) {
this.callback(false);
}
this.removeMovieClip();
}
Symbol 376 MovieClip [popupMsgOkCancel] Frame 1
vMessage.htmlText = text;
this.bg.init(this.w, this.h);
stop();
Symbol 378 Button [placeholder]
on (press) {
_root.ShowUpsell();
}
Symbol 379 Button
on (release) {
SoundIndicator(snd.getPosition(), msc.getPosition());
_root.ControlLock(false);
if (this.callback) {
this.callback(true);
}
this.removeMovieClip();
}
Symbol 393 MovieClip [popupOptions] Frame 1
vMessage.htmlText = text;
this.bg.init(this.w, this.h);
Instance of Symbol 39 MovieClip "btn" in Symbol 393 MovieClip [popupOptions] Frame 1
on (press) {
this.startDrag(false, 5, 5, 235, 5);
}
on (release, releaseOutside) {
this.stopDrag();
_parent.onUpdate();
}
Symbol 393 MovieClip [popupOptions] Frame 2
function SoundIndicator(setSound, setMusic) {
var _local2 = _root.GetGame();
if (setSound != null) {
_local2.sound = setSound;
}
if (setMusic != null) {
_local2.music = setMusic;
}
snd.setPosition(_local2.sound);
}
snd.onUpdate = function () {
_root.PlaySound("button", snd.getPosition());
};
SoundIndicator();
stop();
Symbol 394 MovieClip [ripple] Frame 50
this.unloadMovie();
Symbol 401 MovieClip [hut] Frame 1
stop();
Symbol 404 MovieClip [gSkels] Frame 1
stop();
Symbol 414 MovieClip [popupEvent] Frame 1
vMessage.htmlText = text;
charGfx._visible = false;
this.bg.init(this.w, this.h);
Symbol 414 MovieClip [popupEvent] Frame 2
_root.ShowCharGfx(charGfx, this.char, 1.2);
stop();
Symbol 421 MovieClip [dust] Frame 2
play();
Symbol 421 MovieClip [dust] Frame 3
if ((Math.random() * 10) < 4) {
prevFrame();
}
Symbol 421 MovieClip [dust] Frame 28
this.unloadMovie();
Symbol 432 MovieClip Frame 1
stop();
Symbol 435 Button
on (release) {
_root.DownloadGame();
_root.ControlLock(false);
if (this.callback) {
this.callback(true);
}
this.removeMovieClip();
}
Symbol 438 Button
on (release) {
_root.BuyGame();
_root.ControlLock(false);
if (this.callback) {
this.callback(true);
}
this.removeMovieClip();
}
Symbol 440 MovieClip [popupUpsell] Frame 1
vMessage.htmlText = text;
this.bg.init(this.w, this.h);
stop();
Symbol 448 Button
on (release) {
var g = GetGame();
if (!g.intro) {
gotoAndPlay ("newgame");
} else {
SaveGame();
gotoAndPlay ("game");
}
}
Symbol 451 Button
on (release) {
CreatePopup("popupMsgOkCancel", "<p align='center'>Are you sure you want to abandon the current game?</p>", OnStartOver, 0, 0, 0, 120);
}
Symbol 455 Button
on (release) {
CreatePopup("popupOptions");
}
Symbol 458 Button
on (release) {
gotoAndPlay ("help");
}
Symbol 462 Button
on (release) {
CreatePopup("popupMsgOkCancel", "<p align='center'>Are you sure you want to quit?</p>", OnQuit, 0, 0, 0, 110);
}
Symbol 465 Button
on (release) {
gotoAndPlay ("game");
}
Symbol 467 Button
on (release) {
gotoAndPlay ("menu");
}
Symbol 476 MovieClip Frame 25
stop();
Symbol 477 Button [placeholder]
on (release) {
ShowUpsell();
}
Symbol 478 Button [placeholder]
on (release) {
CreatePopup("popupMsgOk", "<p align='center'>\nThis milestone has not yet been completed.</p>", null, 0, 0, 0, 140);
}
Symbol 489 Button
on (release) {
ShowUpsell();
}
Symbol 504 MovieClip Frame 1
stop();
Symbol 507 MovieClip Frame 1
stop();
Symbol 510 MovieClip Frame 1
stop();
Symbol 513 MovieClip Frame 1
stop();
Symbol 516 MovieClip Frame 1
stop();
Symbol 519 MovieClip Frame 1
stop();
Symbol 522 Button
on (release) {
BuyTech(FARMER);
RefreshTech();
}
on (rollOver) {
ShowTechCost(FARMER);
}
on (rollOut) {
ShowTechCost(FARMER, false);
}
Symbol 524 Button
on (release) {
_root.PopupTechInfo(FARMER);
}
Symbol 526 Button
on (release) {
BuyTech(BUILDER);
RefreshTech();
}
on (rollOver) {
ShowTechCost(BUILDER);
}
on (rollOut) {
ShowTechCost(BUILDER, false);
}
Symbol 527 Button
on (release) {
_root.PopupTechInfo(BUILDER);
}
Symbol 528 Button
on (release) {
BuyTech(HEALER);
RefreshTech();
}
on (rollOver) {
ShowTechCost(HEALER);
}
on (rollOut) {
ShowTechCost(HEALER, false);
}
Symbol 529 Button
on (release) {
_root.PopupTechInfo(HEALER);
}
Symbol 530 Button
on (release) {
BuyTech(RESEARCHER);
RefreshTech();
}
on (rollOver) {
ShowTechCost(RESEARCHER);
}
on (rollOut) {
ShowTechCost(RESEARCHER, false);
}
Symbol 531 Button
on (release) {
_root.PopupTechInfo(RESEARCHER);
}
Symbol 532 Button
on (release) {
BuyTech(BREEDER);
RefreshTech();
}
on (rollOver) {
ShowTechCost(BREEDER);
}
on (rollOut) {
ShowTechCost(BREEDER, false);
}
Symbol 533 Button
on (release) {
_root.PopupTechInfo(BREEDER);
}
Symbol 534 Button
on (release) {
BuyTech(PRIEST);
RefreshTech();
}
on (rollOver) {
ShowTechCost(PRIEST);
}
on (rollOut) {
ShowTechCost(PRIEST, false);
}
Symbol 538 Button
on (release) {
selectedChar.name = vName.text;
gotoAndPlay ("game");
}
Symbol 540 Button
on (release) {
selectedChar.skill = 0;
ShowCharacter();
ShowHelp(11.2);
}
Symbol 544 Button
on (release) {
selectedChar.skill = 1;
ShowCharacter();
ShowHelp(11.2);
}
Symbol 545 Button
on (release) {
selectedChar.skill = 2;
ShowCharacter();
ShowHelp(11.2);
}
Symbol 546 Button
on (release) {
selectedChar.skill = 3;
ShowCharacter();
ShowHelp(11.2);
}
Symbol 547 Button
on (release) {
selectedChar.skill = 4;
ShowCharacter();
ShowHelp(11.2);
}
Symbol 549 Button
on (release) {
selectedChar.skill = 4;
ShowCharacter();
}
Symbol 565 Button
on (release) {
NextChar();
}
Symbol 566 Button
on (release) {
PrevChar();
}
Symbol 572 MovieClip Frame 1
stop();
Symbol 591 Button
on (release) {
gotoAndPlay ("puzzle");
}
Symbol 598 Button
on (release) {
gotoAndPlay ("map");
}
Symbol 602 Button
on (release) {
gotoAndPlay ("tech");
}
Symbol 606 Button
on (release) {
gotoAndPlay ("menu");
}
Symbol 616 Button
on (release) {
if (selectedChar) {
if (selectedChar.health > 0) {
gotoAndPlay ("detail");
}
}
}
Symbol 618 Button
on (release) {
gotoAndPlay ("credits");
}
Symbol 620 Button
on (release) {
nextFrame();
}
Symbol 626 Button
on (release) {
prevFrame();
}
Symbol 633 Button
on (release) {
gotoAndPlay ("help");
}
Symbol 635 Button [placeholder]
on (release) {
nextFrame();
}
Symbol 646 Button
on (release) {
NewGame(true, true);
gotoAndPlay ("game");
}
Symbol 648 Button
on (release) {
NewGame(true, false);
gotoAndPlay ("game");
}