<!--Saved by Quest 5.4.4873.16527-->
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<gridmap />
<mapscale type="int">5</mapscale>
<mapsize type="int">250</mapsize>
<start type="script">
</start>
</game>
<command name="fight_command">
<pattern>attack #object#</pattern>
<script>
fight_function (game.pov, object)
</script>
</command>
<object name="West Gates">
<inherit name="editor_room" />
<attr name="grid_width" type="int">3</attr>
<attr name="grid_fill">SlateGray</attr>
<enter type="script">
play sound ("The Legend Of Zelda Link's Awakening Music_ Mt. Tamaranch.mp3", false, true)
</enter>
<object name="player">
<inherit name="defaultplayer" />
<inherit name="character" />
<damage type="int">2</damage>
<statusattributes type="stringdictionary">
<item>
<key>current_hearts</key>
<value>Hearts: !</value>
</item>
<item>
<key>damage</key>
<value>Attack: !</value>
</item>
</statusattributes>
<attr name="current_hearts" type="int">4</attr>
<money type="int">5</money>
<dodge type="int">5</dodge>
</object>
<exit alias="west" to="west pass1">
<inherit name="westdirection" />
</exit>
</object>
<object name="West Overworld">
<inherit name="editor_room" />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<prefix>Location:(</prefix>
<suffix>)</suffix>
<attr name="grid_width" type="int">1</attr>
<attr name="grid_length" type="int">1</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<object name="west pass1">
<inherit name="editor_room" />
<attr name="grid_width" type="int">5</attr>
<attr name="grid_length" type="int">5</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<exit alias="east" to="West Gates">
<inherit name="eastdirection" />
</exit>
<exit alias="west" to="west pass2">
<inherit name="westdirection" />
</exit>
</object>
<object name="west pass2">
<inherit name="editor_room" />
<attr name="grid_width" type="int">10</attr>
<attr name="grid_length" type="int">5</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<exit alias="east" to="west pass1">
<inherit name="eastdirection" />
</exit>
<exit alias="west" to="west pass3">
<inherit name="westdirection" />
</exit>
</object>
<object name="west pass3">
<inherit name="editor_room" />
<attr name="grid_width" type="int">5</attr>
<attr name="grid_length" type="int">5</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<exit alias="east" to="west pass2">
<inherit name="eastdirection" />
</exit>
<object name="Goblin">
<inherit name="editor_object" />
<inherit name="character" />
<alias>Goblin</alias>
<damage type="double">0.5</damage>
<attr name="current_hearts" type="int">2</attr>
<alt type="stringlist">
<value>monster</value>
</alt>
<open type="boolean">false</open>
<close type="boolean">false</close>
<isopen type="boolean">false</isopen>
<listchildren type="boolean">false</listchildren>
<hidechildren />
<dodge type="int">1</dodge>
</object>
<object name="Rupee">
<inherit name="editor_object" />
<drop type="boolean">false</drop>
<take />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<visible />
<scenery />
<use type="boolean">false</use>
<listchildren type="boolean">false</listchildren>
<money type="int">1</money>
</object>
</object>
</object>
<type name="character">
<dead type="boolean">false</dead>
<damage type="double">0</damage>
<money type="int">0</money>
<attr name="current_hearts" type="int">0</attr>
<dodge type="int">0</dodge>
</type>
<type name="deathdrop">
<killed type="script">
if (monster.dead = false) {
MakeObjectInvisible (Rupee)
}
else if (monster.dead = true) {
MakeObjectVisible (Rupee)
}
</killed>
</type>
<function name="fight_function" parameters="self, monster"><![CDATA[
if (monster = null) {
foreach (obj, AllObjects()) {
if (obj.alias=monster) {
monster = obj
}
else {
msg ("There's no " + monster + "in the vicinity.")
}
}
}
else if (not Doesinherit (monster,"character")) {
msg ("You can not battle that!")
}
else if (monster.dead = true) {
msg (monster.alias + " is already dead.")
}
else {
show menu ("You enter combat with the nasty " + monster.alias +", what do you do?", split("Swing_Up;Swing_Down;Swing_Left;Swing_Right;Block",";"), false) {
switch (result) {
case ("Swing_Up") {
result = 1
}
case ("Swing_Down") {
result = 2
}
case ("Swing_Left") {
result = 3
}
case ("Swing_Right") {
result = 4
}
case ("Block") {
result = 5
}
}
value = GetRandomInt (1,5)
if (value = result) {
if (result=1) {
msg ("You Swing_Up and kill the " + monster.alias +"!")
monster.dead = true
}
else if (result=2) {
msg ("You Swing_Down and kill the " + monster.alias +"!")
monster.dead = true
}
else if (result=3) {
msg ("You Swing_Left and kill the " + monster.alias +"!")
monster.dead = true
}
else if (result=4) {
msg ("You Swing_Right and kill the " + monster.alias +"!")
monster.dead = true
}
else if (result=5) {
msg ("You Block the " + monster.alias +"'s attack!")
fight_function (self, monster)
}
}
else if (result=5) {
msg ("You fail to block the " + monster.alias +"'s attack!")
self.current_hearts = self.current_hearts - monster.damage
msg ("The " + monster.alias + " hit you for " + monster.damage + " damage!")
if (self.current_hearts <= 0) {
msg (monster.alias + " has killed you.")
finish
}
else {
fight_function (self, monster)
}
}
else {
msg ("You miss with your attack!")
if (self.dodge>monster.dodge) {
msg ("You dodged the " +monster.alias+ "'s attack.")
self.current_hearts = self.current_hearts
}
else if (self.dodge<monster.dodge) {
self.current_hearts = self.current_hearts - monster.damage
msg ("The " + monster.alias + " hit you for " + monster.damage + " damage!")
}
if (self.current_hearts <= 0) {
msg (monster.alias + " has killed you.")
finish
}
else {
fight_function (self, monster)
}
}
}
}
]]></function>
</asl>
<!--Saved by Quest 5.4.4873.16527-->
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="random stats">
<gameid>768199f2-28b1-421c-ad44-10f51040cd5b</gameid>
<version>1.0</version>
<firstpublished>2014</firstpublished>
<start type="script">
player.dodge = GetRandomInt(1,10)
goblin.dodge = GetRandomInt(1,10)
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
<object name="goblin">
<inherit name="editor_object" />
<inherit name="male" />
</object>
</object>
</asl>
omega wrote:When i set dodge to string (GetRandomInt(1,10)) it gives me an error
omega wrote:That way the monster has a 50% chance of giving damage
you_go_first=false
if (GetInt (self,"speed") > GetInt (enemy,"speed") {
you_go_first=true
} else if (GetInt (self,"speed") = GetInt (enemy,"speed") and RandomChance (50)=true) {
you_go_first=true
}
self_attack_failed = false
if (RandomChance (GetInt (enemy,"agility") - GetInt (self,"speed")) = true) {
msg (enemy.alias + "evaded your attack!")
self_attack_failed = true
self.defending = false
} else if (RandomChance (GetInt (enemy,"dexterity") - GetInt (self,"agility")) = true) {
msg (enemy.alias + "parried your attack!")
self_attack_failed = true
self.defending = false
} else if (RandomChance (GetInt (enemy,"agility") - GetInt (self,"dexterity")) = true) {
msg (enemy.alias + "blocked your attack!")
self_attack_failed = true
self.defending = false
} else if (RandomChance (GetInt (self,"dexterity") - GetInt (enemy,"speed")) = false) {
msg ("Your attack missed " + enemy.alias +"!")
self_attack_failed = true
self.defending = false
} else if (RandomChance (GetInt (enemy,"armor_class") - GetInt (self,"attack_rating")) = true) {
msg ("Your attack failed to penetrate " + enemy.alias +"!")
self_attack_failed = true
self.defending = false
} else if (self_attack_failed = false) {
// you indeed successfully striked~hit the monster, so now, execute the "your damage upon the monster" scripting
} <asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Test">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<pov type="object">player</pov>
<start type="script">
cc
</start>
<turns type="int">0</turns>
<statusattributes type="simplestringdictionary">turns = </statusattributes>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<inherit name="pc" />
<cur_hp type="int">999</cur_hp>
<max_hp type="int">999</max_hp>
<str type="int">100</str>
<end type="int">100</end>
<dex type="int">100</dex>
<agi type="int">100</agi>
<spd type="int">100</spd>
<hc type="int">100</hc>
<pd type="int">100</pd>
<pr type="int">100</pr>
</object>
<object name="orc1">
<inherit name="editor_object" />
<inherit name="npc" />
<hostile type="boolean">true</hostile>
<dead type="boolean">false</dead>
<alias>orc</alias>
<cur_hp type="int">999</cur_hp>
<max_hp type="int">999</max_hp>
<str type="int">25</str>
<end type="int">25</end>
<dex type="int">25</dex>
<agi type="int">25</agi>
<spd type="int">25</spd>
<hc type="int">25</hc>
<pd type="int">25</pd>
<pr type="int">25</pr>
</object>
</object>
<turnscript name="game_turns">
<enabled />
<script>
sa
game.turns = game.turns + 1
</script>
</turnscript>
<command name="fight">
<pattern>fight #text#</pattern>
<script>
battle_system (game.pov,text)
</script>
</command>
<type name="char">
<cur_hp type="int">0</cur_hp>
<drop type="boolean">false</drop>
<defending type="boolean">false</defending>
<max_hp type="int">0</max_hp>
<str type="int">0</str>
<end type="int">0</end>
<dex type="int">0</dex>
<agi type="int">0</agi>
<spd type="int">0</spd>
<hp type="int">0</hp>
<hc type="int">0</hc>
<pd type="int">0</pd>
<pr type="int">0</pr>
</type>
<type name="pc">
<inherit name="char" />
<statusattributes type="simplestringdictionary">hp = ;str = ;end = ;dex = ;agi = ;spd = ;hc = ;pd = ;pr = </statusattributes>
</type>
<type name="npc">
<inherit name="char" />
<dead type="boolean">false</dead>
<hostile type="boolean">false</hostile>
<displayverbs type="simplestringlist">Look at; Talk; Fight</displayverbs>
</type>
<function name="cc">
msg ("What is your name?")
get input {
game.pov.alias = result
msg (" - " + game.pov.alias)
show menu ("What is your gender?", split ("male;female" , ";"), false) {
game.pov.gender = result
show menu ("What is your race?", split ("human;dwarf;elf" , ";"), false) {
game.pov.race = result
show menu ("What is your class?", split ("warrior;cleric;mage;thief" , ";"), false) {
game.pov.class = result
msg (game.pov.alias + " is a " + game.pov.gender + " " + game.pov.race + " " + game.pov.class + ".")
wait {
ClearScreen
}
}
}
}
}
</function>
<function name="sa">
game.pov.hp = game.pov.cur_hp + " / " + game.pov.max_hp
</function>
<function name="battle_system" parameters="self,text">
enemy = GetObject (text)
if (enemy = null) {
foreach (obj,AllObjects()) {
if (obj.alias=text) {
enemy = obj
}
}
}
if (enemy = null) {
msg ("There is no " + text + " here.")
}
else if (not Doesinherit (enemy,"npc")) {
msg ("You can not battle that!")
}
else if (not npc_reachable (enemy)) {
msg ("There is no " + enemy.alias + " in your vicinity.")
}
else if (GetBoolean (enemy,"dead") = true) {
msg (enemy.alias + " is already dead.")
}
else if (GetBoolean (enemy,"hostile") = false) {
msg (enemy.alias + " is not hostile.")
}
else {
battle_sequence (self,enemy)
}
</function>
<function name="battle_sequence" parameters="self,enemy"><![CDATA[
if (enemy.dead = false) {
playerfirst=false
if (GetInt (self,"spd") > GetInt (enemy,"spd")) {
playerfirst=true
} else if (GetInt (self,"spd") = GetInt (enemy,"spd") and RandomChance (50)) {
playerfirst=true
}
if (playerfirst) {
msg ("You get to go first for this round")
self_battle_turn (self,enemy)
on ready {
if (not enemy.dead){
enemy_battle_turn (self,enemy)
}
}
} else {
msg (enemy.alias + " gets to go first for this round.")
enemy_battle_turn (self,enemy)
msg ("It is now your turn.")
self_battle_turn (self,enemy)
}
on ready {
msg ("The round has ended.")
msg("")
battle_sequence (self,enemy)
}
} else {
msg ("The battle is over.")
}
]]></function>
<function name="self_battle_turn" parameters="self,enemy"><![CDATA[
msg (self.alias + " has " + self.cur_hp + " HP left.")
msg (enemy.alias + " has " + enemy.cur_hp + " HP left.")
wait {
show menu ("What is your battle choice?", split ("Attack;Defend;Cast;Item;Run", ";"), false) {
switch (result) {
case ("Attack") {
fourth_value = false
if (RandomChance (GetInt (enemy,"agi") - GetInt (self,"spd")) = true) {
msg (enemy.alias + "evaded your attack!")
fourth_value = true
}
else if (RandomChance (GetInt (enemy,"dex") - GetInt (self,"agi")) = true) {
msg (enemy.alias + "parried your attack!")
fourth_value = true
}
else if (RandomChance (GetInt (enemy,"agi") - GetInt (self,"dex")) = true) {
msg (enemy.alias + "blocked your attack!")
fourth_value = true
}
else if (RandomChance (GetInt (self,"dex") - GetInt (enemy,"spd")) = false) {
msg ("Your attack missed " + enemy.alias +"!")
fourth_value = true
}
else if (RandomChance (GetInt (enemy,"pr") - GetInt (self,"hc")) = true) {
msg ("Your attack got resisted by " + enemy.alias +"!")
fourth_value = true
}
else if (fourth_value = false) {
if (self.defending = true and enemy.defending = true) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * 2 * GetInt (self,"pd") / 2 + GetInt (self,"pd") * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
msg (enemy.alias + " has " + enemy.cur_hp + " HP left.")
self.defending = false
}
else if (self.defending = true and enemy.defending = false) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * 2 * GetInt (self,"pd") + GetInt (self,"pd") * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
msg (enemy.alias + " has " + enemy.cur_hp + " HP left.")
self.defending = false
}
else if (self.defending = false and enemy.defending = true) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * GetInt (self,"pd") / 2 + GetInt (self,"pd") * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
msg (enemy.alias + " has " + enemy.cur_hp + " HP left.")
}
else if (self.defending = false and enemy.defending = false) {
enemy.cur_hp = enemy.cur_hp - (crit_hit (self) * GetInt (self,"pd") + GetInt (self,"pd") * (GetInt (self,"str") - GetInt (enemy,"end")) / 100)
msg (enemy.alias + " has " + enemy.cur_hp + " HP left.")
}
}
}
case ("Defend") {
if (self.defending = false) {
self.defending = true
}
}
case ("Cast") {
self.defending = false
}
case ("Item") {
self.defending = false
}
case ("Run") {
self.defending = false
}
}
if (GetInt (enemy,"cur_hp") > 0) {
if ( RandomChance (GetInt (self,"spd") - GetInt (enemy,"spd"))= true) {
msg ("You get an extra battle turn!")
self_battle_turn (self,enemy)
}
else {
msg ("Your battle turn is over.")
}
}
else if (GetInt (enemy,"cur_hp") <= 0) {
msg (enemy.alias + " is dead.")
msg ("You have won the battle!")
enemy.defending = false
enemy.dead = true
}
}
}
]]></function>
<function name="enemy_battle_turn" parameters="self,enemy"><![CDATA[
msg (self.alias + " has " + self.cur_hp + " HP left.")
msg (enemy.alias + " has " + enemy.cur_hp + " HP left.")
result = GetRandomInt (1,3)
switch (result) {
case (1) {
sixth_value = false
if (RandomChance (GetInt (self,"agi") - GetInt (enemy,"spd")) = true) {
msg ("You have evaded the attack!")
sixth_value = true
}
else if (RandomChance (GetInt (self,"dex") - GetInt (enemy,"agi")) = true) {
msg ("You have parried the attack!")
sixth_value = true
}
else if (RandomChance (GetInt (self,"agi") - GetInt (enemy,"dex")) = true) {
msg ("You have blocked the attack!")
sixth_value = true
}
else if (RandomChance (GetInt (enemy,"dex") - GetInt (self,"spd")) = false) {
msg (enemy.alias +"'s attack missed!")
sixth_value = true
}
else if (RandomChance (GetInt (self,"pr") - GetInt (enemy,"hc")) = true) {
msg ("You resisted the attack!")
sixth_value = true
}
else if (sixth_value = false) {
if (enemy.defending = true and self.defending = true) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * 2 * GetInt (enemy,"pd") / 2 + GetInt (enemy,"pd") * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
msg (self.alias + " has " + self.cur_hp + " HP left.")
enemy.defending = false
}
else if (enemy.defending = true and self.defending = false) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * 2 * GetInt (enemy,"pd") + GetInt (enemy,"pd") * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
msg (self.alias + " has " + self.cur_hp + " HP left.")
enemy.defending = false
}
else if (enemy.defending = false and self.defending = true) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * GetInt (enemy,"pd") / 2 + GetInt (enemy,"pd") * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
msg (self.alias + " has " + self.cur_hp + " HP left.")
}
else if (enemy.defending = false and self.defending = false) {
self.cur_hp = self.cur_hp - (crit_hit (enemy) * GetInt (enemy,"pd") + GetInt (enemy,"pd") * (GetInt (enemy,"str") - GetInt (self,"end")) / 100)
msg (self.alias + " has " + self.cur_hp + " HP left.")
}
}
}
case (2) {
if (enemy.defending = false) {
msg (enemy.alias + " has choosen to defend itself.")
enemy.defending = true
}
}
case (3) {
enemy.defending = false
msg ("Cast")
}
}
if (GetInt (self,"cur_hp") > 0) {
if (RandomChance (GetInt (enemy,"spd") - GetInt (self,"spd")) = true) {
msg (enemy.alias + " gets an extra battle turn!")
wait {
enemy_battle_turn (self,enemy)
}
}
else {
msg (enemy.alias + " 's battle turn is over.")
}
}
else if (GetInt (self,"cur_hp") <= 0) {
msg (self.alias + " has died.")
msg ("GAME OVER")
finish
}
]]></function>
<function name="npc_reachable" parameters="object" type="boolean">
value = false
foreach (x,ScopeReachableNotHeld ()) {
if (x=object) {
value = true
}
}
return (value)
</function>
<function name="crit_hit" parameters="object" type="int">
if (RandomChance (GetInt (object,"luck")) = true) {
value = 2
}
else {
value = 1
}
return (value)
</function>
</asl>01. cc = character creation function
02. sa = status attributes (mainly for implementing/displaying of ' cur / max ' stats) function
03. char = character object type ("pcs", "npcs", "monsters", etc., so, not a room, item, equipment, spell, etc)
04. pc = playable character object type ("player" characters / game.povs)
05. npc = non-playable character ("people", "monsters", and etc, so not a "player" character / not a game.pov, I'm going to have a hostility system, so any npc can be friendly or hostile, instead of having an actual "monster/enemy" type set aside)
06. hp = hit points (life) stat attribute
07. mp = mana points (magic) stat attribute
08. str = strength (physical damage, carry weight / equipment requirement, etc) stat attribute
09. end = endurance (physical defense, and etc) stat attribute
10. dex = dexterity (weapon~attack skill, think of this as "if your attack connects or not, do you 'whiff' or not", so not to gete confused with hc, and etc) stat attribute
11. agi = agility (dodging/evading, and etc) stat attribute
12. spd = speed (who goes first in battle, extra battle turns, escaping from battle, and etc) stat attribute
13. hc = hit chance (think of this more as piercing their armor or not, so not to get confused with dex, and etc) stat attribute
14. pd = physical damage stat attribute
15. fp = fire damage stat attribute
16. wp = water damage stat attribute
17. ap = air damage stat attribute
18. ed = earth damage stat attribute
19. ld = light damage stat attribute
20. dd = dark damage stat attribute
21. pr = physical resistance stat attribute
22. fr = fire resistance stat attribute
23. wr = water resistance stat attribute
24. ar = air resistance stat attribute
25. er = earth resistance stat attribute
26. lr = light resistance stat attribute
27. dr = dark resistance stat attribute
28. defending = boolean (reduces damage done for that character and increases the damage done by that character, if they chosoe to attack on the next turn)
29. escaped = boolean, run from battle (not completed/implemented yet)
30. hostile = boolean, any npc can be friendly or a(n) "monster/enemy", based upon a hostility scale (0-100), but not completed
31. dead = boolean
32. crit_hit = critical hit (bonus damage based upon luck)
33. luck = luck stat attribute
34. lvl = level stat attribute
35. exp = experience stat attribute
36. cash = cash stat attribute (currency)
37. lvlup = level up function
<!--Saved by Quest 5.4.4873.16527-->
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<gridmap />
<mapscale type="int">5</mapscale>
<mapsize type="int">250</mapsize>
<start type="script">
</start>
</game>
<command name="fight_command">
<pattern>attack #object#</pattern>
<script>
fight_function (game.pov, object)
</script>
</command>
<object name="West Gates">
<inherit name="editor_room" />
<attr name="grid_width" type="int">3</attr>
<attr name="grid_fill">SlateGray</attr>
<enter type="script">
play sound ("The Legend Of Zelda Link's Awakening Music_ Mt. Tamaranch.mp3", false, true)
</enter>
<object name="player">
<inherit name="defaultplayer" />
<inherit name="character" />
<damage type="double">2.0</damage>
<statusattributes type="stringdictionary">
<item>
<key>current_hearts</key>
<value>Hearts: !</value>
</item>
<item>
<key>damage</key>
<value>Attack: !</value>
</item>
</statusattributes>
<attr name="current_hearts" type="double">4.0</attr>
<money type="double">5.0</money>
<dodge type="double">5.0</dodge>
</object>
<exit alias="west" to="west pass1">
<inherit name="westdirection" />
</exit>
</object>
<object name="West Overworld">
<inherit name="editor_room" />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<prefix>Location:(</prefix>
<suffix>)</suffix>
<attr name="grid_width" type="int">1</attr>
<attr name="grid_length" type="int">1</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<object name="west pass1">
<inherit name="editor_room" />
<attr name="grid_width" type="int">5</attr>
<attr name="grid_length" type="int">5</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<exit alias="east" to="West Gates">
<inherit name="eastdirection" />
</exit>
<exit alias="west" to="west pass2">
<inherit name="westdirection" />
</exit>
</object>
<object name="west pass2">
<inherit name="editor_room" />
<attr name="grid_width" type="int">10</attr>
<attr name="grid_length" type="int">5</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<exit alias="east" to="west pass1">
<inherit name="eastdirection" />
</exit>
<exit alias="west" to="west pass3">
<inherit name="westdirection" />
</exit>
</object>
<object name="west pass3">
<inherit name="editor_room" />
<attr name="grid_width" type="int">5</attr>
<attr name="grid_length" type="int">5</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<exit alias="east" to="west pass2">
<inherit name="eastdirection" />
</exit>
<object name="Goblin">
<inherit name="editor_object" />
<inherit name="character" />
<alias>Goblin</alias>
<damage type="double">0.5</damage>
<attr name="current_hearts" type="double">2.0</attr>
<alt type="stringlist">
<value>monster</value>
</alt>
<open type="boolean">false</open>
<close type="boolean">false</close>
<isopen type="boolean">false</isopen>
<listchildren type="boolean">false</listchildren>
<hidechildren />
<dodge type="double">1.0</dodge>
<attr name="displayverbs" type="listextend">Attack</attr>
</object>
<object name="Rupee">
<inherit name="editor_object" />
<drop type="boolean">false</drop>
<take />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<visible />
<scenery />
<use type="boolean">false</use>
<listchildren type="boolean">false</listchildren>
<money type="double">1.0</money>
</object>
</object>
</object>
<type name="character">
<dead type="boolean">false</dead>
<damage type="double">0.0</damage>
<money type="double">0.0</money>
<attr name="current_hearts" type="double">0.0</attr>
<dodge type="double">0.0</dodge>
</type>
<type name="deathdrop">
<killed type="script">
if (monster.dead = false) {
MakeObjectInvisible (Rupee)
}
else if (monster.dead = true) {
MakeObjectVisible (Rupee)
}
</killed>
</type>
<function name="fight_function" parameters="self, monster"><![CDATA[
if (monster = null) {
foreach (obj, AllObjects()) {
if (obj.alias=monster) {
monster = obj
}
else {
msg ("There's no " + monster + "in the vicinity.")
}
}
}
if (monster = null) {
msg ("There's no " + monster + "in the vicinity.")
}
else if (not Doesinherit (monster,"character")) {
msg ("You can not battle that!")
}
else if (monster.dead = true) {
msg (monster.alias + " is already dead.")
}
else {
show menu ("You enter combat with the nasty " + monster.alias +", what do you do?", split("Swing_Up;Swing_Down;Swing_Left;Swing_Right;Block",";"), false) {
switch (result) {
case ("Swing_Up") {
result = 1
}
case ("Swing_Down") {
result = 2
}
case ("Swing_Left") {
result = 3
}
case ("Swing_Right") {
result = 4
}
case ("Block") {
result = 5
}
}
value = GetRandomInt (1,5)
if (value = result) {
if (result=1) {
msg ("You Swing_Up and kill the " + monster.alias +"!")
monster.dead = true
}
else if (result=2) {
msg ("You Swing_Down and kill the " + monster.alias +"!")
monster.dead = true
}
else if (result=3) {
msg ("You Swing_Left and kill the " + monster.alias +"!")
monster.dead = true
}
else if (result=4) {
msg ("You Swing_Right and kill the " + monster.alias +"!")
monster.dead = true
}
else if (result=5) {
msg ("You Block the " + monster.alias + "'s attack!")
fight_function (self, monster)
}
}
else if (not value = result) {
if (result=5) {
msg ("You fail to block the " + monster.alias +"'s attack!")
self.current_hearts = self.current_hearts - monster.damage
msg ("The " + monster.alias + " hit you for " + monster.damage + " damage!")
if (self.current_hearts <= 0) {
msg (monster.alias + " has killed you.")
finish
}
else {
fight_function (self, monster)
}
}
else {
msg ("You miss with your attack!")
if (self.dodge > monster.dodge) {
msg ("You dodged the " + monster.alias + "'s attack.")
}
else if (self.dodge < monster.dodge) {
self.current_hearts = self.current_hearts - monster.damage
msg ("The " + monster.alias + " hit you for " + monster.damage + " damage!")
}
if (self.current_hearts <= 0) {
msg (monster.alias + " has killed you.")
finish
}
else {
fight_function (self, monster)
}
}
}
}
}
]]></function>
</asl>
<function name="fight_function" parameters="self, monster"><![CDATA[
Object_1_name.Attribute_1_name = GetRandomInt (min,max)
Object_2_name.Attribute_2_name = GetRandomInt (min,max)
if (monster = null) {
// rest of your code
<!--Saved by Quest 5.4.4873.16527-->
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<gridmap />
<mapscale type="int">5</mapscale>
<mapsize type="int">250</mapsize>
<start type="script">
</start>
</game>
<command name="fight_command">
<pattern>attack #object#</pattern>
<script>
fight_function (game.pov, object)
</script>
</command>
<object name="West Gates">
<inherit name="editor_room" />
<attr name="grid_width" type="int">3</attr>
<attr name="grid_fill">SlateGray</attr>
<enter type="script">
play sound ("The Legend Of Zelda Link's Awakening Music_ Mt. Tamaranch.mp3", false, true)
</enter>
<object name="player">
<inherit name="defaultplayer" />
<inherit name="character" />
<damage type="int">2</damage>
<statusattributes type="stringdictionary">
<item>
<key>current_hearts</key>
<value>Hearts: !</value>
</item>
<item>
<key>damage</key>
<value>Attack: !</value>
</item>
</statusattributes>
<attr name="current_hearts" type="int">4</attr>
<money type="int">5</money>
<dodge type="int">4</dodge>
</object>
<exit alias="west" to="west pass1">
<inherit name="westdirection" />
</exit>
</object>
<object name="West Overworld">
<inherit name="editor_room" />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<prefix>Location:(</prefix>
<suffix>)</suffix>
<attr name="grid_width" type="int">1</attr>
<attr name="grid_length" type="int">1</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<object name="west pass1">
<inherit name="editor_room" />
<attr name="grid_width" type="int">5</attr>
<attr name="grid_length" type="int">5</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<exit alias="east" to="West Gates">
<inherit name="eastdirection" />
</exit>
<exit alias="west" to="west pass2">
<inherit name="westdirection" />
</exit>
</object>
<object name="west pass2">
<inherit name="editor_room" />
<attr name="grid_width" type="int">10</attr>
<attr name="grid_length" type="int">5</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<exit alias="east" to="west pass1">
<inherit name="eastdirection" />
</exit>
<exit alias="west" to="west pass3">
<inherit name="westdirection" />
</exit>
</object>
<object name="west pass3">
<inherit name="editor_room" />
<attr name="grid_width" type="int">5</attr>
<attr name="grid_length" type="int">5</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<exit alias="east" to="west pass2">
<inherit name="eastdirection" />
</exit>
<object name="Goblin">
<inherit name="editor_object" />
<inherit name="character" />
<alias>Goblin</alias>
<damage type="double">0.5</damage>
<attr name="current_hearts" type="int">2</attr>
<alt type="stringlist">
<value>monster</value>
</alt>
<open type="boolean">false</open>
<close type="boolean">false</close>
<isopen type="boolean">false</isopen>
<listchildren type="boolean">false</listchildren>
<hidechildren />
<dodge type="int">1</dodge>
<object name="Rupee">
<inherit name="editor_object" />
<drop type="boolean">false</drop>
<take />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<visible type="boolean">false</visible>
<scenery />
<use type="boolean">false</use>
<listchildren type="boolean">false</listchildren>
<money type="int">1</money>
</object>
</object>
</object>
</object>
<type name="character">
<dead type="boolean">false</dead>
<damage type="double">0</damage>
<money type="int">0</money>
<attr name="current_hearts" type="int">0</attr>
<dodge type="int">0</dodge>
</type>
<function name="fight_function" parameters="self, monster"><![CDATA[
if (monster = null) {
foreach (obj, AllObjects()) {
if (obj.alias=monster) {
monster = obj
}
else {
msg ("There's no " + monster + "in the vicinity.")
}
}
}
else if (not Doesinherit (monster,"character")) {
msg ("You can not battle that!")
}
else if (monster.dead = true) {
msg (monster.alias + " is already dead.")
}
else {
show menu ("You enter combat with the nasty " + monster.alias +", what do you do?", split("Swing_Up;Swing_Down;Swing_Left;Swing_Right;Block",";"), false) {
switch (result) {
case ("Swing_Up") {
result = 1
}
case ("Swing_Down") {
result = 2
}
case ("Swing_Left") {
result = 3
}
case ("Swing_Right") {
result = 4
}
case ("Block") {
result = 5
}
}
value = GetRandomInt (1,5)
if (value = result) {
if (result=1) {
msg ("You Swing_Up and kill the " + monster.alias +"!")
monster.dead = true
}
else if (result=2) {
msg ("You Swing_Down and kill the " + monster.alias +"!")
monster.dead = true
}
else if (result=3) {
msg ("You Swing_Left and kill the " + monster.alias +"!")
monster.dead = true
}
else if (result=4) {
msg ("You Swing_Right and kill the " + monster.alias +"!")
monster.dead = true
}
else if (result=5) {
msg ("You Block the " + monster.alias +"'s attack!")
fight_function (self, monster)
}
else if (monster.damage>self.dodge) {
msg ("You hit the monster.")
monster.current_hearts = monster.current_hearts - self.damage
if (monster.current_hearts <=0) {
monster.dead = true
msg ("The monster turns into a puff of smoke. ")
}
}
else if (monster.damage<self.dodge) {
msg ("The monster missed.")
}
}
else if (result=5) {
msg ("You fail to block the " + monster.alias +"'s attack!")
self.current_hearts = self.current_hearts - monster.damage
msg ("The " + monster.alias + " hit you for " + monster.damage + " damage!")
if (self.current_hearts <= 0) {
msg (monster.alias + " has killed you.")
finish
}
else {
fight_function (self, monster)
}
}
else {
msg ("You miss with your attack!")
if (self.dodge>monster.damage) {
msg ("You dodged the " +monster.alias+ "'s attack.")
self.current_hearts = self.current_hearts
}
else if (self.dodge<monster.damage) {
self.current_hearts = self.current_hearts - monster.damage
msg ("The " + monster.alias + " hit you for " + monster.damage + " damage!")
}
if (self.current_hearts <= 0) {
msg (monster.alias + " has killed you.")
finish
}
else {
fight_function (self, monster)
}
}
}
}
]]></function>
</asl>
<function name="fight_function" parameters="self, monster"><![CDATA[
self.Attribute_1_name = GetRandomInt (min,max)
monster.Attribute_2_name = GetRandomInt (min,max)
if (monster = null) {
// rest of your code
<!--Saved by Quest 5.4.4873.16527-->
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<gridmap />
<mapscale type="int">5</mapscale>
<mapsize type="int">250</mapsize>
<start type="script">
</start>
</game>
<command name="fight_command">
<pattern>attack #object#</pattern>
<script>
fight_function (game.pov, object)
</script>
</command>
<object name="West Gates">
<inherit name="editor_room" />
<attr name="grid_width" type="int">3</attr>
<attr name="grid_fill">SlateGray</attr>
<enter type="script">
play sound ("The Legend Of Zelda Link's Awakening Music_ Mt. Tamaranch.mp3", false, true)
</enter>
<object name="player">
<inherit name="defaultplayer" />
<inherit name="character" />
<damage type="int">3</damage>
<statusattributes type="stringdictionary">
<item>
<key>current_hearts</key>
<value>Hearts: !</value>
</item>
<item>
<key>damage</key>
<value>Attack: !</value>
</item>
</statusattributes>
<attr name="current_hearts" type="int">4</attr>
<money type="int">5</money>
<dodge type="int">2</dodge>
</object>
<exit alias="west" to="west pass1">
<inherit name="westdirection" />
</exit>
</object>
<object name="West Overworld">
<inherit name="editor_room" />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<prefix>Location:(</prefix>
<suffix>)</suffix>
<attr name="grid_width" type="int">1</attr>
<attr name="grid_length" type="int">1</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<object name="west pass1">
<inherit name="editor_room" />
<attr name="grid_width" type="int">5</attr>
<attr name="grid_length" type="int">5</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<exit alias="east" to="West Gates">
<inherit name="eastdirection" />
</exit>
<exit alias="west" to="west pass2">
<inherit name="westdirection" />
</exit>
</object>
<object name="west pass2">
<inherit name="editor_room" />
<attr name="grid_width" type="int">10</attr>
<attr name="grid_length" type="int">5</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<exit alias="east" to="west pass1">
<inherit name="eastdirection" />
</exit>
<exit alias="west" to="west pass3">
<inherit name="westdirection" />
</exit>
</object>
<object name="west pass3">
<inherit name="editor_room" />
<attr name="grid_width" type="int">5</attr>
<attr name="grid_length" type="int">5</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<exit alias="east" to="west pass2">
<inherit name="eastdirection" />
</exit>
<object name="Goblin">
<inherit name="editor_object" />
<inherit name="character" />
<alias>Goblin</alias>
<damage type="double">1</damage>
<attr name="current_hearts" type="int">10</attr>
<alt type="stringlist">
<value>monster</value>
</alt>
<open type="boolean">false</open>
<close type="boolean">false</close>
<isopen type="boolean">false</isopen>
<listchildren type="boolean">false</listchildren>
<hidechildren />
<dodge type="int">12</dodge>
<object name="Rupee">
<inherit name="editor_object" />
<drop type="boolean">false</drop>
<take />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<visible type="boolean">false</visible>
<scenery />
<use type="boolean">false</use>
<listchildren type="boolean">false</listchildren>
<money type="int">1</money>
</object>
</object>
</object>
</object>
<type name="character">
<dead type="boolean">false</dead>
<damage type="double">0</damage>
<money type="int">0</money>
<attr name="current_hearts" type="int">0</attr>
<dodge type="int">0</dodge>
</type>
<function name="fight_function" parameters="self, monster"><![CDATA[
if (monster = null) {
foreach (obj, AllObjects()) {
if (obj.alias=monster) {
monster = obj
}
else {
msg ("There's no " + monster + "in the vicinity.")
}
}
}
else if (not Doesinherit (monster,"character")) {
msg ("You can not battle that!")
}
else if (monster.dead = true) {
msg (monster.alias + " is already dead.")
}
else {
show menu ("You enter combat with the nasty " + monster.alias +", what do you do?", split("Swing_Up;Swing_Down;Swing_Left;Swing_Right;Block",";"), false) {
switch (result) {
case ("Swing_Up") {
result = 1
}
case ("Swing_Down") {
result = 2
}
case ("Swing_Left") {
result = 3
}
case ("Swing_Right") {
result = 4
}
case ("Block") {
result = 5
}
}
value = GetRandomInt (1,5)
if (value = result) {
if (result=1) {
if (monster.damage>self.dodge) {
msg ("You Swing_Up and hit the monster.")
monster.current_hearts = monster.current_hearts - self.damage
if (monster.current_hearts <=0) {
monster.dead = true
msg ("The monster turns into a puff of smoke. ")
}
}
}
else if (result=2) {
if (monster.damage>self.dodge) {
msg ("You Swing_Down and hit the monster.")
monster.current_hearts = monster.current_hearts - self.damage
if (monster.current_hearts <=0) {
monster.dead = true
msg ("The monster turns into a puff of smoke. ")
}
}
}
else if (result=3) {
if (monster.damage>self.dodge) {
msg ("You Swing_Left and hit the monster.")
monster.current_hearts = monster.current_hearts - self.damage
if (monster.current_hearts <=0) {
monster.dead = true
msg ("The monster turns into a puff of smoke. ")
}
}
}
else if (result=4) {
if (monster.damage>self.dodge) {
msg ("You Swing_Right and hit the monster.")
monster.current_hearts = monster.current_hearts - self.damage
if (monster.current_hearts <=0) {
monster.dead = true
msg ("The monster turns into a puff of smoke. ")
}
}
}
else if (result=5) {
msg ("You Block the " + monster.alias +"'s attack!")
fight_function (self, monster)
}
else if (monster.damage<self.dodge) {
msg ("The monster missed.")
}
}
else if (result=5) {
msg ("You fail to block the " + monster.alias +"'s attack!")
self.current_hearts = self.current_hearts - monster.damage
msg ("The " + monster.alias + " hit you for " + monster.damage + " damage!")
if (self.current_hearts <= 0) {
msg (monster.alias + " has killed you.")
finish
}
else {
fight_function (self, monster)
}
}
else {
msg ("You miss with your attack!")
if (self.dodge>monster.damage) {
msg ("You dodged the " +monster.alias+ "'s attack.")
self.current_hearts = self.current_hearts
}
else if (self.dodge<monster.damage) {
self.current_hearts = self.current_hearts - monster.damage
msg ("The " + monster.alias + " hit you for " + monster.damage + " damage!")
}
if (self.current_hearts <= 0) {
msg (monster.alias + " has killed you.")
finish
}
else {
fight_function (self, monster)
}
}
}
}
]]></function>
</asl>
<!--Saved by Quest 5.4.4873.16527-->
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<gridmap />
<mapscale type="int">5</mapscale>
<mapsize type="int">250</mapsize>
<start type="script">
</start>
</game>
<command name="fight_command">
<pattern>attack #object#</pattern>
<script>
fight_function (game.pov, object)
</script>
</command>
<object name="West Gates">
<inherit name="editor_room" />
<attr name="grid_width" type="int">3</attr>
<attr name="grid_fill">SlateGray</attr>
<enter type="script">
play sound ("The Legend Of Zelda Link's Awakening Music_ Mt. Tamaranch.mp3", false, true)
</enter>
<object name="player">
<inherit name="defaultplayer" />
<inherit name="character" />
<damage type="int">3</damage>
<statusattributes type="stringdictionary">
<item>
<key>current_hearts</key>
<value>Hearts: !</value>
</item>
<item>
<key>damage</key>
<value>Attack: !</value>
</item>
</statusattributes>
<attr name="current_hearts" type="int">4</attr>
<money type="int">5</money>
</object>
<exit alias="west" to="west pass1">
<inherit name="westdirection" />
</exit>
</object>
<object name="West Overworld">
<inherit name="editor_room" />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<prefix>Location:(</prefix>
<suffix>)</suffix>
<attr name="grid_width" type="int">1</attr>
<attr name="grid_length" type="int">1</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<object name="west pass1">
<inherit name="editor_room" />
<attr name="grid_width" type="int">5</attr>
<attr name="grid_length" type="int">5</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<exit alias="east" to="West Gates">
<inherit name="eastdirection" />
</exit>
<exit alias="west" to="west pass2">
<inherit name="westdirection" />
</exit>
</object>
<object name="west pass2">
<inherit name="editor_room" />
<attr name="grid_width" type="int">10</attr>
<attr name="grid_length" type="int">5</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<exit alias="east" to="west pass1">
<inherit name="eastdirection" />
</exit>
<exit alias="west" to="west pass3">
<inherit name="westdirection" />
</exit>
</object>
<object name="west pass3">
<inherit name="editor_room" />
<attr name="grid_width" type="int">5</attr>
<attr name="grid_length" type="int">5</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<exit alias="east" to="west pass2">
<inherit name="eastdirection" />
</exit>
<object name="Goblin">
<inherit name="editor_object" />
<inherit name="character" />
<alias>Goblin</alias>
<damage type="double">0.5</damage>
<attr name="current_hearts" type="int">10</attr>
<alt type="stringlist">
<value>monster</value>
</alt>
<open type="boolean">false</open>
<close type="boolean">false</close>
<isopen type="boolean">false</isopen>
<listchildren type="boolean">false</listchildren>
<hidechildren />
<dodge type="int">1</dodge>
<object name="Rupee">
<inherit name="editor_object" />
<drop type="boolean">false</drop>
<take />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<visible type="boolean">false</visible>
<scenery />
<use type="boolean">false</use>
<listchildren type="boolean">false</listchildren>
<money type="int">1</money>
</object>
</object>
</object>
</object>
<type name="character">
<dead type="boolean">false</dead>
<damage type="double">0</damage>
<money type="int">0</money>
<attr name="current_hearts" type="int">0</attr>
<dodge type="int">0</dodge>
</type>
<function name="fight_function" parameters="self, monster"><![CDATA[
if (monster = null) {
foreach (obj, AllObjects()) {
if (obj.alias=monster) {
monster = obj
}
else {
msg ("There's no " + monster + "in the vicinity.")
}
}
}
else if (not Doesinherit (monster,"character")) {
msg ("You can not battle that!")
}
else if (monster.dead = true) {
msg (monster.alias + " is already dead.")
}
else {
show menu ("You enter combat with the nasty " + monster.alias +", what do you do?", split("Swing_Up;Swing_Down;Swing_Left;Swing_Right;Block",";"), false) {
switch (result) {
case ("Swing_Up") {
result = 1
}
case ("Swing_Down") {
result = 2
}
case ("Swing_Left") {
result = 3
}
case ("Swing_Right") {
result = 4
}
case ("Block") {
result = 5
}
}
value = GetRandomInt (1,5)
if (value = result) {
if (result=1) {
if (monster.damage>self.dodge) {
msg ("You Swing_Up and hit the monster.")
monster.current_hearts = monster.current_hearts - self.damage
if (monster.current_hearts <=0) {
monster.dead = true
msg ("The monster turns into a puff of smoke. ")
}
}
}
else if (result=2) {
if (monster.damage>self.dodge) {
msg ("You Swing_Down and hit the monster.")
monster.current_hearts = monster.current_hearts - self.damage
if (monster.current_hearts <=0) {
monster.dead = true
msg ("The monster turns into a puff of smoke. ")
}
}
}
else if (result=3) {
if (monster.damage>self.dodge) {
msg ("You Swing_Left and hit the monster.")
monster.current_hearts = monster.current_hearts - self.damage
if (monster.current_hearts <=0) {
monster.dead = true
msg ("The monster turns into a puff of smoke. ")
}
}
}
else if (result=4) {
if (monster.damage>self.dodge) {
msg ("You Swing_Right and hit the monster.")
monster.current_hearts = monster.current_hearts - self.damage
if (monster.current_hearts <=0) {
monster.dead = true
msg ("The monster turns into a puff of smoke. ")
}
}
}
else if (result=5) {
msg ("You Block the " + monster.alias +"'s attack!")
fight_function (self, monster)
}
else if (monster.damage<self.dodge) {
msg ("The monster missed.")
}
}
else if (result=5) {
msg ("You fail to block the " + monster.alias +"'s attack!")
self.current_hearts = self.current_hearts - monster.damage
msg ("The " + monster.alias + " hit you for " + monster.damage + " damage!")
if (self.current_hearts <= 0) {
msg (monster.alias + " has killed you.")
finish
}
else {
fight_function (self, monster)
}
}
else {
msg ("You miss with your attack!")
if (self.dodge>monster.damage) {
msg ("You dodged the " +monster.alias+ "'s attack.")
self.current_hearts = self.current_hearts
}
else if (self.dodge<monster.damage) {
self.current_hearts = self.current_hearts - monster.damage
msg ("The " + monster.alias + " hit you for " + monster.damage + " damage!")
}
if (self.current_hearts <= 0) {
msg (monster.alias + " has killed you.")
finish
}
else {
fight_function (self, monster)
}
}
}
}
]]></function>
</asl>
omega wrote:So now i need to make sure that the player has a random interval (1,10)
to get 3 or > to hit.
<!--Saved by Quest 5.4.4873.16527-->
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<start type="script">
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="defaultplayer" />
<inherit name="character_type" />
<attr name="current_health" type="int">20</attr>
<statusattributes type="stringdictionary">
<item>
<key>current_health</key>
<value>HP: !</value>
</item>
</statusattributes>
<dodge type="int">5</dodge>
<attr name="physical_damage" type="int">5</attr>
<block type="int">5</block>
</object>
<object name="monster_1">
<inherit name="editor_object" />
<inherit name="character_type" />
<alias>orc</alias>
<attr name="physical_damage" type="int">1</attr>
<dodge type="int">1</dodge>
<block type="int">1</block>
<attr name="current_health" type="int">20</attr>
</object>
</object>
<command name="fight_command">
<pattern>attack #object#</pattern>
<script>
fight_function (game.pov, object)
</script>
</command>
<type name="character_type">
<dead type="boolean">false</dead>
<attr name="current_health" type="int">0</attr>
<attr name="physical_damage" type="int">0</attr>
<dodge type="int">0</dodge>
<block type="int">0</block>
</type>
<function name="fight_function" parameters="self, monster"><![CDATA[
if (monster = null) {
foreach (obj, AllObjects()) {
if (obj.alias=monster) {
monster = obj
}
else {
msg ("There's no " + monster + "in the vicinity.")
}
}
}
else if (not Doesinherit (monster,"character_type")) {
msg ("You can not battle that!")
}
else if (monster.dead = true) {
msg (monster.alias + " is already dead.")
}
else {
show menu ("The monster attacks, what do you do?", split("Swing Sword;Block",";"), false) {
if (result= "Swing Sword") {
if (monster.dodge<self.physical_damage) {
msg ("You swing your sword and hit the " + monster.alias +"!")
monster.current_health = monster.current_health - self.physical_damage
if (monster.current_health <=0) {
msg ("The monster dies in a puff of smoke.")
monster.dead = true
}
else {
fight_function (self, monster)
}
}
else if (monster.dodge>self.physical_damage) {
msg ("You swing but miss the target.")
msg ("The monster attacks you.")
if (monster.physical_damage>self.dodge) {
self.current_health = self.current_health - monster.physical_damage
msg ("You get hit.")
if (self.current_health <=0) {
msg ("You died.....")
finish
}
else {
fight_function (self, monster)
}
}
else if (monster.physical_damage<self.dodge) {
msg ("The monster missed your attack. ")
}
else {
fight_function (self, monster)
}
}
}
else if (result= "Block") {
if (monster.physical_damage<self.block) {
msg ("You Block the " + monster.alias +"'s attack!")
fight_function (self, monster)
}
else if (monster.physical_damage>self.block) {
msg ("You failed to block the monsters attack. ")
self.current_health = self.current_health - monster.physical_damage
msg ("You take " +monster.physical_damage+ " of damage.")
if (self.current_health <=0) {
msg ("You died...")
finish
}
else {
fight_function (self, monster)
}
}
}
}
}
]]></function>
</asl>
<!--Saved by Quest 5.4.4873.16527-->
<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<version>1.0</version>
<gridmap />
<mapscale type="int">5</mapscale>
<mapsize type="int">250</mapsize>
<difficulty>Medium</difficulty>
<cruelty>Polite</cruelty>
<start type="script">
</start>
</game>
<command name="fight_command">
<pattern>attack #object#</pattern>
<script>
fight_function (game.pov, object)
</script>
</command>
<object name="West Gates">
<inherit name="editor_room" />
<attr name="grid_width" type="int">3</attr>
<attr name="grid_fill">SlateGray</attr>
<enter type="script">
play sound ("The Legend Of Zelda Link's Awakening Music_ Mt. Tamaranch.mp3", false, true)
</enter>
<object name="player">
<inherit name="defaultplayer" />
<inherit name="character" />
<inherit name="money" />
<damage type="int">3</damage>
<statusattributes type="stringdictionary">
<item>
<key>current_hearts</key>
<value>Hearts: !</value>
</item>
<item>
<key>damage</key>
<value>Attack: !</value>
</item>
<item>
<key>rupee</key>
<value>Rupees: !</value>
</item>
</statusattributes>
<attr name="current_hearts" type="int">4</attr>
<rupee type="int">15</rupee>
</object>
<exit alias="west" to="west pass1">
<inherit name="westdirection" />
</exit>
</object>
<object name="West Overworld">
<inherit name="editor_room" />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<prefix>Location:(</prefix>
<suffix>)</suffix>
<attr name="grid_width" type="int">1</attr>
<attr name="grid_length" type="int">1</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<object name="west pass1">
<inherit name="editor_room" />
<attr name="grid_width" type="int">5</attr>
<attr name="grid_length" type="int">5</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<exit alias="east" to="West Gates">
<inherit name="eastdirection" />
</exit>
<exit alias="west" to="west pass2">
<inherit name="westdirection" />
</exit>
</object>
<object name="west pass2">
<inherit name="editor_room" />
<attr name="grid_width" type="int">10</attr>
<attr name="grid_length" type="int">5</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<exit alias="east" to="west pass1">
<inherit name="eastdirection" />
</exit>
<exit alias="west" to="west pass3">
<inherit name="westdirection" />
</exit>
</object>
<object name="west pass3">
<inherit name="editor_room" />
<attr name="grid_width" type="int">5</attr>
<attr name="grid_length" type="int">5</attr>
<attr name="grid_fill">MediumSpringGreen</attr>
<exit alias="east" to="west pass2">
<inherit name="eastdirection" />
</exit>
<object name="Goblin">
<inherit name="editor_object" />
<inherit name="character" />
<inherit name="money" />
<alias>Goblin</alias>
<damage type="double">0.5</damage>
<attr name="current_hearts" type="int">2</attr>
<alt type="stringlist">
<value>monster</value>
</alt>
<open type="boolean">false</open>
<close type="boolean">false</close>
<isopen type="boolean">false</isopen>
<listchildren type="boolean">false</listchildren>
<hidechildren />
<dodge type="int">1</dodge>
<rupee type="int">4</rupee>
<spawn type="int">1</spawn>
<object name="Rupee">
<inherit name="editor_object" />
<drop type="boolean">false</drop>
<take />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<scenery type="boolean">false</scenery>
<ontake type="script">
player.rupee = player.rupee+Goblin.rupee
MakeObjectInvisible (Rupee)
</ontake>
</object>
</object>
</object>
</object>
<type name="character">
<dead type="boolean">false</dead>
<damage type="double">0</damage>
<attr name="current_hearts" type="int">0</attr>
<dodge type="int">0</dodge>
<block type="int">0</block>
<spawn type="int">0</spawn>
</type>
<type name="money">
<rupee type="int">0</rupee>
</type>
<function name="DoDrop" parameters="object, ismultiple"><![CDATA[
prefix = ""
if (ismultiple) {
prefix = GetDisplayAlias(object) + ": "
}
if (not ListContains(ScopeInventory(), object)) {
msg (prefix + DynamicTemplate("NotCarrying", object))
}
else if (not ListContains(ScopeReachable(), object)) {
msg (prefix + DynamicTemplate("ObjectNotOpen", GetBlockingObject(object)))
}
else {
found = true
dropmsg = object.dropmsg
switch (TypeOf(object, "drop")) {
case ("script") {
if (ismultiple) {
msg (prefix)
}
do (object, "drop")
dropmsg = ""
}
case ("boolean") {
if (object.drop = true) {
object.parent = game.pov.parent
if (dropmsg = null) {
dropmsg = DynamicTemplate("DropSuccessful", object)
}
}
else {
found = false
}
}
case ("string") {
object.parent = game.pov.parent
dropmsg = object.drop
}
default {
found = false
}
}
if (not found and dropmsg = null) {
dropmsg = DynamicTemplate("DropUnsuccessful", object)
}
if (LengthOf(dropmsg) > 0) {
msg (prefix + dropmsg)
}
if (HasScript(object, "ondrop")) {
do (object, "ondrop")
}
}
]]></function>
<function name="fight_function" parameters="self, monster"><![CDATA[
player.dodge = GetRandomInt(1,10)
if (monster = null) {
foreach (obj, AllObjects()) {
if (obj.alias=monster) {
monster = obj
}
else {
msg ("There's no " + monster + "in the vicinity.")
}
}
}
else if (not Doesinherit (monster,"character")) {
msg ("You can not battle that!")
}
else if (monster.dead = true) {
msg (monster.alias + " is already dead.")
}
else {
show menu ("The monster attacks, what do you do?", split("Swing Sword;Block",";"), false) {
if (result= "Swing Sword") {
if (monster.dodge<self.damage) {
msg ("You swing your sword and hit the " + monster.alias +"!")
monster.current_hearts = monster.current_hearts - self.damage
if (monster.current_hearts <=0) {
msg ("The monster dies in a puff of smoke.")
monster.dead = true
Rupee.drop = true
if (Rupee.drop = true) {
msg ("Monster dropped a rupee.")
MoveObject (Rupee, west pass3)
}
}
else {
fight_function (self, monster)
}
}
else if (monster.dodge>self.damage) {
msg ("You swing but miss the target.")
msg ("The monster attacks you.")
if (monster.damage>self.dodge) {
self.current_hearts = self.current_hearts - monster.damage
msg ("You get hit.")
if (self.current_hearts <=0) {
msg ("You died.....")
finish
}
else {
fight_function (self, monster)
}
}
else if (monster.damage<self.dodge) {
msg ("The monster missed your attack. ")
fight_function (self, monster)
}
else {
fight_function (self, monster)
}
}
}
else if (result= "Block") {
if (monster.damage<self.block) {
msg ("You Block the " + monster.alias +"'s attack!")
fight_function (self, monster)
}
else if (monster.damage>self.block) {
msg ("You failed to block the monsters attack. ")
self.current_hearts = self.current_hearts - monster.damage
msg ("You take " +monster.damage+ " of damage.")
if (self.current_hearts <=0) {
msg ("You died...")
finish
}
else {
fight_function (self, monster)
}
}
}
}
MakeObjectInvisible (monster)
EnableTimer (monster spawn)
}
]]></function>
<timer name="monster spawn">
<interval>10</interval>
<enabled />
<script>
if (monster.visible=false and monster.dead=true) {
monster.visible = true
monster.dead = false
}
</script>
</timer>
</asl>
msg ("The monster dies in a puff of smoke.")
monster.dead = true
Rupee.drop = true
if (Rupee.drop = true) {
msg ("Monster dropped a rupee.")
MoveObject (Rupee, west pass3)
}
enemy = GetObject (text)
if (enemy = null) {
foreach (obj,AllObjects()) {
if (obj.alias=text) {
enemy = obj
}
}
}
if (enemy = null) {
msg ("There is no " + text + " here.")
}omega wrote:Yet, i came across a problem where this might not be needed. Basically i copied and pasted the same monster (obviously getting a 1 added to the name like: Goblin1)
and now when i run the game i came, killed the first goblin made. moved down to a different room and found another goblin.
typed in attack, killed it. BUT
this time it came with an error because it's a different monster type. (which is stupid).
<object name="goblin_1">
<inherit name="editor_object" />
<alias>goblin</alias>
<attr name="dead" type="boolean">false</attr>
<attr name="displayverbs" type="listextend">fight;loot</attr>
<attr name="loot" type="script">
if (this.dead=true) {
firsttime {
this.rupee_1.parent = player
} otherwise {
msg ("You already looted this corpse, silly.")
} else if (this.dead=false) {
msg ("it's still alive, idiot!")
msg ("As you try to loot, err steal, his rupee, the goblin cuts off your head.")
msg ("GAME OVER")
finish
}
</attr>
<attr name="fight" type="script">
if (this.dead=true) {
msg ("It's already dead, why do you want to fight its corpse?")
} else if (this.dead=false) {
this.dead=true
msg ("You attack the goblin, killing it")
}
</attr>
<object name="rupee_1">
<inherit name="editor_object" />
<alias>green rupee</alias>
</object>
</object>
<object name="goblin_2">
<inherit name="editor_object" />
<alias>goblin</alias>
<attr name="dead" type="boolean">false</attr>
<attr name="displayverbs" type="listextend">fight;loot</attr>
<attr name="loot" type="script">
if (this.dead=true) {
firsttime {
this.rupee_2.parent = player
} otherwise {
msg ("You already looted this corpse, silly.")
} else if (this.dead=false) {
msg ("it's still alive, idiot!")
msg ("As you try to loot, err steal, his rupee, the goblin cuts off your head.")
msg ("GAME OVER")
finish
}
</attr>
<attr name="fight" type="script">
if (this.dead=true) {
msg ("It's already dead, why do you want to fight its corpse?")
} else if (this.dead=false) {
this.dead=true
msg ("You attack the goblin, killing it")
}
</attr>
<object name="rupee_2">
<inherit name="editor_object" />
<alias>green rupee</alias>
</object>
</object><command name="fight">
<pattern>fight #text#</pattern>
<script>
battle_system (game.pov,text)
</script>
</command>
<function name="battle_system" parameters="self,text">
enemy = GetObject (text)
if (enemy = null) {
foreach (obj,AllObjects()) {
if (obj.alias=text) {
enemy = obj
}
}
}
if (enemy = null) {
msg ("There is no " + text + " here.")
}
else if (not Doesinherit (enemy,"npc")) {
msg ("You can not battle that!")
}
else if (not npc_reachable (enemy)) {
msg ("There is no " + enemy.alias + " in your vicinity.")
}
else if (GetBoolean (enemy,"dead") = true) {
msg (enemy.alias + " is already dead.")
}
else if (GetBoolean (enemy,"hostile") = false) {
msg (enemy.alias + " is not hostile.")
}
else {
battle_sequence (self,enemy)
}
</function>