How to create randomly awarded treasure. Aka object arrays.
clone45
17 Feb 2013, 00:29Hello!
I need a way to award random treasure from a list of existing treasure possibilities. I might have different "groupings" of treasure to select from, too. Without knowing the correct syntax, here's what I mean:
level_1_treasures = object_array(knife, rope, leather shield, cap);
level_2_treasures = object_array(sword, bow, arrow, throwing_star);
// Choose a random level 1 treasure
index = random(0, array_length(level_1_treasures) - 1) ;
inventory_add(clone_object(level_1_treasures[index]));
Is this something I'll need to code "by hand" in the code editor?
Thanks!
- Bret
I need a way to award random treasure from a list of existing treasure possibilities. I might have different "groupings" of treasure to select from, too. Without knowing the correct syntax, here's what I mean:
level_1_treasures = object_array(knife, rope, leather shield, cap);
level_2_treasures = object_array(sword, bow, arrow, throwing_star);
// Choose a random level 1 treasure
index = random(0, array_length(level_1_treasures) - 1) ;
inventory_add(clone_object(level_1_treasures[index]));
Is this something I'll need to code "by hand" in the code editor?
Thanks!
- Bret
sgreig
17 Feb 2013, 04:48No, you don't have to do it by hand in the code editor, but I think it would be easier.
Quest doesn't actually have arrays, but you can store the list of treasures in a string or object list and it would accomplish much the same thing, as lists are indexed. I explained something similar to dwn in another thread, which you can take a look at here: http://forum.textadventures.co.uk/viewtopic.php?f=10&t=3435#p22609
Quest doesn't actually have arrays, but you can store the list of treasures in a string or object list and it would accomplish much the same thing, as lists are indexed. I explained something similar to dwn in another thread, which you can take a look at here: http://forum.textadventures.co.uk/viewtopic.php?f=10&t=3435#p22609
clone45
17 Feb 2013, 07:55Thanks for the info. My code so far looks something like this:
May I update the documentation on the WIKI for newObjectList to include a few examples?
Cheers,
- Bret
game.treasureGroup1 = newObjectList()
list add (game.treasureGroup1, bookshelf)
list add (game.treasureGroup1, shovel)
msg(ObjectListItem(game.treasureGroup1, GetRandomInt(1,2) - 1).name)
May I update the documentation on the WIKI for newObjectList to include a few examples?
Cheers,
- Bret
sgreig
17 Feb 2013, 20:49I think everyone is welcome to add to the wiki, but I believe you need to email Alex with your desired username as he disabled user registration due to excessive spam or something like that.
clone45
18 Feb 2013, 01:05Thanks. I have a follow up question. Part of my game involves fishing, and one of the things that you can do is dig for worms. I was intending to clone a "worm" object, but after doing some research on the forums, I'm finding that my tactics might not work:
I noticed that the clone object creates a renamed version of the clone, such as "worm1". I also read somewhere that no two objects can have the same name. Is that still true? My game would work best if the player could have multiple worms in their inventory. Would it be better to use a "worm_count" attribute on the player? Or, maybe I could create a "bait bag" object and it could have a worm_count, grasshopper_count, etc. I'm much rather be able to create actual worm objects, because I think it would feel more realistic.
Any advice would be appreciated.
- Bret
I noticed that the clone object creates a renamed version of the clone, such as "worm1". I also read somewhere that no two objects can have the same name. Is that still true? My game would work best if the player could have multiple worms in their inventory. Would it be better to use a "worm_count" attribute on the player? Or, maybe I could create a "bait bag" object and it could have a worm_count, grasshopper_count, etc. I'm much rather be able to create actual worm objects, because I think it would feel more realistic.
Any advice would be appreciated.
- Bret
sgreig
18 Feb 2013, 06:34Yeah, objects in Quest can't have the same name... In situations like this, I often feel that as long as the player is no more the wiser of how it's done, then how it's taken care of "behind the scenes" is largely irrelevant. So handling it with a variable that keeps track of how many worms you have or whatever would be the least headache inducing for you. 

TriangleGames
18 Feb 2013, 12:34One other thought, items can have the same alias, so all the worm items that copy could look the same, but I'm not sure what happens if multiple items with a shared alias are all in the same room. It might work with a "dragon warrior" style where each worm actually appears separately in the bag.
sgreig
18 Feb 2013, 17:13Yeah, if they all have the same alias it would look something like:
> look in bag
Inside the bad you see: A worm, A worm, A worm, A worm, and A worm.
Not ideal. Unless there's some important reason why the worm needs to be an object (i.e. needs to be turned on or off, opened, etc.) then going the route of using variables and such is probably the best approach for what you're trying to do, but that's just my opinion.
> look in bag
Inside the bad you see: A worm, A worm, A worm, A worm, and A worm.
Not ideal. Unless there's some important reason why the worm needs to be an object (i.e. needs to be turned on or off, opened, etc.) then going the route of using variables and such is probably the best approach for what you're trying to do, but that's just my opinion.

clone45
18 Feb 2013, 17:21That sounds reasonable. I'll head in that direction.
It would be nice to have a feature that supported multiple objects. The game would simply group objects if it found multiple versions of them. So, for example, your inventory would say, "worms(5)" instead of worm, worm, worm, worm, worm. If you said, "eat worm", it'd just assume you meant "any worm". But I could see how that might become a nightmare when it comes to programming. And, if one of the worms had anything different with it, such as an attribute with a different value, it'd be very difficult to differentiate it when issuing an action. Anyhow, I'll work around it.
Cheers,
- Bret
It would be nice to have a feature that supported multiple objects. The game would simply group objects if it found multiple versions of them. So, for example, your inventory would say, "worms(5)" instead of worm, worm, worm, worm, worm. If you said, "eat worm", it'd just assume you meant "any worm". But I could see how that might become a nightmare when it comes to programming. And, if one of the worms had anything different with it, such as an attribute with a different value, it'd be very difficult to differentiate it when issuing an action. Anyhow, I'll work around it.

Cheers,
- Bret
sgreig
18 Feb 2013, 17:27Yeah. If you have multiple "worms" in your inventory and you type "eat worm" you'll get a popup window asking you to select which one you want to eat.
I can't really speak for Alex, but he probably could have added this functionality and likely decided it wasn't necessary. You can always create a worm count in the status pane that shows how many you currently have, like "Worms: 5" or something like that.
I can't really speak for Alex, but he probably could have added this functionality and likely decided it wasn't necessary. You can always create a worm count in the status pane that shows how many you currently have, like "Worms: 5" or something like that.
clone45
19 Feb 2013, 04:47I think it would still be a great addition, though. In my situation, I can probably make do. But being able to spawn a duplicate object without having to fake it seems really valuable. Granted, I might be unusual coming from more of an RPG background. That being said, I hope I'm not coming across needy or disappointed. I love Quest!
HegemonKhan
19 Feb 2013, 06:18I think you probably could code in having it do (and adjust): "worms (5)" in your inventory, this might be fun to try to figure out how to code in, for a noob like me anyways, I might give it a shot, as it seems to be a fun (and useful) coding for me to try to do when I got the time.
And if your worms were to be different... you could always (if you don't already) put some attribute (or object type too) on it, allowing you to get that specific worm item, via through that unique attribute (or object type too).
Or, if this can't be done via the inventory pane directly... you could have a storage object in your inventory... and then through the storage object you can get it to work, with "simple" scripting.
I got a storage system made for learned spells, but I still haven't gotten to working on the equipment storage yet, I been busy with real life stuff, so hadn't been doing much quest for this entire month, sighs.
(if you're interested in taking a look at my storage system coding, feel free to let me know, and I'll post it for you)
And if your worms were to be different... you could always (if you don't already) put some attribute (or object type too) on it, allowing you to get that specific worm item, via through that unique attribute (or object type too).
Or, if this can't be done via the inventory pane directly... you could have a storage object in your inventory... and then through the storage object you can get it to work, with "simple" scripting.
I got a storage system made for learned spells, but I still haven't gotten to working on the equipment storage yet, I been busy with real life stuff, so hadn't been doing much quest for this entire month, sighs.
(if you're interested in taking a look at my storage system coding, feel free to let me know, and I'll post it for you)
clone45
20 Feb 2013, 05:45HegemonKan,
Yes, I'd absolutely be interested in checking out your storage system code! Thanks for offering! I'm a programmer for my profession, so perhaps I could (with a little direction) make the adjustments necessary to make this work.
Thanks,
- Bret
Yes, I'd absolutely be interested in checking out your storage system code! Thanks for offering! I'm a programmer for my profession, so perhaps I could (with a little direction) make the adjustments necessary to make this work.
Thanks,
- Bret
HegemonKhan
20 Feb 2013, 07:10well if you're a programmer, there's absolutely nothing fancy about the code for my storage code for learned spells, as I'm not a programmer (wish I was, sighs. I'm old now, wish I would've been learning it from when I was little, as it's quite a bit late now).
Also... my code is really horrible, messy, and "long winded". For me, just getting a functioning code is a huge achievement for me, as later on, I can go back and try to make the code better (simple, short, clear, efficient; "streamlined"). So, my apologizes for my unbearably noobishly poor codings.
it basically involves making a lot of child objects within a parent object, so your inventory isn't cluttered and also so you can organize them (I don't know how to or if it could be done otherwise), with the actual placement of where the (spell objects) go.
It could have been just as easy to make the main storage object not have a parent too, but I decided to just go and put it as a child of the player object. (well, maybe there might be some coding difficulties in trying to do this, but I think it could be done)
storage object type -> immoveable (take, drop, use, give, etc = false) closed container. immoveable book-like objects within immoveable book-like objects, lol.
player object
-> storage object
->-> spell storage object
->->-> fire spells storage object
->->-> etc etc etc
->-> equipment storage object
->->-> weapons storage object
->->->-> sword storage object
->->->-> etc etc etc
->->-> armors storage object
->->->-> shield storage object
->->->-> headwear storage object
->->->-> etc etc etc
->->-> clothing storage object
->->->-> fingerwear (for ring wearing) storage object
->->->-> etc etc etc
->-> items storage object
->->-> useable items storage object
->->-> non-useable (game progression items) items storage object
->->-> battle items storage object
then it is a matter of making the code to place your stuff into the correct places.
(so far, I only got the spells done, as I'm still trying to figure out and work on with the equipment)
so here's my storage codings:
> it's done as a library file (but this can be easily changed or copy and pasted directly into your game file or a new game file too, if you don't want to use it as an added library file to your game file or new game file)
> I copy and pasted this over from one file into a new file, as I didn't have a file just for my storage coding, so if it doesn't work, let me know, as I probably am missing something that is needed that I didn't include in my pasting of it over to the new file, lol.
> this is just for the spell storage system, as I'm still working on how to do the equipment (it's messy as I'm doing more brainstorming of how I want to do it, so I haven't ~ can't ~ yet work on how to do its coding yet).
> I used Pixie's Spell Library coding structure, so this stuff is all his~hers - the credit goes to him~her, for making my spell storage of Pixie's learned spells.
--------
P.S.
really the only code you're interested in for what you want to do, would be this (unless you can't work directly the inventory pane with the codings):
for what you want to do, it'll obviously be a bit different, and either with more or less complex coding, as you got to figure out how to code with the inventory display titles (if this can be done, I think it can anyways). so, this code below isn't too useful, except as a very loose coding method, and you've got other things you got to code in beyond just "Get_Whatever", hehe.
as I think you'll have to (in my noob attempt at guessing how to code it, lol):
need a way of "checking and getting" a list of the items in your inventory, so that you can then identify the "worm" items, and then figure out how to count them, and then substitute all of the worm items for: a single worm item with it's amount of them (or if you're going to have worms with different attributes, then multiple single worm items of those different worm types, and with it doing the same of removing them and adding in the right number onto the right single worm type name).
i.e.
player.inventory:
worm_type_1 (heals 25 HP)
worm_type_1 (heals 25 HP)
worm_type_2 (heals 50 HP)
worm_type_2 (heals 50 HP)
worm_type_2 (heals 50 HP)
worm_type_3 (heals 100 HP)
worm_type_3 (heals 100 HP)
worm_type_3 (heals 100 HP)
worm_type_3 (heals 100 HP)
~TO~
player.inventory:
worm_type_1 (x2)
worm_type_2 (x3)
worm_type_3 (x4)
then you got to code in when you eat a worm, to adjust the amount shown (and if you eat the last one, it then disappears from your inventory, lol)
Also... my code is really horrible, messy, and "long winded". For me, just getting a functioning code is a huge achievement for me, as later on, I can go back and try to make the code better (simple, short, clear, efficient; "streamlined"). So, my apologizes for my unbearably noobishly poor codings.
it basically involves making a lot of child objects within a parent object, so your inventory isn't cluttered and also so you can organize them (I don't know how to or if it could be done otherwise), with the actual placement of where the (spell objects) go.
It could have been just as easy to make the main storage object not have a parent too, but I decided to just go and put it as a child of the player object. (well, maybe there might be some coding difficulties in trying to do this, but I think it could be done)
storage object type -> immoveable (take, drop, use, give, etc = false) closed container. immoveable book-like objects within immoveable book-like objects, lol.
player object
-> storage object
->-> spell storage object
->->-> fire spells storage object
->->-> etc etc etc
->-> equipment storage object
->->-> weapons storage object
->->->-> sword storage object
->->->-> etc etc etc
->->-> armors storage object
->->->-> shield storage object
->->->-> headwear storage object
->->->-> etc etc etc
->->-> clothing storage object
->->->-> fingerwear (for ring wearing) storage object
->->->-> etc etc etc
->-> items storage object
->->-> useable items storage object
->->-> non-useable (game progression items) items storage object
->->-> battle items storage object
then it is a matter of making the code to place your stuff into the correct places.
(so far, I only got the spells done, as I'm still trying to figure out and work on with the equipment)
so here's my storage codings:
> it's done as a library file (but this can be easily changed or copy and pasted directly into your game file or a new game file too, if you don't want to use it as an added library file to your game file or new game file)
> I copy and pasted this over from one file into a new file, as I didn't have a file just for my storage coding, so if it doesn't work, let me know, as I probably am missing something that is needed that I didn't include in my pasting of it over to the new file, lol.
> this is just for the spell storage system, as I'm still working on how to do the equipment (it's messy as I'm doing more brainstorming of how I want to do it, so I haven't ~ can't ~ yet work on how to do its coding yet).
> I used Pixie's Spell Library coding structure, so this stuff is all his~hers - the credit goes to him~her, for making my spell storage of Pixie's learned spells.
<?xml version="1.0"?>
<library>
<!-- Templates -->
<!-- Spell Templates -->
<template name="Learn">learn</template>
<template name="Cast">cast</template>
<template name="Teach">teach</template>
<template name="Spell_Already_Learned">Oops, you already know this spell.</template>
<dynamictemplate name="Spell_Learned">"You've learned the " + GetDisplayAlias(object) + " spell."</dynamictemplate>
<!-- Verbs -->
<!-- Spell Verbs -->
<verb>
<property>learn</property>
<pattern>learn</pattern>
<defaultexpression>"You can't learn " + object.article +"."</defaultexpression>
</verb>
<verb>
<property>cast</property>
<pattern>cast</pattern>
<defaultexpression>"You can't cast " + object.article +"."</defaultexpression>
</verb>
<verb>
<property>teach</property>
<pattern>teach</pattern>
<defaultexpression>"You can't teach " + object.article +"."</defaultexpression>
</verb>
<!-- Objects -->
<!-- Structure Objects -->
<object name="elemental_structure">
<normal_elemental type="list">fire; water; air; earth; light; dark; holy; unholy</normal_elemental>
<nemesis_elemental type="stringdictionary">fire = water;water = fire;air = earth;earth = air;light = dark;dark = light;holy = unholy;unholy = holy</nemesis_elemental>
</object>
<!-- Storage Objects -->
<object name="storage">
<inherit name="storage_type" />
<parent type="object">player</parent>
<!-- Spell Storage Objects -->
<object name="spell_storage">
<inherit name="storage_type" />
<parent type="object">storage</parent>
<object name="fire_storage">
<inherit name="storage_type" />
<parent type="object">spell_storage</parent>
</object>
<object name="water_storage">
<inherit name="storage_type" />
<parent type="object">spell_storage</parent>
</object>
<object name="air_storage">
<inherit name="storage_type" />
<parent type="object">spell_storage</parent>
</object>
<object name="earth_storage">
<inherit name="storage_type" />
<parent type="object">spell_storage</parent>
</object>
<object name="light_storage">
<inherit name="storage_type" />
<parent type="object">spell_storage</parent>
</object>
<object name="dark_storage">
<inherit name="storage_type" />
<parent type="object">spell_storage</parent>
</object>
<object name="holy_storage">
<inherit name="storage_type" />
<parent type="object">spell_storage</parent>
</object>
<object name="unholy_storage">
<inherit name="storage_type" />
<parent type="object">spell_storage</parent>
</object>
</object>
</object>
<!-- Types (Object Types) -->
<!-- Storage Types (Object Types) -->
<type name="storage_type">
<inherit name="container_closed" />
<drop type="boolean">false</drop>
<inventoryverbs type="list">Look; Open; Close</inventoryverbs>
</type>
<!-- Spell Types (Object Types) -->
<type name="spell">
<drop type="boolean">false</drop>
<mana_points_cost type="int">0</mana_points_cost>
<inventoryverbs type="list">Learn</inventoryverbs>
<displayverbs type="list">Learn</displayverbs>
<learn type="script">
result = get_elemental (this)
switch (result) {
case ("fire") {
if (not this.parent = fire_storage) {
this.parent = fire_storage
this.inventoryverbs = split ("Cast;Teach",";")
msg (DynamicTemplate ("Spell_Learned",this))
}
else {
msg ("[Spell_Already_Learned]")
}
}
case ("water") {
if (not this.parent = water_storage) {
this.parent = water_storage
this.inventoryverbs = split ("Cast;Teach",";")
msg (DynamicTemplate ("Spell_Learned",this))
}
else {
msg ("[Spell_Already_Learned]")
}
}
case ("air") {
if (not this.parent = air_storage) {
this.parent = air_storage
this.inventoryverbs = split ("Cast;Teach",";")
msg (DynamicTemplate ("Spell_Learned",this))
}
else {
msg ("[Spell_Already_Learned]")
}
}
case ("earth") {
if (not this.parent = earth_storage) {
this.parent = earth_storage
this.inventoryverbs = split ("Cast;Teach",";")
msg (DynamicTemplate ("Spell_Learned",this))
}
else {
msg ("[Spell_Already_Learned]")
}
}
case ("light") {
if (not this.parent = light_storage) {
this.parent = light_storage
this.inventoryverbs = split ("Cast;Teach",";")
msg (DynamicTemplate ("Spell_Learned",this))
}
else {
msg ("[Spell_Already_Learned]")
}
}
case ("dark") {
if (not this.parent = dark_storage) {
this.parent = dark_storage
this.inventoryverbs = split ("Cast;Teach",";")
msg (DynamicTemplate ("Spell_Learned",this))
}
else {
msg ("[Spell_Already_Learned]")
}
}
case ("holy") {
if (not this.parent = holy_storage) {
this.parent = holy_storage
this.inventoryverbs = split ("Cast;Teach",";")
msg (DynamicTemplate ("Spell_Learned",this))
}
else {
msg ("[Spell_Already_Learned]")
}
}
case ("unholy") {
if (not this.parent = unholy_storage) {
this.parent = unholy_storage
this.inventoryverbs = split ("Cast;Teach",";")
msg (DynamicTemplate ("Spell_Learned",this))
}
else {
msg ("[Spell_Already_Learned]")
}
}
}
</learn>
</type>
<type name="fire_elemental" />
<type name="water_elemental" />
<type name="air_elemental" />
<type name="earth_elemental" />
<type name="light_elemental" />
<type name="dark_elemental" />
<type name="holy_elemental" />
<type name="unholy_elemental" />
<!-- Functions -->
<function name="get_elemental" parameters="obj" type="string">
result = null
foreach (elem, elemental_structure.normal_elemental) {
type = elem + "_elemental"
if (DoesInherit (obj,type)) {
result = elem
}
}
return (result)
</function>
</library>
--------
P.S.
really the only code you're interested in for what you want to do, would be this (unless you can't work directly the inventory pane with the codings):
for what you want to do, it'll obviously be a bit different, and either with more or less complex coding, as you got to figure out how to code with the inventory display titles (if this can be done, I think it can anyways). so, this code below isn't too useful, except as a very loose coding method, and you've got other things you got to code in beyond just "Get_Whatever", hehe.
<function name="get_elemental" parameters="obj" type="string">
result = null
foreach (elem, elemental_structure.normal_elemental) {
type = elem + "_elemental"
if (DoesInherit (obj,type)) {
result = elem
}
}
return (result)
</function>
as I think you'll have to (in my noob attempt at guessing how to code it, lol):
need a way of "checking and getting" a list of the items in your inventory, so that you can then identify the "worm" items, and then figure out how to count them, and then substitute all of the worm items for: a single worm item with it's amount of them (or if you're going to have worms with different attributes, then multiple single worm items of those different worm types, and with it doing the same of removing them and adding in the right number onto the right single worm type name).
i.e.
player.inventory:
worm_type_1 (heals 25 HP)
worm_type_1 (heals 25 HP)
worm_type_2 (heals 50 HP)
worm_type_2 (heals 50 HP)
worm_type_2 (heals 50 HP)
worm_type_3 (heals 100 HP)
worm_type_3 (heals 100 HP)
worm_type_3 (heals 100 HP)
worm_type_3 (heals 100 HP)
~TO~
player.inventory:
worm_type_1 (x2)
worm_type_2 (x3)
worm_type_3 (x4)
then you got to code in when you eat a worm, to adjust the amount shown (and if you eat the last one, it then disappears from your inventory, lol)
clone45
22 Feb 2013, 04:36Thanks for your very detailed response. I need some time to digest that much code!
In the meantime, is there a way to display an object's attribute in the object's inventory display alias? I guessed and tried,
Bag of worms (#this.number_of_worms#)
But it just prints it out literally.
Cheers,
- B
In the meantime, is there a way to display an object's attribute in the object's inventory display alias? I guessed and tried,
Bag of worms (#this.number_of_worms#)
But it just prints it out literally.

Cheers,
- B
HegemonKhan
22 Feb 2013, 11:15See Pixie's Combat Library, Pertex' Combat Library, and~or Chase' Wearables Library, they all utilize equipment, and thus have the code for showing~displaying in the inventory, an example: adamantium_armor (equipped)
---------
from the wiki:
GetDisplayAlias ( object ) ( http://quest5.net/wiki/GetDisplayAlias )
Returns a string containing the displayed version of the object name. This will be the alias, if the object has one, otherwise it will just be the object name.
GetDisplayName ( object ) ( http://quest5.net/wiki/GetDisplayName )
Returns a string containing the full displayed name of an object. This will be the prefix + the result from GetDisplayAlias + the suffix
----------------
from a brief look at their libraries, it looks like you just set it, via these 1-3 methods:
1) object.display = GetDisplayAlias ( object )
2) object.alias = GetDisplayAlias ( object ) + "(string)"
-----
I didn't see this, and didn't look at their codes closely enough, so this may not be needed at all:
3) object.display = GetDisplayAlias ( object ) + "(string)"
-------------------
also, you'll have to use a function with a string return, to get just the number value to show up in the above codes.
so, maybe it'll look like this (this might be totally off, lol):
---------
from the wiki:
GetDisplayAlias ( object ) ( http://quest5.net/wiki/GetDisplayAlias )
Returns a string containing the displayed version of the object name. This will be the alias, if the object has one, otherwise it will just be the object name.
GetDisplayName ( object ) ( http://quest5.net/wiki/GetDisplayName )
Returns a string containing the full displayed name of an object. This will be the prefix + the result from GetDisplayAlias + the suffix
----------------
from a brief look at their libraries, it looks like you just set it, via these 1-3 methods:
1) object.display = GetDisplayAlias ( object )
2) object.alias = GetDisplayAlias ( object ) + "(string)"
-----
I didn't see this, and didn't look at their codes closely enough, so this may not be needed at all:
3) object.display = GetDisplayAlias ( object ) + "(string)"
-------------------
also, you'll have to use a function with a string return, to get just the number value to show up in the above codes.
so, maybe it'll look like this (this might be totally off, lol):
<function name="get_worm_value" parameters="object" type="string">
foreach (item, scopeinventory ()) {
if GetBoolean (object,"worm_type") {
if HasAttribute (object,"quantity") {
result = this.quantity
}
}
}
return (result)
</function>
<script>
object.alias = GetDisplayAlias ( object ) + "(get_worm_value ( object ) )" // or however you bloody get the syntax correct, lol
</script>
clone45
23 Feb 2013, 05:50Thanks! You pointed me in the right direction. I was thinking about how to do it using the editor, but setting the inventory name in the script made a lot of sense. Here's what I ended up doing:
Later, in the code, I just need to remember to set bag_of_worms.listalias anytime the worm count changes. I'll probably use the same technique for arrows.
Cheers,
- Bret
<start type="script">
bag_of_worms.listalias = "bag of worms (" + bag_of_worms.number_of_worms + ")"
</start>
Later, in the code, I just need to remember to set bag_of_worms.listalias anytime the worm count changes. I'll probably use the same technique for arrows.

Cheers,
- Bret
HegemonKhan
24 Feb 2013, 00:34haha... I was overthinking... lol... no need for the "get code", just simply do, "worms.quantity" (well, if you don't have different types of worms or of their attributes anyways)... doh! I hope that this over thinking of mine, isn't becoming a habit now of mine... ARGH!
----------------
ooo, you are working with arrows, hehe.
my plan (very slowly, due to learning to code lol, working on making an RPG like game as possible with quest):
have different object types assigned to bows and arrows, to create different types of bows and arrows:
> elemental (fire, water, earth, air, etc) object types on the arrows for elemental damage
> material (wood, steel, etc) object types on the bows and arrows for different amounts of physical damage or whatever else
> bow_types (short, long, hunter, battle, war, recurve, etc) object types on bows for different amounts of physical damage or whatever else
> by having these as object types, I can then make unique attributed bow objects as the objects themselves ( ' Chinghis_Bow '), while adding what object types I want to them, hehe.
> ooo, coding in a ' rate of fire ' will be needed to as an attribute, I guess: physical damage + elemental damage * rate of fire
set "arrows" as an "amount" int attribute on the characters (players + npcs)
though, this is a problem, as with all the different types of arrows... I can't have simply ' Arrows (X amount) ' displayed.
I might make a function to check what types of arrows, and return each arrow type with its amount, on a ' show bows and arrows ' command (+function) displaying it on the main pane, as I don't want to clutter up the status attribute pane (I plan to make a lot of these such ' show ??? ' commands (like equipment, stats, spells, and etc "screens"). Or, I could just make each type of arrow having its own attribute, though I'll probably still need to make some fuctions anyways to deal with increasing or lowering the amount, anyways, lol and meh.
Or... maybe I'll require you to equip what arrow you want, then I can have a single display (as it would be the amount of the arrow type that you have equipped, though this means more coding, which hopefully I can figure out, lol).
I'm also deciding whether I want you to equip an ' arrow case ' to hold X amount of arrows (and this ' arrow case's carry amount ' can be changed too, like maybe with a perk or whatever), or whether I should not have this as an object, and just use only as attributes instead, hmm...
Not sure what is the best Game Design + Quest Coding Design for achieving this... hmm...
------
I don't want obviously to have lots of objects or clones used, as I'm going to have enough objects as is, with all the different equipment choices of objects and etc, lol.
the more attributes the better, than using actual objects... but that means more coding~functions I'll have to create and work with.
----------------
ooo, you are working with arrows, hehe.
my plan (very slowly, due to learning to code lol, working on making an RPG like game as possible with quest):
have different object types assigned to bows and arrows, to create different types of bows and arrows:
> elemental (fire, water, earth, air, etc) object types on the arrows for elemental damage
> material (wood, steel, etc) object types on the bows and arrows for different amounts of physical damage or whatever else
> bow_types (short, long, hunter, battle, war, recurve, etc) object types on bows for different amounts of physical damage or whatever else
> by having these as object types, I can then make unique attributed bow objects as the objects themselves ( ' Chinghis_Bow '), while adding what object types I want to them, hehe.
> ooo, coding in a ' rate of fire ' will be needed to as an attribute, I guess: physical damage + elemental damage * rate of fire
set "arrows" as an "amount" int attribute on the characters (players + npcs)
though, this is a problem, as with all the different types of arrows... I can't have simply ' Arrows (X amount) ' displayed.
I might make a function to check what types of arrows, and return each arrow type with its amount, on a ' show bows and arrows ' command (+function) displaying it on the main pane, as I don't want to clutter up the status attribute pane (I plan to make a lot of these such ' show ??? ' commands (like equipment, stats, spells, and etc "screens"). Or, I could just make each type of arrow having its own attribute, though I'll probably still need to make some fuctions anyways to deal with increasing or lowering the amount, anyways, lol and meh.
Or... maybe I'll require you to equip what arrow you want, then I can have a single display (as it would be the amount of the arrow type that you have equipped, though this means more coding, which hopefully I can figure out, lol).
I'm also deciding whether I want you to equip an ' arrow case ' to hold X amount of arrows (and this ' arrow case's carry amount ' can be changed too, like maybe with a perk or whatever), or whether I should not have this as an object, and just use only as attributes instead, hmm...
Not sure what is the best Game Design + Quest Coding Design for achieving this... hmm...
------
I don't want obviously to have lots of objects or clones used, as I'm going to have enough objects as is, with all the different equipment choices of objects and etc, lol.
the more attributes the better, than using actual objects... but that means more coding~functions I'll have to create and work with.
clone45
24 Feb 2013, 02:47My bows aren't going to be as complex as yours. In fact, I might even simplify it further by allowing the player to "hunt" if they have a bow and if they're in a location that supports it. Maybe I won't even deal with arrows. Perhaps I should keep it simple for my first game.
What if you simply had magical bows instead of magical arrows? Like, "a bow of fire"?
Cheers,
- Bret
What if you simply had magical bows instead of magical arrows? Like, "a bow of fire"?
Cheers,
- Bret
HegemonKhan
24 Feb 2013, 16:50oh certainly, it could be far more simple, though for realism, it is the projectiles that do the damage, as you're not bashing someone on the head with your bow, lol. I think and hope that the extra complexity will make the ranged combat much more interesting and enjoyable, or at least the illusion of it, lol. Also, the different materials for the arrows can be used for with determining ' Piercing ', to add more realism and more complexity for the ranged combat. Also, I could have an equipment ' Breaking ' and ' Repair ' attributes too, by using different materials for the bows (and other equipment too). Etc Etc Etc. You got to make ranged combat unique, otherwise it's no different than melee combat, and no one likes doing ranged combat in name only, while it functions exactly as if you were using a melee weapon like a sword.
though, I'm just brainstorming too far ahead... lol. A very ambitious project, especially when I'm still just trying to learn the very basics of coding, hehe.
though, I'm just brainstorming too far ahead... lol. A very ambitious project, especially when I'm still just trying to learn the very basics of coding, hehe.
TriangleGames
24 Feb 2013, 17:17Actually, from table-top gaming, I would say the difference between enchanted bows vs arrows is that you can keep various arrows on hand for different purposes (I.e. fire arrows, ice arrows, holy arrows, etc.). In the case of a bow, it bestows the effect on any arrow used. So a "fire bow" would turn regular arrows into fire arrows, but it is less versatile. So you could still require a supply of regular arrows to go with it.
HegemonKhan
24 Feb 2013, 20:41that's true, maybe I will make only the bow have the elemental types, but that still leaves the material types for the arrows. It really doesn't matter though how you set it up, as you end up at the same place, just different styles on personal preference.
I just want both bow and arrows to have attributes for adding the damage and~or whatever other effects of the bow and arrow.
For my own personal taste only, hehe.
------------------
though... for the amusement of argument on this silly subject... hehe
an enchanted bow works fine for elemental effects, but you can't have an "enchanted bow" which turns wooden arrows into steel arrows... as this isn't even (well, hardly) heard of within fantasy, lol. At least I've never come across an "Alchemy Bow" !
I just want both bow and arrows to have attributes for adding the damage and~or whatever other effects of the bow and arrow.
For my own personal taste only, hehe.
------------------
though... for the amusement of argument on this silly subject... hehe
an enchanted bow works fine for elemental effects, but you can't have an "enchanted bow" which turns wooden arrows into steel arrows... as this isn't even (well, hardly) heard of within fantasy, lol. At least I've never come across an "Alchemy Bow" !
TriangleGames
24 Feb 2013, 21:01HegemonKhan wrote:an enchanted bow works fine for elemental effects, but you can't have an "enchanted bow" which turns wooden arrows into steel arrows... as this isn't even (well, hardly) heard of within fantasy, lol. At least I've never come across an "Alchemy Bow" !
Every DM ever says, "That's a FANTASTIC idea! I can't wait to see the look on my players' faces when they watch a guy pull a normal wooden arrow and then get their shield shattered by an adamantium arrow! WOOHOO!!!"