Help with Gemsthrone, the RPG

Monkey Prodigy
I am somewhat new to Quest, so I am still in that stage between learning and knowing. In Gemsthrone, the RPG you play as a player who follows a storyline whilst upgrading weapons and stats, exploring the land, making money from mining et cetera.

I need a combat system to use for the character, as I've been stuck on this for a while. In Gemsthrone, you can pick your character's name, race, and class. I need to make it to where it actually affects the gameplay, such as stat growth when you level up. At the beginning of the game, it creates variables called:

player.health
Your health. I can think of a bug that when you increase this by sleeping etc, it will keep going up without a max, how do I fix this? Also, I'd like to make it to where you can only save by sleeping on a bed. How do I do this?
player.strength
Pretty obvious.
player.magic
Not sure, as the magic spells will all have a set amount of mana intake and damage. Any idea's?
player.defense
When a monster attacks, this will subtract damage equal to your defense. But I can forsee a moment when a monster with a low attack attacks you, and does negative damage. . . Or doesn't do damage. How do I make it that no matter your defense, the monster will always do a small amount of damage?
player.mana
This is a gauge, like a mana pool, or energy.
player.money
You can buy stuff with this. I'd like to make it that if you go out into a mine, you will have a random chance to encounter monsters, who can drop stuff. When they drop stuff, they need to always drop a certain item, such as a Skeleton will always drop a bone, but can drop other stuff, like old armor that is wearing ( which will subtract damage along with its defense ),
just like the player. So then you progress further in the mine, you can come across gems and ore, which, if you have a pickaxe, you can mine it, and then bring it to a blacksmith, and make armor or weapons, or upgrade pre-existing ones.
player.exp
When you kill a monster, you get a certain amount of EXP, depending on the monster, and it's level. A manticore with a level of one will give 550 EXP, where is a level 50 bat will give 400 EXP. See what I mean?
player.level
When you level up, your stats ugrade. How do make it that if you are a elf, or a mage, that your magic increases more than it would with a rogue class? And that dwarven characters don't get it at all?

And when you equip a weapon, you can dual wield certain weapons, how would that work? And when you go to a Elven City, or a high-ranking Blacksmith, you can imbue weapons with ceratin abilities, like a vampiric drain that restores your health equivalent to the damage you inflicted? Or a fiery one, which does damage over turns?

Thanks in advance

HegemonKhan
(if it's okay with omega, you can join us, as we're working together to make more progress on rpg aspects and eventually full games... lol)

(I'm trying to develop more code for RPG aspects like those seen in TES games: arena, daggerfall, morrowind, oblivion, skyrim)

(omega is kinda making a game with some RPG aspects like the Fallout games)

--------

this is asking a lot, laughs. A full combat+game system, is a massive amount of coding and design, lol. I'm working on a combat system still myelf, Omega too is working on one, and there's probably some others too.

I'll provide you some links that you can look at and use, and answer invidivudal questions and provide help, but you're going have to work on this stuff yourself, as everyone is pretty busy doing their own games and~or learning to code~make games with quest.

-------------

my old combat code (Credit to Pertex for help and the code structure, as I'm using his combat code structure):

<asl version="530">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<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="stringdictionary">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="stringdictionary">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="list">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" type="boolean">
first_value = false
enemy = GetObject (text)
if (enemy = null) {
foreach (obj,AllObjects()) {
if (obj.alias=text) {
enemy = obj
}
}
}
if (enemy = null) {
msg ("There is no " + text + " here.")
first_value = false
}
else if (not Doesinherit (enemy,"npc")) {
msg ("You can not battle that!")
first_value = false
}
else if (not npc_reachable (enemy)) {
msg ("There is no " + enemy.alias + " in your vicinity.")
first_value = false
}
else if (GetBoolean (enemy,"dead") = true) {
msg (enemy.alias + " is already dead.")
first_value = false
}
else if (GetBoolean (enemy,"hostile") = false) {
msg (enemy.alias + " is not hostile.")
first_value = false
}
else if (battle_sequence (self,enemy) = true) {
msg ("The battle is over.")
first_value = true
}
return (first_value)
</function>
<function name="battle_sequence" parameters="self,enemy" type="boolean"><![CDATA[
second_value = false
if (enemy.dead = false) {
if (GetInt (self,"spd") > GetInt (enemy,"spd")) {
on ready {
msg ("You get to go first for this round")
if (self_battle_turn (self,enemy) = true) {
battle_sequence (self,enemy)
}
}
on ready {
if (enemy.dead = false) {
if (enemy_battle_turn (self,enemy) = true) {
msg ("The round has ended.")
}
}
}
on ready {
battle_sequence (self,enemy)
}
}
else if (GetInt (self,"spd") < GetInt (enemy,"spd")) {
on ready {
msg (enemy.alias + " gets to go first for this round.")
if (enemy_battle_turn (self,enemy) = true) {
msg ("It is now your turn.")
}
}
on ready {
if (self_battle_turn (self,enemy) = true) {
battle_sequence (self,enemy)
}
else {
msg ("The round has ended.")
}
}
on ready {
battle_sequence (self,enemy)
}
}
else if (GetInt (self,"spd") = GetInt (enemy,"spd")) {
if (RandomChance (50) = true) {
on ready {
msg ("You get to go first for this round")
if (self_battle_turn (self,enemy) = true) {
battle_sequence (self,enemy)
}
}
on ready {
if (enemy_battle_turn (self,enemy) = true) {
msg ("The round has ended.")
}
}
on ready {
battle_sequence (self,enemy)
}
}
else {
on ready {
msg (enemy.alias + " gets to go first for this round.")
if (enemy_battle_turn (self,enemy) = true) {
msg ("It is now your turn.")
}
}
on ready {
if (self_battle_turn (self,enemy) = true) {
battle_sequence (self,enemy)
}
else {
msg ("The round has ended.")
}
}
on ready {
battle_sequence (self,enemy)
}
}
}
}
else {
second_value = true
}
return (second_value)
]]></function>
<function name="self_battle_turn" parameters="self,enemy" type="boolean"><![CDATA[
third_value = false
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.")
third_value = false
}
}
else if (GetInt (enemy,"cur_hp") <= 0) {
msg (enemy.alias + " is dead.")
msg ("You have won the battle!")
enemy.defending = false
enemy.dead = true
third_value = true
wait {
ClearScreen
}
}
}
}
return (third_value)
]]></function>
<function name="enemy_battle_turn" parameters="self,enemy" type="boolean"><![CDATA[
fifth_value = false
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.")
fifth_value = true
}
}
else if (GetInt (self,"cur_hp") <= 0) {
msg (self.alias + " has died.")
msg ("GAME OVER")
finish
}
return (fifth_value)
]]></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>


and the legend~key for it (sorry, for this, but this is old code, I've learned to not use abrevs anymore, laughs):

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


--------

other links:

01. viewtopic.php?f=18&t=2901 (equipment)
02. viewforum.php?f=18 (libraries: guides)
03. viewtopic.php?f=18&t=2660
04. viewtopic.php?f=18&t=2557
05. viewtopic.php?f=18&t=3515
06. http://quest5.net/wiki/Category:All_Fun ... t_Commands (page 1, range: A-S)
07. http://quest5.net/w/index.php?title=Cat ... t#mw-pages (page 2, range: S-Z)
08. http://quest5.net/wiki/How_to (guides, scroll down for the bottom half of guides too)
09. http://quest5.net/wiki/Main_Page
10. http://quest5.net/wiki/Tutorial
11. http://quest5.net/wiki/Simple_Combat_System_(Advanced) .
12. http://quest5.net/wiki/Using_Types_and_Tabs_(Advanced) (magic system, scroll down, especially at the very bottom are the links for Pixie's Spell library)
13. viewtopic.php?f=18&t=4057 (interface allowing for clicking hyperlinks for adjusting stats~attributes at a level up)

-----------

HP and MP:

yes, having a second attribute is probably the easiest way to do it, for example (in code, sorry, but it's fast and easy for me to post help via code):

player.current_hit_point_integer = Value
player.maximum_hit_point_integer = Value
(optional: a minimum attribute too: player.minimum_hit_point_integer = Value, not so needed for HP, but some other game stats~attributes might~could use it)

if (player.current.hit_point_integer > player.maximum_hit_point_integer) {
player.current_hit_point_integer = player.maximum_hit_point_integer
}


if you want game code using min and max HP and MP, let me know, and I'll get one posted up for you.

--------

ensuring damage done to player by enemies, for example:

if (enemy.damage <= 0) {
enemy.damage = 1
}
player.hp = player.hp - enemy.damage

---------

saving and loading game:

I haven't worked with how saving games work, so someone else will have to help you on~with this

------

explore and travel:

my old explore and travel code:

<asl version="540">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Testing Game Stuff">
<gameid>eef801a1-4e6b-4b0a-bdbf-8f3ecfa8389c</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
<turns type="int">0</turns>
<statusattributes type="simplestringdictionary">turns=</statusattributes>
<start type="script">
msg ("Important Note:")
msg ("Type in: help")
</start>
</game>
<object name="homeland">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
<object name="grassland">
<inherit name="editor_room" />
</object>
<object name="plains">
<inherit name="editor_room" />
</object>
<object name="desert">
<inherit name="editor_room" />
</object>
<object name="tundra">
<inherit name="editor_room" />
</object>
<object name="swampland">
<inherit name="editor_room" />
</object>
<object name="mountains">
<inherit name="editor_room" />
</object>
<object name="forest">
<inherit name="editor_room" />
</object>
<object name="wasteland">
<inherit name="editor_room" />
</object>
<object name="coastland">
<inherit name="editor_room" />
</object>
<object name="hills">
<inherit name="editor_room" />
</object>
<command name="help_command">
<pattern>help</pattern>
<script>
help_function
</script>
</command>
<command name="explore_command">
<pattern>explore</pattern>
<script>
explore_function
</script>
</command>
<command name="travel_command">
<pattern>travel</pattern>
<script>
travel_function
</script>
</command>
<object name="data_object">
<inherit name="editor_object" />
<travel_string_list type="simplestringlist">homeland</travel_string_list>
<homeland_events_string_list type="simplestringlist">grassland_discovery;plains_discovery;desert_discovery;tundra_discovery;swampland_discovery;forest_discovery;mountains_discovery;hills_discovery;wasteland_discovery;coastland_discovery</homeland_events_string_list>
<homeland_events_script_dictionary type="scriptdictionary">
<item key="grassland_discovery">
list add (data_object.travel_string_list, "grassland")
msg ("You've discovered the grassland! Now, you can travel to the grassland and explore it!")
</item>
<item key="plains_discovery">
list add (data_object.travel_string_list, "plains")
msg ("You've discovered the plains! Now, you can travel to the plains and explore it!")
</item>
<item key="desert_discovery">
list add (data_object.travel_string_list, "desert")
msg ("You've discovered the desert! Now, you can travel to the desert and explore it!")
</item>
<item key="tundra_discovery">
list add (data_object.travel_string_list, "tundra")
msg ("You've discovered the tundra! Now, you can travel to the tundra and explore it!")
</item>
<item key="swampland_discovery">
list add (data_object.travel_string_list, "swampland")
msg ("You've discovered the swampland! Now, you can travel to the swampland and explore it!")
</item>
<item key="forest_discovery">
list add (data_object.travel_string_list, "forest")
msg ("You've discovered the forest! Now, you can travel to the forest and explore it!")
</item>
<item key="mountains_discovery">
list add (data_object.travel_string_list, "mountains")
msg ("You've discovered the mountains! Now, you can travel to the mountains and explore it!")
</item>
<item key="hills_discovery">
list add (data_object.travel_string_list, "hills")
msg ("You've discovered the hills! Now, you can travel to the hills and explore it!")
</item>
<item key="wasteland_discovery">
list add (data_object.travel_string_list, "wasteland")
msg ("You've discovered the wasteland! Now, you can travel to the wasteland and explore it!")
</item>
<item key="coastland_discovery">
list add (data_object.travel_string_list, "coastland")
msg ("You've discovered the coastland! Now, you can travel to the coastland and explore it!")
</item>
</homeland_events_script_dictionary>
</object>
<turnscript name="global_turnscript">
<enabled />
<script>
game.turns = game.turns + 1
</script>
</turnscript>
<function name="help_function">
msg ("Type 'explore' to explore your area.")
msg ("Type 'travel' to travel to different areas.")
</function>
<function name="explore_function"><![CDATA[
switch (game.pov.parent) {
case (homeland) {
result_1 = ListCount (data_object.homeland_events_string_list) - 1
if (result_1 >= 0) {
result_2 = StringListItem (data_object.homeland_events_string_list,GetRandomInt(0,result_1))
invoke (ScriptDictionaryItem (data_object.homeland_events_script_dictionary,result_2))
on ready {
foreach (item_x, split ("grassland_discovery;plains_discovery;desert_discovery;tundra_discovery;swampland_discovery;forest_discovery;mountains_discovery;hills_discovery;wasteland_discovery;coastland_discovery",";")) {
if (result_2 = item_x) {
list remove (data_object.homeland_events_string_list, result_2)
}
}
}
} else {
msg ("There seemingly is nothing left to explore in this area.")
}
}
}
]]></function>
<function name="travel_function">
show menu ("Where do you wish to travel?",data_object.travel_string_list,false) {
if (not game.pov.parent = GetObject (result)) {
game.pov.parent = GetObject (result)
} else {
msg ("You are already at this area.")
ask ("Try again?") {
if (result=true) {
travel_function
} else {
msg ("You realize that you need to discover a new area to travel to first, before you can travel to that place.")
}
}
}
}
</function>
</asl>


----------

ask me to help you with basic attribute usage, as there's a lot you can do, and I'll help you do it.

here's just the basic computational attribute usage:

addition:

Object_name.Attribute_name = Object_name.Attribute_name + Value
example: player.strength = player.strength + 1

subtraction:

Object_name.Attribute_name = Object_name.Attribute_name - Value
example: player.strength = player.strength - 10

multiplication:

Object_name.Attribute_name = Object_name.Attribute_name * Value
example: player.strength = player.strength * 20

division:

Object_name.Attribute_name = Object_name.Attribute_name / Value
example: player.strength = player.strength / 3

------------

my own leveling code:

(this doesn't provide the stat changes though, ask and I'll help you with a simple way of doing it)

<function name="leveling_function"><![CDATA[
if (player.experience >= player.level * 100 + 100) {
player.level = player.level + 1
player.experience = player.experience - player.level * 100 + 100
leveling_function
}
]]></function>


------------

if me and I can write a code example for you what a simple code would look like with being able to damage, kill, and loot (experience, currency~gold, and item taking off of the dead corpse).

Monkey Prodigy
If it's ok with omega, I'd like to join you. I love rpg's, as they give a ton of customization options, so you can choose how you play, and not be bound to the normal way of playing. Since this post, I've made a little advances, but nothing huge. I love TES games too, as the worlds are amazing, it's a gem of a RPG. TES and the classic Zelda's are the embodiment of RPg's, in my mind. I guess great minds think alike :)

Thanks for the tips, and I appreciate the help and speedy reply.

I'll post more tomorrow, as I gtg.

HegemonKhan
Zelda is awesome, NES and SNES. Ocarina of Time (N64) is okay... but, it's a one time game, and the dungeon after dungeon is a huge turn-off, as you get burnt out and sick of doing them, laughs.

I actually really like Zelda2: The Adventures of Link (the side scroller one, NES), but Zelda1: The Legend of Zelda (NES) and Zelda3: A Link to the Past (SNES), are good too. Oh, and Zelda4: Link's Awakening (GB), is great too. Have you played the fan-made one, Zelda: Outlands (PC-NES, a remake of Zelda1) ??? It's really awesome, and uber uber challenging, dungeons and finding stuff, hehe.

(They need to make a movie... it could be so good, if done well, Zelda can have a really good story, but the games have been a bit tame, and don't really take Zelda to it's true potential)

Monkey Prodigy
Aye, the NES and SNES ones are great. The Ocarina of Time, I disliked for some reason. I prefer top down and side-scrolling RPG's, like the Harry Potter and Sorcerer's Stone for the GBC. A movie would be excellent, as long as the producer doesn't make it stupid. ( That's happened to many movies that had great books. Eragon, I'm looking at you ) I've never played the fan-made one. . . Is it any good?

Back to Gemsthrone, the RPG.

Last night, I figured out what functions do :idea:
I was looking at how you made your combat system ( I just made a new game, and pasted the code over )
I get parts of it but not everything. When I go to play it, it says it doesn't recognize the span and div elements. Any idea's?

Here's some of my code, when I was trying to figure out functions so I wouldn't need to write a ton of code, over and over.

<!--Saved by Quest 5.5.5173.27901-->
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Combat System Intermediate">
<gameid>8011520a-c8ac-4f81-8f8d-999d09093813</gameid>
<version>1.0</version>
<firstpublished>2003</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<attack type="int">5</attack>
<defense type="int">0</defense>
<health type="int">25</health>
<statusattributes type="stringdictionary">
<item>
<key>health</key>
<value>Health: !</value>
</item>
<item>
<key>attack</key>
<value>Attack: !</value>
</item>
<item>
<key>defense</key>
<value>Defense: !</value>
</item>
</statusattributes>
</object>
<object name="Desk">
<inherit name="editor_object" />
<inherit name="surface" />
<alias>desk</alias>
<feature_container />
<object name="weapon">
<inherit name="editor_object" />
<attack type="int">15</attack>
<alt type="string">weapon</alt>
<take />
<ontake type="script">
Equip (weapon, player)
</ontake>
<alias>Sword</alias>
</object>
</object>
<exit alias="out" to="Arena">
<inherit name="outdirection" />
</exit>
</object>
<object name="Arena">
<inherit name="editor_room" />
<exit alias="in" to="room">
<inherit name="indirection" />
</exit>
</object>
<function name="Equip" parameters="weapon, player">
set (player, "attack", player.attack + weapon.attack )
</function>
</asl>

When I pick up the weapon, it works ( it gives me the attack of the weapon ), but when I drop it, I still have that attack. Also, I can see a moment when the player picks up another weapon, and still has the previous weapon; the player can stack weapons for insane amount of attack. . . Are there any solutions? Also, I have to name all my weapons "Weapon" and I must give them another alias. What happens when he tries to pick up the same weapon. Wouldn't he need to do something like make a weapon1? But then the function wouldn't work. Any help?

I am asking for help on everything you said I could ask help on and you'd help me :)

HegemonKhan
.

YESSSSSSSSSSSSS !!!!

if you liked Zelda1 (NES), you'll LOVE, ZeldaC (C for challenge, grins): Outlands, hehe (do NOT spoil it's challenge, until you are completey stuck, as wow is it fun and so challenging, both the dungeons and finding the items~stuff (and finding the dungeons too, lol). There's a lot of new features though too...

-----------

I actually like Eragon, it was a good movie, I loved the relationship between the human and dragon. Disney's How to Train your Dragon 1+2, does a good job with the human-dragon relationship too, but it's for kids obviously, where Eragon is for grown-ups.

Though, the 'boy to man and~or find yourself' themes are always so cheesy, argh (not Eragon movie specifically, just in general, sighs).

(wish they'd make the next movie... sighs... 10 or so years about... ya... right... lol)

I never read the books, but I'm a reader (well, I was), so of course, NO* movie can ever be as good as a book, unless the movie was like a year long (or more) to watch (lol), to have the same space for content that a book (or books) does (have). *There's only been maybe a few rare exceptions, where the movie is as good as the book. Still, there's something different~magical with written material, that a motion film just can't capture: your own imagination at work, hehe.

if you want some good book suggestions, let me know, and I'll give you some, hehe :D

-------------

maybe my old quest version code will work with your new quest version, so try just changing the version number in my code to yours (see below and further below), then try to run~start~play my code:

version="540", change it to this: version="550"

otherwise.....

the problem with my code is that it's for an earlier version of quest: 540

your quest version is the most recent one, quest version: 550

<asl>
-> // everything between these beginning ( <asl>) and ending ( </asl> ) tags, is your entire game code, aka your 'asl' tags is your entire game code, it's your game.
</asl>

version="540" ~ my quest version ~ an attribute within the <asl> tag that tells quest what quest version your game code is to be seen as by the quest engine.

my quest version:

<asl version="540">
-> // my entire game code
</asl>

your quest version:

<asl version="550">
-> // your entire game code
</asl>

the problem is that, some of the code lines syntax~format~structure~pattern have been changed from my older version to your newer version, so some of these old code lines' syntaxes of mine, won't work for~with~in your quest version 550 quest engine~game (quest.exe file), hence the errors that you get. I'll have to alter the old different code lines over to the quest version 550 code lines syntaxes. Otherwise, if you can find a download still for quest.exe of version 540, then you'd be able to use it to run my combat code without any errors.

here's the page~link to see the version updating's notes:

http://quest5.net/wiki/Upgrade_Notes

version="550" = 5.5.0 = 5.5
(pretend: version="540" = 5.4.9)
version="540" = 5.4.1
version="540" = 5.4.0 = 5.4
version="530" = 5.3.0 = 5.3
etc etc etc

-------------

wow, that's really good of you, if you understood some parts of my combat code, as it's really advanced, you've no idea how long it took me to get it myself, lol, as my combat code is based off of Pertex' Combat code (so all credit to him and his code, and he helped me a lot with it too).

----------

I'm unable to test stuff out, as I'm working off of my friend's mac laptop right now, and I don't have quest on it. But, I'll see if I can help troubleshoot your equiping-attacking issues as best as I can, on saturday or sunday, as it's late right now and I'm tired (friday night here, almost midnight).

--------

the 'NAME' String Attribute is your 'ID ~ Identity' Attribute, so no two things can have the same 'NAME' String Attribute.

think of your NAME Attribute as your genetic material (DNA), this is a biological absolute identifier that you are you, and that only you are you. This enables the quest engine its ability to work.

whereas, there can be many people named 'John Smith', the 'ALIAS' String Attribute (or you can make~add your own cutom string attributes: player.first_name_string = john, and player.last_name_string = smith)

<object name="player">
</object>

<object name="player">
</object>

ERROR, impossible for there to be two 'players', ERROR !!!!! (and sides, how could quest even work like this, anyways ? quest MUST be able to identify things, as how can you act upon something, if you can't identify~get~know~find that specific thing?)

whereas:

<object name="player1">
<alias>HK</alias>
</object>

<object name="player2">
<alias>HK</alias>
</object>

// NO error, as you got 'player1' and 'player2'. quest does not care about 'ALIAS', as quest only cares about the 'NAME' Attribute.


------

now, this is NOT an error, as there's just one attribute+type (one 'NAME'), being used in multiple locations:

<object name="player1">
<alias>HK</alias>
<attr name="strength" type="int">100</attr>
</object>

<object name="player2">
<alias>monkey prodigy</alias>
<attr name="strength" type="int">50</attr>
</object>


---------

but this would cause an error:

<object name="player1">
<alias>HK</alias>
<attr name="strength" type="int">100</attr>
</object>

<object name="player2">
<alias>monkey prodigy</alias>
<attr name="strength" type="string">50</attr>
</object>


as you got two attributes, an integer type attribute and a string type attribute, using the same name... CONFLICT~CONFUSION!

---------------

as for in regards to functions, I'm not sure what you're asking about them, as there's a few areas that you could be asking about:

if you mean like this:

<object name="orc1">
<alias>orc</alias>
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script">
fight_function
</attr>
</object>

<object name="orc2">
<alias>orc</alias>
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script">
fight_function
</attr>
</object>

<function name="fight">
if (orc1.dead) {
} else {
}
</function>

// ERROR!!! obviously, you got an issue for the 'orc2' Object.


Alex, made a very nice built-in 'GetObject' function for us, called: this

'this' gets the Object that holds it's script.

'this' replaces your Object, in:

Object_name.Attribute_name

so, it instead needs to be written~coded as this:

this.Attribute_name

----

so this (ach, bad accidental pun, sorry, lol) works:

<object name="orc1">
<alias>orc</alias>
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script">
fight_function
</attr>
</object>

<object name="orc2">
<alias>orc</alias>
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script">
fight_function
</attr>
</object>

<function name="fight">
if (this.dead) {
} else {
}
</function>

// no error, it works fine.


--------

or do you mean with the PARAMETER usage with functions?

(again, you can use 'this' for them as well ~ I think, lol)

------

or, if worse comes to worse, you can script~code-in your own 'GetObject' function too for your initial part of your function... this is a bit more advanced though, as you have to understand about lists, 'foreach', and 'string matching comparisons'.

------

let me know if you are confused with anything (if you need~want anything more explained), and~or need more help, hehe :D

HegemonKhan
I think I possibly see why your attack is stacking:

let me give an unrelated example just to show what is going on:

x = 0

:start
x = x + 1
goto start

x = 0
x = 0 + 1 = 1
x = 1 + 1 = 2
x = 2 + 1 = 3
x = 3 + 1 = 4
etc etc etc

so, your:

set (player, "attack", player.attack + weapon.attack)

is stacking up... you just keep adding to it.... (either to your player.attack or weapon.attack ~ not sure which, or if it's both)

---------

as for your other equiping issue, take a look at Chase's Wearables (equipment) Library:

viewtopic.php?f=18&t=2901

he codes really well, almost anyone can understand his code, as it's done really cleanly and concisely (i'm so jealous, laughs).

I think you can maybe see from his code, what and how to fix your equiping (unequiping) issue.

(if you need help with chase's code please ask, as I'm saying chase's code is easy to read from my slightly learned coding level, as it may not be for those new to quest and~or to coding)

Monkey Prodigy
Here's some code of a slightly updated game of mine ( just a demo for me to test stuff :)
<!--Saved by Quest 5.5.5173.27901-->
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="The Life of a Gladiator">
<gameid>07b65e42-576c-4acd-b3ee-76d99584674b</gameid>
<version>1.0</version>
<firstpublished>2003</firstpublished>
<difficulty>Medium</difficulty>
<cruelty>Tough</cruelty>
<start type="script">
</start>
</game>
<object name="training room">
<inherit name="editor_room" />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<prefix>the</prefix>
<object name="player">
<inherit name="editor_player" />
<inherit name="editor_object" />
<health type="int">25</health>
<attr name="health_max" type="int">25</attr>
<attack type="int">5</attack>
<exp type="int">0</exp>
<attr name="exp_max" type="int">15</attr>
<rank type="string"></rank>
<defense type="int">0</defense>
<statusattributes type="stringdictionary">
<item>
<key>health</key>
<value>Health: !</value>
</item>
<item>
<key>attack</key>
<value>Attack: !</value>
</item>
<item>
<key>defense</key>
<value>Defense: !</value>
</item>
<item>
<key>exp</key>
<value>EXP: !</value>
</item>
<item>
<key>rank</key>
<value>Rank:</value>
</item>
<item>
<key>speed</key>
<value>Attack Speed: !</value>
</item>
</statusattributes>
<speed type="int">10</speed>
<attr name="equip_max" type="int">1</attr>
<equip type="int">0</equip>
</object>
<object name="weapons rack">
<inherit name="editor_object" />
<inherit name="surface" />
<feature_container />
<object name="weapon">
<inherit name="editor_object" />
<alias>sword</alias>
<attack type="int">10</attack>
<speed type="int">-5</speed>
<defense type="int">3</defense>
<take />
<alt type="stringlist">
<value>weapon</value>
</alt>
<listalias type="string"></listalias>
<ontake type="script">
equip weapon (weapon, player)
</ontake>
<ondrop type="script">
set (player, "attack", player.attack - weapon.attack)
set (player, "defense", player.defense - weapon.defense)
set (player, "speed", player.speed + 5)
set (player, "equip", 0)
</ondrop>
</object>
</object>
<exit alias="west" to="gladiator ring">
<inherit name="westdirection" />
</exit>
</object>
<object name="monster pit">
<inherit name="editor_room" />
</object>
<object name="gladiator ring">
<inherit name="editor_room" />
<enter type="script">
attack start (gladiator, player)
</enter>
<object name="gladiator">
<inherit name="editor_object" />
<health type="int">10</health>
<defense type="int">0</defense>
<attack type="int">5</attack>
<exp type="int">15</exp>
<speed type="int">7</speed>
</object>
<exit alias="east" to="training room">
<inherit name="eastdirection" />
</exit>
</object>
<function name="equip weapon" parameters="weapon, player"><![CDATA[
if (player.equip < player.equip_max) {
msg ("You equip it.")
set (player, "attack", player.attack + weapon.attack)
set (player, "equip", 1)
set (player, "defense", player.defense + weapon.defense)
set (player, "speed", player.speed + weapon.speed)
}
else {
msg ("You have no more room!")
}
]]></function>
<function name="attack start" parameters="gladiator, player"><![CDATA[
msg ("A gladiator attacks you!")
if (gladiator.speed > player.speed) {
set (player, "health", player.health - gladiator.attack)
attack start (gladiator, player)
}
else {
msg ("You move faster though, thus allowing you to attack first!")
set (gladiator, "health", gladiator.health - player.attack)
msg ("The gladiator lashes back!")
set (player, "health", player.health - gladiator.attack)
if (gladiator.health < 0) {
msg ("Your enemy succumbs to his wounds.")
}
else {
msg ("Your enemy staggers, wounded, but manages to stay upright and alive.")
attack start (gladiator, player)
}
}
]]></function>
</asl>

You start in a room, then you can pick up the sword, which increases you attack by ten, your defense by three, and decreases you attack speed by 5. However, if I make a weapon called staff like this:

name = weapon
alias = staff

The equip weapon function would work on it, but Quest says that the object "weapon" already exists. So I renamed it weapon1. But then, the equip function wouldn't work.

I think I get the code you gave me for the orc's. Basically, you give them an attribute whose value is script, which then calls the function fight, but the fight function will only work if the monster is "alive"? Then you use that GetObject script, which would then be like

if this.hostility > 50
then
if this.speed > player.speed
The monster is faster than you, thus allowing it to land the first blow!
set object player's attribute "health" = player.health - this.attack
if player.health < 0
then
print message= You succumb to your grevious wounds, while everything around you fades into blackness. . .
end game
else
print message= "You lash back!"
set object this(?) attribute "health" = this.health - player.attack
if this.health < 0
then
print message= The monster succumbs to its wound(s)
else
call function "fight"


Is this sorta correct? I apologize for my noobiness, but I am just 13, going into 8th grade, and this is my 6th(?) day of being introduced to Quest.
Would you explain the GetObject more? Thanks in advance :)

HegemonKhan
to reduce the size~length of your post, and to make it easier for us, use this post code, for posting big chunks of stuff like your game code (but you can use it for any large segments of post content too):

[code.]your_content_here[/code.]

but without the dots in the brackets, it'll look like this:

your_content_here


-------------

you're doing great especially for being only 13, and you're tackling some really advanced stuff quickly, so don't feel like you should be understanding this stuff so quickly and~or easily.

----------

ignore my explanation of 'this' as a specialized 'GetObject function', as I'm probably just confusing you.

all you got to do, is to replace the object in the script with: this

instead of (for example):

Object_name.Attribute_name
example: orc.strength

this.Attribute_name
example: this.strength

-----

A Script Type Attribute in code, is actually your 'Verb' in the GUI~Editor, sorry for not explaning this to you. They are the same thing. Though there's a few more things you got to do with code to make it work, whereas using the 'Verb' in the GUI~Editor does all the stuff that needs to be coded in, for you, as that's why it's a feature of the GUI~Editor, for those who don't want to do stuff in code, hehe.

-----

monkey prodigy wrote:I think I get the code you gave me for the orc's. Basically, you give them an attribute whose value is script, which then calls the function fight, but the fight function will only work if the monster is "alive"? Then you use that GetObject script, which would then be like


yep, you understand it perfectly!

I have it check for whether the monster~enemy (orc) is alive or not, as you don't want to be fighting the orc, when it's already dead (when it already has zero or less than zero life, lol). As what if you click on the 'fight' Verb again, after you killed it, hence the check for if it is alive or not. Also, I could code in additional stuff, such as when you click on the 'Fight' Verb again, after you killed it, you then loot it's stuff, take its gold, items, and~or equipment, for example. Or, maybe you might want to revive it, hehe (such as if you got a hostility system like in TES games, where any character can be friendly or hostile, and you accidentally kill an important townsperson character...). you can make it as simple or complex as you want.

I just use a 'function' so I don't have to have every object having the same huge chunk of fight code within it. A way to reduce the amount of code lines that you have.

and your pseudo-code script is correct, you got the idea correctly.

though, for your 'set' code, it would be this:

set (this, "health", this.health - player.attack)

-----

let me know if this post helps, as this was just some quick responses by me, if not I'll help you in more detail.

I haven't looked over your game code yet in full.

--------

found a small mistake in your code so far (unrelated mistake to your post question):

under your 'player' Object, for it's 'statusattributes', for your 'rank', you forgot the '!' symbol in it.

HegemonKhan
work in progress...

<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="The Life of a Gladiator">
<gameid>07b65e42-576c-4acd-b3ee-76d99584674b</gameid>
<version>1.0</version>
<firstpublished>2003</firstpublished>
<difficulty>Medium</difficulty>
<cruelty>Tough</cruelty>
<start type="script">
// if you add scripts here, this is done first, before being able to do or see anything else in the game; it happens before the game 'begins' for play.
</start>
</game>
<object name="training room">
<inherit name="editor_room" />
<usedefaultprefix type="boolean">false</usedefaultprefix>
<prefix>the</prefix>
<object name="player">
<inherit name="editor_player" />
<inherit name="editor_object" />
<health type="int">25</health>
<attr name="health_max" type="int">25</attr>
<attack type="int">5</attack>
<exp type="int">0</exp>
<attr name="exp_max" type="int">15</attr>
<rank type="string"></rank>
<defense type="int">0</defense>
<statusattributes type="stringdictionary">
<item>
<key>health</key>
<value>Health: !</value>
</item>
<item>
<key>attack</key>
<value>Attack: !</value>
</item>
<item>
<key>defense</key>
<value>Defense: !</value>
</item>
<item>
<key>exp</key>
<value>EXP: !</value>
</item>
<item>
<key>rank</key>
<value>Rank: !</value>
</item>
<item>
<key>speed</key>
<value>Attack Speed: !</value>
</item>
</statusattributes>
<speed type="int">10</speed>
<attr name="equip_max" type="int">1</attr>
<equip type="int">0</equip>
</object>
<object name="weapons rack">
<inherit name="editor_object" />
<inherit name="surface" />
<feature_container />
<object name="weapon_1">
<inherit name="editor_object" />
<alias>sword</alias>
<attack type="int">10</attack>
<speed type="int">-5</speed>
<defense type="int">3</defense>
<take />
<alt type="stringlist">
<value>weapon</value>
</alt>
<listalias type="string"></listalias>
<ontake type="script">
equip weapon (this, player)
</ontake>
<ondrop type="script">
unequip weapon (this, player)
</ondrop>
</object>
</object>
<exit alias="west" to="gladiator ring">
<inherit name="westdirection" />
</exit>
</object>
<object name="monster pit">
<inherit name="editor_room" />
</object>
<object name="gladiator ring">
<inherit name="editor_room" />
<enter type="script">
attack start (gladiator, player)
</enter>
<object name="gladiator">
<inherit name="editor_object" />
<health type="int">10</health>
<defense type="int">0</defense>
<attack type="int">5</attack>
<exp type="int">15</exp>
<speed type="int">7</speed>
</object>
<exit alias="east" to="training room">
<inherit name="eastdirection" />
</exit>
</object>
<function name="equip weapon" parameters="weapon, player"><![CDATA[
if (player.equip < player.equip_max) {
msg ("You equip it.")
set (player, "attack", player.attack + weapon.attack)
set (player, "equip", 1)
set (player, "defense", player.defense + weapon.defense)
set (player, "speed", player.speed + weapon.speed)
}
else {
msg ("You have no more room!")
}
]]></function>
<function name="equip weapon" parameters="weapon, player"><![CDATA[
set (player, "attack", player.attack - weapon.attack)
set (player, "defense", player.defense - weapon.defense)
set (player, "speed", player.speed + 5)
set (player, "equip", 0)
</function>
<function name="attack start" parameters="gladiator, player"><![CDATA[
msg ("A gladiator attacks you!")
if (gladiator.speed > player.speed) {
set (player, "health", player.health - gladiator.attack)
attack start (gladiator, player)
}
else {
msg ("You move faster though, thus allowing you to attack first!")
set (gladiator, "health", gladiator.health - player.attack)
msg ("The gladiator lashes back!")
set (player, "health", player.health - gladiator.attack)
if (gladiator.health < 0) {
msg ("Your enemy succumbs to his wounds.")
}
else {
msg ("Your enemy staggers, wounded, but manages to stay upright and alive.")
attack start (gladiator, player)
}
}
]]></function>
</asl>

Monkey Prodigy
Dude, your awesome!
I will test this out once I get back from our camping trip (aughhh)
I personally dislike camping trips, but oh well. . .
Thanks the help :)

Monkey Prodigy
<!--Saved by Quest 5.5.5173.27901-->
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="Gemsthrone, the RPG">
<inherit name="theme_retro" />
<gameid>ca3dcb4f-b321-4803-8ab5-e89530ec29ec</gameid>
<version>1.0</version>
<firstpublished>2003</firstpublished>
<feature_asktell />
<menufontsize type="int">13</menufontsize>
<pov type="object">player</pov>
<start type="script">
msg ("What is your name?")
get input {
set (player, "playername", result)
ShowMenu ("What gender are you?", Split ("Male;Female", ";"), false) {
set (player, "gender", result)
genderstatschoice
ShowMenu ("What race are you?", Split ("Dwarven;Elven;Human", ";"), false) {
set (player, "race", result)
racestatschoice
msg ("So you are a " + LCase(player.gender) + " whose race is " + LCase(player.race) + ". And your name is " +player.playername + ".")
wait {
ClearScreen
MoveObject (player, Player Bedroom)
}
}
}
}
</start>
</game>
<object name="character creation">
<inherit name="editor_room" />
<descprefix>You are floating in the inky blackness called the</descprefix>
<usedefaultprefix type="boolean">false</usedefaultprefix>
<suffix>void</suffix>
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<health type="int">0</health>
<attr name="health_max" type="int">0</attr>
<exp type="int">0</exp>
<attr name="exp_max" type="int">0</attr>
<rank type="int">0</rank>
<attack type="int">0</attack>
<defense type="int">0</defense>
<magic type="int">0</magic>
<mana type="int">0</mana>
<attr name="mana_max" type="int">0</attr>
<luck type="int">0</luck>
<lockpick type="int">0</lockpick>
<blacksmith type="int">0</blacksmith>
<speed type="int">0</speed>
<money type="int">0</money>
<alchemy type="int">0</alchemy>
<magicres type="int">0</magicres>
<statusattributes type="stringdictionary">
<item>
<key>health</key>
<value>Health: !</value>
</item>
<item>
<key>exp</key>
<value>EXP: !</value>
</item>
<item>
<key>rank</key>
<value>Rank: !</value>
</item>
<item>
<key>attack</key>
<value>Attack: !</value>
</item>
<item>
<key>defense</key>
<value>Defense: !</value>
</item>
<item>
<key>magic</key>
<value>Magic: !</value>
</item>
<item>
<key>mana</key>
<value>Mana: !</value>
</item>
<item>
<key>speed</key>
<value>Speed: !</value>
</item>
<item>
<key>playername</key>
<value>Name: !</value>
</item>
<item>
<key>gender</key>
<value>Gender: !</value>
</item>
<item>
<key>race</key>
<value>Race: !</value>
</item>
<item>
<key>magicres</key>
<value>Magic Resistance: !</value>
</item>
</statusattributes>
<race type="string"></race>
<gender type="string"></gender>
<playername type="string"></playername>
</object>
</object>
<verb>
<property>fight</property>
<pattern>fight</pattern>
<defaultexpression>"You can't fight " + object.article + "."</defaultexpression>
</verb>
<function name="genderstatschoice">
if (player.gender = "Male") {
set (player, "health", 8 + GetRandomInt(2,8))
set (player, "health_max", player.health)
set (player, "attack", 5 + GetRandomInt(2,5))
set (player, "defense", 0)
set (player, "speed", 3 + GetRandomInt(1,3))
set (player, "alchemy", 5 + GetRandomInt(2,5))
set (player, "lockpick", 5 + GetRandomInt(2,5))
set (player, "blacksmith", 5 + GetRandomInt(2,5))
set (player, "luck", 5 + GetRandomInt(2,5))
set (player, "magicres", 5 + GetRandomInt(2,5))
}
else {
set (player, "health", 6 + GetRandomInt(2,6))
set (player, "health_max", player.health)
set (player, "attack", 3 + GetRandomInt(1,3))
set (player, "defense", 0)
set (player, "speed", 5 + GetRandomInt(2,5))
set (player, "alchemy", 5 + GetRandomInt(2,5))
set (player, "lockpick", 5 + GetRandomInt(2,5))
set (player, "blacksmith", 5 + GetRandomInt(2,5))
set (player, "luck", 5 + GetRandomInt(2,5))
set (player, "magicres", 5 + GetRandomInt(2,5))
}
</function>
<function name="racestatschoice">
if (player.race = "Dwarven") {
set (player, "health", player.health + 6 + GetRandomInt(2,6))
set (player, "health_max", player.health)
set (player, "attack", player.attack + 6 + GetRandomInt(2,6))
set (player, "defense", player.defense + 3 + GetRandomInt(1,3))
set (player, "speed", player.speed + 3 + GetRandomInt(1,3))
set (player, "alchemy", player.alchemy + 3 + GetRandomInt(1,3))
set (player, "lockpick", player.lockpick + 3 + GetRandomInt(1,3))
set (player, "blacksmith", player.blacksmith + 6 + GetRandomInt(2,6))
set (player, "luck", player.luck + 3 + GetRandomInt(1,3))
set (player, "magic", 0)
set (player, "mana", 0)
set (player, "mana_max", 0)
set (player, "magicres", player.magicres + 4 + GetRandomInt(1,4))
}
else {
if (player.race = "Elven") {
set (player, "health", player.health + 3 + GetRandomInt(1,3))
set (player, "health_max", player.health)
set (player, "attack", player.attack + 3 + GetRandomInt(1,3))
set (player, "defense", player.defense + 0 + GetRandomInt(0,0))
set (player, "speed", player.speed + 6 + GetRandomInt(3,6))
set (player, "alchemy", player.alchemy + 6 + GetRandomInt(3,6))
set (player, "lockpick", player.lockpick + 4 + GetRandomInt(1,5))
set (player, "blacksmith", player.blacksmith + 3 + GetRandomInt(1,3))
set (player, "luck", player.luck + 3 + GetRandomInt(1,3))
set (player, "magic", player.magic + 13 + GetRandomInt(2,7))
set (player, "mana", player.mana + 13 + GetRandomInt(2,7))
set (player, "mana_max", player.mana)
set (player, "magicres", player.magicres + 3 + GetRandomInt(1,3))
}
else {
set (player, "health", player.health + 4 + GetRandomInt(1,4))
set (player, "health_max", player.health)
set (player, "attack", player.attack + 4 + GetRandomInt(1,5))
set (player, "defense", player.defense + 1 + GetRandomInt(0,1))
set (player, "speed", player.speed + 4 + GetRandomInt(2,4))
set (player, "alchemy", player.alchemy + 3+ GetRandomInt(1,3))
set (player, "lockpick", player.lockpick + 6 + GetRandomInt(3,6))
set (player, "blacksmith", player.blacksmith + 4 + GetRandomInt(1,4))
set (player, "luck", player.luck + 3 + GetRandomInt(1,3))
set (player, "magic", player.magic + 7 + GetRandomInt(2,4))
set (player, "mana", player.mana + 7 + GetRandomInt(2,4))
set (player, "mana_max", player.mana)
set (player, "magicres", player.magicres + 3 + GetRandomInt(1,3))
}
}
</function>
<function name="bed sleep"><![CDATA[
if (player.health = player.health_max) {
msg ("You don't need to sleep, as you are already at max health!")
}
else {
msg ("You lay down, and you are embraced by sleep")
SetTimeout (2) {
msg ("ZzzzZzzz")
SetTimeout (2) {
SetTimeout (2) {
msg ("ZzzzzzzZzz")
SetTimeout (2) {
msg ("You wake up. You feel refreshed!")
set (player, "health", player.health + 500)
if (player.health > player.health_max) {
set (player, "health", player.health_max)
}
}
}
}
}
}
]]></function>
</asl>

I figured out some stuff. Like how to make random integers ( which is useful for stats ), and how to use the "This" thing.
I was tinkering with verbs on a sword, and I made it set my attribute to = player.attack + this.attack .. .
Now I have a problem though. Say I kill a monster, how do I make it create ( or drop perhaps ) and item with a Unique name but make it to where a function could read the part that says "weapon".
Here's what I mean.
You kill a monster.
Then it drops / creates an object.
You pick up the object, which triggers the function "equip weapon/armor"
It takes the name of the object you are equipping, bypasses the Uniquee amount/pattern of numbers and takes the "weapon" part from the name, and then somehows runs the this. script?

jaynabonne
I'm not 100% sure what you mean (not even 10% actually, lol), so I'm going to take a stab.

It sounds to me like you want to somehow invoke a script based on part of the name of an object. I have several thoughts about that.

First, keep in mind that an object has both a name and an alias. So your created object can have a name like "314_weapon" but the alias can be "Two-handed battle axe". You don't have to expose the player to the "unique" naming part.

Second, to create objects, you can simply create a new object - but you can also clone existing objects. I would go the latter route. You can have a pile of "prototype" objects that you clone from to create the objects they find. That way, what they pick up will be an actual short sword or battle axe or whatever instead of some generic object with an encoded name.

Finally, if you do want to separate out the weapon part from the unique naming, there are various string functions (e.g. "Mid") that you can use to pick strings apart. Or if you have a unique character in your encoding (e.g. "314foobar_Short Sword") then you can simply split the string on that character ("_" in this case") and pick off the second string in the resulting list.

HegemonKhan
for any large segments (such as game code) that you want to post, use this posting code:

[code.]your_mass_of_text[/code.]

but without the dots in the brackets, it'll look like this:

your_mass_of_text


this is very useful for posting code, as it keeps the indenting correct.

---------

in your 'equip' function:

use the 'has' and~or 'get' codes, for example...

if (HasString (this, "equipment_type") {
if (GetString (this, "equipment_type") = "weapon") {
// scripting that moves the weapon object (or it's created clone object) over to the player, and then the scripting for how to make your weapon object being 'equipped'.
} else {
msg ("This is not a weapon that you can equip.")
}
} else {
msg ("This is not equipment that you can equip")
}


but, there's many many ways of doing what you want, I'm more limited in these ways, as I'm still learning to code myself, whereas, Jay and others who're good at coding can probably help you with doing much better, more efficient~clean'er~etc ways of doing it.

---------------------

One thing that you learn quickly being new to coding (like me too), is HOW (what design method) to go about your coding in what you want to do. It takes a long time of getting experience with HOW to go about coding things in the best way. This code structural mentality~logic~thinking~mindset, is extremely difficult for us who're new to code, as we don't know all the ways of design method to do various things in code. We often over think things, as we don't know much about code, and thus how to go about the design method of doing things in code. I think you're over-thinking 'equipping', as you don't know the ways that it can be done in code, you don't know the design methods, and thus don't know what is the best design to use for your coding of doing your 'equipping'. I myself find that this is one of my biggest obstacles (besides just trying to code so that it works, it's really not easy to choose, as you don't know, the best design method of coding)

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums