Re: Ocean 23

Vega
Hey All,

I'm working on a text-based adventure game. My game is a resource gathering game.

I've just begun to read all the documentation. I do not know any Javascript, I am learning some basic Python atm.

My map is an ocean (5x5 tiles of rooms), and the character is a boat; which moves from tile to tile to catch fish.

The fish need to swim from room to room. The boat will find the fish throughout the map, and use another object to catch them (harpoon, net, rod).

How can I make the fish?

Can anyone explain it?

Or direct me to a specific tutorial?

I've tried using the UI script options and I cannot find any options that will create a group of fish, and have them move around, and have them be caught in some numbers by the boat (player).

Thanks

ps. Here are some pics
3.png

HegemonKhan
I'd look into the 4 Randomization Functions (for moving your Objects~fish room to room), and also maybe Jay's (Jaynabonne's) Map~Grid generation too:

the general (very basic) idea is to use the special 'changed' Script (with the 'parent' Object Attribute of the 'player' Player Object) and a Randomization Function for its scripting, to randomly move~set the 'fishX' Objects to different rooms each time the 'player' Player Object moves to a different room.

-------

quest's structure is similar to Python's, but quest's scripting is more similar to C++ and/or Java, but it shouldn't be too hard to pick it up, if you're decent at coding with Python, and even if you're not good with Python's scripting, it's still pretty "easy" to pick up. And the "physically existing things" in quest's code, use XML, which is at least somewhat akin to HTML (web languages).

for example:

XML: the "physically existing things" in quest's code: what I call the "creation" tag lines~blocks:

notice the tag usage:

horizontal tag code lines:

<xxx>xxx</xxx>' or '<xxx />'

vertical tag code blocks:

<xxx>
// xxx
</xxx>

<asl version="550">
// your entire game code~contents must go between~inside of the 'asl' creation tag block.
</asl>

// ------------

<asl version="550">

<include ref="English.aslx" /> // default library file added~included, to create the quest engine
<include ref="Core.aslx" /> // default library file (actually this is a collection of lots of "Core" files) added~included, to create the quest engine
// you can create your own library files (simple extra code such as a single Object, to an entire game engine), to add~include them into your games
// or you can use other's publically available library files

<game name="blah">
// the 'game' Game Object, is a special Object, which holds game-wide and unique settings and etc-like stuff. This corresponds to the 'game' Game Object in the GUI~Editor's left side's "tree of stuff (Elements)" and its various Attributes~settings~options in its various Tabs (on the right side).
</game>

<Object name="blah">
// contents (Attributes and~or other Objects. The Script Attributes are the same as the GUI~Editor's Verbs)
</object>

<function name="blah">
// contents: scriptings (scripts, in the GUI~Editor: Functions -> Add -> add new script -> etc)
</function>

<command name="blah">
// contents: Attributes and scriptings
</command>

<turnscript name="blah">
// contents: Attributes and scriptings
</turnscript>

<type name="blah">

</type>

// etc etc etc Elements

</asl>

// ----------------------

// Attributes:

<attr name="blah1" type="blah2">blah3</attr>

Attribute Types (blah2): int (integer), string, double (decimal number), boolean (true/false), script, object, lists, dictionaries, etc

Attribute Value (blah3): whatever, but depends upon Attribute Type, of course

// ----------------

<object name="player">
<attr name="alias" type="string">HK</attr>
<attr name="species" type="string">human</attr>
<attr name="race" type="string">european</attr>
<attr name="class" type="string">warrior</attr>
<attr name="strength" type="int">100</attr>
<attr name="endurance" type="int">100</attr>
<attr name="right_hand" type="object">sword</attr>
<attr name="left_hand" type="object">shield</attr>
<attr name="condition" type="simplestringlist">normal;alive</attr>
<attr name="locomotion" type="simplestringlist">bipedal</attr>
<attr name="action_state" type="simplestringlist">sitting;typing</attr>
<attr name="undead" type="boolean">false</attr>
</object>

<object name="sword">
</object>

<object name="shield">
</object>



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

quest has 3 Types of VARIABLES:

VARIABLES:
-> Variables: local VARIABLES (can only be used within where they exist), no "attachment" (dot~period) to Objects. Example: strength = 100
-> Attributes: global VARIABLES (so long as the Object exists, of course. Can be used anwhere. Example: player.strength = 100)
-> Parameters: variables used with Functions, Commands, and etc Elements~stuff.

----------

and the scripting is pretty simple:

(notice the LACK of the tags)

Use Attributes as your VARIABLES, as Attributes are global VARIABLES, you can use them anywhere, so long as the Object that holds them exists, of course, as Attributes are the basis for your scripting:

Object_name.Attribute_name = Value_or_Expression

examples:

player.alias = "HK"
orc.alias = "gorak"
player.strength = 100
player.strength = 0
player.strength = player.strength + 5
player.undead = false
player.undead = true
player.right_hand = sword
player.parent = room_1
player.parent = room_9
town.population = 3000
game.state = 0
game.state = 1
game.state = "0"
player.state = "1"

player.condition = split ("poisoned;petrified", ";")
list remove (player.condition, "poisoned")
list remove (player.condition, "petrified")
list add (player.condition, "normal")

player.damage = (player.sword.damage + player.sword.damage * player.strength / 100) - (orc.cuirass.resistance + orc.cuirass.resistance * orc.endurance / 100)

// an 'orc' Object's 'fight' Verb's scripting, for simple quick incomplete example

if (orc.dead = false)
{
orc.current_life = orc.current_life - player.damage
msg ("You attack and damage the orc.")

if (orc.current_life <= 0)
{
orc.dead = true
msg ("You killed the orc.")
}
else
{
player.current_life = player.current_life - orc.damage
msg ("The orc attacks and damages you.")

if (player.current_life <= 0)
{
msg ("You were killed by the orc.")
msg ("GAME OVER")
finish
}
}
}
else
{
msg ("The orc is already dead, silly.")
}


---------

if you need the links (if you can't find to what I'm refering to above), let me know.

The Pixie
Vega wrote:I'm working on a text-based adventure game. My game is a resource gathering game.

I've just begun to read all the documentation. I do not know any Javascript, I am learning some basic Python atm.

My map is an ocean (5x5 tiles of rooms), and the character is a boat; which moves from tile to tile to catch fish.

The fish need to swim from room to room. The boat will find the fish throughout the map, and use another object to catch them (harpoon, net, rod).

How can I make the fish?

Can anyone explain it?

Or direct me to a specific tutorial?

I've tried using the UI script options and I cannot find any options that will create a group of fish, and have them move around, and have them be caught in some numbers by the boat (player).

I am not aware of anyone doing anything like this so well done on the originality, but do not expect to find any tutorials covering it.

With regards to the fish moving, I would use the ScopeExitsForRoom to get a list of exits, pick one at random, and move them.
exits = ScopeExitsForRoom(fish.parent)
index = GetRandomInt(0, ListCount(exits) - 1)
exit = ObjectListItem(exits, index)
fish.parent = exit.to


If you want to display the fish on a map of the ocean, that is a rather bigger problem, which depends on what you want to see and how good your JavaScript and CSS are. I would have two images, one for the map, one for the fish, and change the position of the fish image. This might get you started:

viewtopic.php?f=18&t=5566#p38372

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

Support

Forums