Making a party

clockworkdragon
Another day, another problem.

This is probably going to be the last question I ask for the time being until I get the other question's I asked in other posts hammered out, less I take on too much coding at once.

Question:

I've been going through the forums but haven't found much on the way of Creating a Party. How does one create a party to follow your hero from room to room, engage in combat, or take orders?

HegemonKhan
here's the very beginnings of what you want:

do you want your 'party' to just be carried objects (like in early computer rpgs like might and magic, with their party portraits, and action turns) or do you want your 'party' to be actual Player Characters (which you can either switch to controlling... or if we can get a good coder to do~help us, intelligent AI independent characters who'll follow us around and act on own, not graphically~'physically' walking around in a 3d world though obviously... laughs. Yes, quest can do this... we just need a master coder, laughs).

(adding functionality, obviously requires much more complex+extra coding then the below)

Sgreig's Follower~Following Code:

(a quick sample example)

<object name="room">
</object>

<object name="player">
<parent>room</parent>
<attr name="changedparent" type="script">
if (not team_member_2.parent = player.parent) {
team_member_2.parent = player.parent
}
</attr>
</object>

<object name="room_2">
<object name="team_member_2">
<parent>room_2</parent>
</object>
</object>


OR

<object name="room">
</object>

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

<object name="room_2">
<object name="team_member_2">
<parent>room_2</parent>
</object>
</object>

<turnscript name="global_party_following_turnscript">
<enabled>
<script>
if (not team_member_2.parent = player.parent) {
team_member_2.parent = player.parent
}
</script>
</turnscript>


--------

if you can get~understand this (ask if you need help or got questions), then we'll move onto some more needed stuff (Clockworkdragon: engage in combat, or take orders?).

The Pixie
Where I would start is to set up copnversions that include a follow me/stop following option.

Then modify the GO command to check if any object is flagged as following (use the GetBoolean function, as most objects will not have the attribute at all), and if it is, to move it to the new room, and print a message about it following you.

Then look at what else you want them to do.

clockworkdragon
I was aiming for the third option, npcs following the character about from room to room. I do like the simplicity of just putting them in your inventory though...

Reguardless. The idea is the npcs can be hired or join due to story missions. They can be ordered to use skills, given items to carry and use, and make witty banter for the sole purpose of ripping the players heart out when the npc suffers perma death.

Yes i am evil like that.

Lets just focus in on following and combat. I will try to mess with the coding tomarrow.

Also! I have a rough idea on how i plan to run combat. At the begining of each battle player, freindlies and enemies roll to see who goes first.

To attack the character rolls a 20 sided die against the enemy agility stat. If successfull the enemy then rolls their defence against the attack.

Eventually i want to expand this into a 'select random body part' option that first sees if the player has any armor there to roll against which limits the dmg taken or deflects it completely.

The pros with armor are the obvious protection but wearing armor, gaining weight, using heavy weapons etc etc lowers your agility, making it easier to get hit.

But like i said firsr things firsr. I would like to just get the basics working first :)

Silver
with respect to your enthusiasm, my only advice would be to not be overly ambitious otherwise you'll get fatigued before you finish writing it.

clockworkdragon
Oh I know that to be true XD

Im actually switching between making to seperate games, when i get fruetrated at the code and ready to hurl a keyboard at the computer i switch to the other.

Im actually making progress little by little on each.

Both of them use simular mechanics though XD

Silver
Like Jay said about a similar point in another thread, as long as you're having fun and learning as you go along then it's all good. I'm wanting to give a bit of agency in my games rather than a linear story with various roadblocks for the player to overcome but even the small amount I'm doing to that effect is adding a massive workload to a game that might end up being crap. I couldn't begin to fathom having different characters to deal with in every given situation on top of that. And you spoke earlier about having a large game map. Bethesda can do it because they have the budget to employ the army needed to do that. Just sayin'. ;)

clockworkdragon
Ok, so after some experimentation I think I am on the right path. Here is a simple follow script.

if (GetBoolean(Zeak, "follow")) {
if (not ListContains(ScopeVisible(), Zeak)) {
MoveObjectHere (Zeak)
}
}

Zeak is the name of the companion that follows you. Basically I set up a simple verb command that flags Zeak with 'follow''. Which is not shown here because that is fairly strait forward and simple.

What IS shown here is an 'if/then' statement that sees if zeak is flagged with follow. This is (no pun intended) followed by an if/then script asking if zeak is not visible. If Zeak is not viable the game then moves him to the room the player is in.

My next question is, is it possible to move ALL objects flagged with follow at once? Provided they are not dead >.> but one problem at a time.

clockworkdragon
If that doesn't work I just figured out a simple work around.

I made an object named 'party' By asking or telling characters to follow it puts them into the object Party. Following the simple code above the party will then follow you where ever you go until you tell it to stop.

My next problem would be making an 'order' command or verb to tell the party to either follow, attack, stay, do a chicken dance etc etc. and having all the members in the party either attack, heal, etc etc when the party is given the order.

But I think that might be best served in a separate forum post.

In the mean time, WOO! Thanks for everyone's help!

jdpjdpjdp
You can eliminate the need to check ScopeVisible if you add it as an if statement at the end of the OnEnterRoom function (don't know your level of knowledge with code and/or the program, so if you need help finding that just ask). Then as long as Zeak has the flag on, he'll change rooms whenever you do, and the simple act of changing rooms will trigger it. All you need is this:

if (GetBoolean(Zeak, "follow")) {
MoveObjectHere (Zeak)
}


Got more characters you want to follow? Just add another if statement identical to that, also in OnEnterRoom, and swap out the names. You put an if statement there for every character that CAN follow in the game, and then all you need to do is set or unset the flag on any given character to make them start/stop following you. It's better than your workaround because it makes it easier to add or subtract individual members from the party just by setting/unsetting their individual flag.

clockworkdragon
This was my actually my original idea. The original adds a script to see if the character is still alive, and it is indeed much simpler, and possibly cleaner code.

The only problem I had with that is if I chose to add quite a few possible characters, or enemies that follow you, it would get cluttered really quickly.

But then again coding is not my specialty, I know enough from web design to follow it but I'm still learning it.

If there is a cleaner and more efficient way of making a character follow you then by all means :3

jdpjdpjdp
Your idea to lump them into a common object could also be accomplished by lumping them in an objectlist, then using a turn script that would check it and move anything/anyone on it to the current room if they're not there already. Adding/removing from the party would be done by simply adding/removing from the list. I (or someone) can explain further if you're interested.

HegemonKhan
you're delving into list + 'foreach', territory now, so if you're ready:

http://docs.textadventures.co.uk/quest/ ( under 'documentation' in the text box below, you can type in these words*, or any words, to search for documentation )
http://docs.textadventures.co.uk/quest/ ... tions.html (alphabetical order)
http://docs.textadventures.co.uk/quest/ ... lists.html

* foreach, for, using lists, Gets, Alls, Scopes, and etc.

an example:

game.party_objectlist = NewObjectList ()
list add (game.party_objectlist, member_1)
list add (game.party_objectlist, member_2)
list add (game.party_objectlist, member_3)

foreach (party_member_x, game.party_objectlist) {
if (not party_member_x.parent = player.parent) {
party_member_x.parent = player.parent
}
}


or

foreach (object_x, AllObjects () ) {
if (GetBoolean (object_x, "follow") ) {
if (not object_x.parent = player.parent) {
object_x.parent = player.parent
}
}
}


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

P.S.

when I got time (my days off from work: Sat, Mon), I'll make a playable game for you of this stuff you want, which you can use to study (you can see how its done in both code and via the GUI~Editor, along with being able to play~test it).

clockworkdragon
Lol! Thanks for the help. You dont need to go to that much trouble for me though. This was helpfull already. I didnt even think of using a list. Ill try it out experiment with it.

HegemonKhan
you need to group (via sharing something in common) your party members:

sharing something in common:

an Attribute (Boolean:same_value = true ~ or false too ~ depending on the scenario~situation~goal of what you're trying to do lol, String:same_value, Integer:same_value, Inherited:same_type, etc)

grouping:

in same List, in same Room (by the way, creative thinking of using a room for grouping, it's more functional than a mere list, but lists are probably better to use in this case), same Object Type, etc

clockworkdragon
I'm experimenting with using a list to do this. Admittedly tossing all party members into an transparent container is easier but this way seems much more... cleaner? Code wise I mean, and it allows me to have enemies follow the player as well.

I have to ask though, where did you find the 'foreach' command?

EDIT:

Just found it actually in variables.

clockworkdragon
Ok, so after working on this for a while there is one part I am still confused about.

For example, in this code below on the 'foreach (party_member_x,) what exactly goes there?

foreach (party_member_x, game.party_objectlist) {
if (not party_member_x.parent = player.parent) {
party_member_x.parent = player.parent
}
}

Is that were i put the follow variable or flag or object and...how would you word that?

HegemonKhan
foreach (some_placeholder_temporary_variable_for_representing_each_thing_in_your_list_one_at_a_time_in_iteration, Object_name.List_name) {
if (GetBoolean (place_holder_variable_for_short, "follow_or_whatever_you_labeled_it_as") ) {
// conceptually: GetBoolean: if the Object HAS the Boolean Attribute, and then if yes, then if the Boolean Attribute's Value is true, then do...
// conceptually: list = HK, Marzipan, legolas, aragorn, gandalf, gimli
// conceptually: placeholder_variable = first HK, then Marzipan, then legolas, then aragorn, then gandalf, then lastly gimli
// conceptually: if (HK.follow = true), then do the below
// conceptually: if (Marzipan.follow = true), then do the below
// conceptually: if (legolas.follow = true), then do the below
// conceptually: if (aragorn.follow = true), then do the below
// conceptually: if (gandalf.follow = true), then do the below
// conceptually: if (gimli.follow = true), then do the below
if (not placeholder_variable.parent = player.parent) {
// conceptually: if (HK, then Marz, then etc) is not in the same room (aka have the same 'parent', which is the same as using 'MoveObject~Here' in the GUI~Editor) as the 'player' Player Object (or whoever is your main character), then do the below
// HK.parent = earth
// Marzipan.parent = earth
// wallet.parent = pants_with_a_pocket
// pants_with_a_pocket.parent = HK
// $1 bill.parent = wallet
// earth.parent = the sun's solar system
// sun.parent = milkyway galaxy
placeholder_variable.parent = player.parent
// conceptually: you move~set the (HK, then Marz, then etc) as being in the same room as the 'player'
}
}
}


if this confused you more, let me know, as I tried to explain it (which may not be a good explanation), and I'll try again, hehe :D

I can just give an example, and you'd just need to switch out my labels used with your own, obviously for it to work for you (as code requires it, hehe):

I use 'K' just to show that it's merely a placeholder temporary variable name string (label it as whatever you want), which (via the 'foreach' function) will GET~BECOME~REPRESENT (done automatically by quest ~ the 'foreach' Function, hidden from you) each of your things in your list.

game.party = split ("HK;Marz", ";")

player.parent = room
HK.parent = room2
Marz.parent = room3

foreach (K, game.party) {
if (GetBoolean (K, "follow") ) {
if (not K.parent = player.parent) {
K.parent = player.parent
// 'HK' is moved to 'room'
// 'Marz' is move to 'room'
}
}
}


or, just to show this:

game.party = split ("player;HK;Marz", ";")

player.parent = room
HK.parent = room2
Marz.parent = room3

foreach (K, game.party) {
if (GetBoolean (K, "follow") ) {
if (not K.parent = player.parent) {
K.parent = player.parent
// 'player' is NOT moved to 'room', because the 'player' is already in 'room', which is why I have this 'if not' check code line in there (why move or re-set an Object that is already in the correct Room, into that Room? not that your computer processor+quest cares about this extra work, but for your brain's code-logic training, it is good to do, hehe
// 'HK' is moved to 'room'
// 'Marz' is move to 'room'
}
}
}


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

what the 'foreach' Function is doing (hidden from you), just an example:

list = red, blue, yellow

foreach (x,list) {
-> if (x.name = "red") {
->-> msg ("Yes, red is red")
-> } else {
->-> msg ("this color is not red")
-> }
}

what it does automaticaly, hidden from you:

first:
x = red
if (x.name = "red") {
-> msg ("Yes, red is red")
} else {
-> msg ("this color is not red")
}

then:
x = blue
if (x.name = "red") {
-> msg ("Yes, red is red")
} else {
-> msg ("this color is not red")
}

lastly:
x = yellow
if (x.name = "red") {
-> msg ("Yes, red is red")
} else {
-> msg ("this color is not red")

clockworkdragon
I think my brain is leaking now... o.o

That helps...but I don't think I have grasped the solution quite yet or at the very least not quite understanding XD I am familier with coding enough to get by but i am still a novice at it.

I get the idea behind parenting the objects. If they are not with the player parent then I move them to current room. That can just as easily be accomplished by asking if the object is visible or not visible.

Now the simplest way would be to make a script that asks if each party member is active first, then ask if they are visible, if not the party is then moved to the current room.

That would be some rather very serious bloat code though XD

Do you know of a way to pull all objects with a certain flag into the same room with out running a long list of if/then statements for each and every npc? Even if they are in a list?

instead of tackling the problem all at once would it be ok to focus on one part of the problem first XD

Like this code down here for example.

game.party_members = NewObjectList()
list add (game.party_members, Bob)
list add (game.party_members, Jill)

foreach (I_NEED_HELP_WITH_THIS_PART, AllObjects()) {
msg ("ENTER NEEDED IF THEN STATEMENTS HERE.")
}

how would i word the variable in the 'foreach' statement to...well, do what I need it to do XD

Also thank you so much for all your help :D If you need help with something in return let me know and I'll see what I can do XD

HegemonKhan
Clockworkdragon wrote:do you know of a way to pull all objects with a certain flag into the same room with out running a long list of if/then statements for each and every npc? Even if they are in a list?


the lazy method:

AllObjects ()
http://docs.textadventures.co.uk/quest/ ... jects.html

this is an object list of the entire game's objects, hence its the 'lazy' method, laughs

then, we just need to determine what objects we want to pick from that 'Omni-list', lol: via using Attributes ('follow', 'visable', etc):

foreach (K, AllObjects () ) {
if (GetBoolean (K, "follow") ) {
if (K.visible = false) {
K.parent = player.parent
}
}
}


I didn't read the rest of your post, so ignore the above, as you already know of 'AllObjects ()', hehe

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

using what you got (your labels and format):

if you're going to create your own list, then you don't need the OMNI-List (List of ALL OBJECTS IN THE GAME): AllObjects ()

if you're lazy, not creating your own list, then just use the OMNI-List: AllObjects ()

you can change 'X' with whatever label that you want (it's just a placeholder variable for the 'foreach' Function's functionality), call it whatever you want:

item, K, team_member, team_member_x, 7, item_x, object_x, obj, supercaliforniafabulistic_gosh_I'm_dating_myself_lol, etc etc etc

in algebra:

(Algebraic Substitution is the basis of coding)

X + 8 = 10
X = 10 - 8
X = 2

well we can do the reverse:

X = 2

X + 8 = ???
2 + 8 = 10

our X is just a placeholder for '2'

well with the 'foreach' Function, our 'X' (or whatever you want to use) is a placeholder for multiple inputs that will be used by the 'foreach' Function:

X = 1, 2, 3, 4, 5
X + 8 = ???

first:
X = 1
X + 8 = 9

next:
X = 2
X + 8 = 10

then:
X = 3
X + 8 = 11

then:
X = 4
X + 8 = 12

then:
X = 5
X + 8 = 13

game.party_members = NewObjectList()
list add (game.party_members, Bob)
list add (game.party_members, Jill)

foreach (X, game.party_members) {
if (GetBoolean (X, "follow") ) {
if (X.visible = false) ) {
X.parent = player.parent
msg (X.alias + " follows " + player.alias + " to the next area.")
} else {
msg (X.alias + " is already in the same area as " + player.alias + ".")
}
} else {
msg (X.alias + " stays where " + X.gender~article~meh~whichever_it_is + " is, not following " + player.alias + ".")
}
}


OR (I personally like to be descriptive with my labels so I know what I'm doing~reading directly with looking at my code):

game.party_members = NewObjectList()
list add (game.party_members, Bob)
list add (game.party_members, Jill)

foreach (party_member, game.party_members) {
if (GetBoolean (party_member, "follow") ) {
if (party_member.visible = false) ) {
party_member.parent = player.parent
msg (party_member.alias + " follows " + player.alias + " to the next area.")
} else {
msg (party_member.alias + " is already in the same area as " + player.alias + ".")
}
} else {
msg (party_member.alias + " stays where " + party_member.gender~article~meh~whichever_it_is + " is, not following " + player.alias + ".")
}
}


I personally like to add the '_x' to distingish it as the placeholder variable, and to separate it from built-in terms, such as 'object', by using: 'object_x'

A lot of the good coders here, like using: 'obj' as their placeholder in the 'foreach' Function's (or if~when dealing with parameters in functions) label

I also use '_AttributeType' to seperate Attributes as well (and for me to know what Attribute it is, lol):

player.strength_integer = 100
player.strength_string = "strong"

but, this is just my own labeling system

lastly, I use 'label', instead of 'name', so not to cause confusion with the built in quest String Attribute of 'name' (quest's ID Attribute) vs our general usage of 'naming' things = my use of 'labeling~label' when I write my explanation posts.

clockworkdragon
Oh! I think I see what you mean. If i am not wrong it's related to blocking in an odd sort of way.

This is sort of a way to help organize the code and keep it from becoming horrible disorganized and a night mare to wade through. I see other possibilities for this as well.

I need to experiment with this a little.

Thanks for the help!

HegemonKhan
develop your own labeling system though as quickly as you can, as its really annoying if you don't, lol (it's not fun having to go back and re-label all your old~worse labeled coding, with your new~better code labeling, lol).

as you (anyone) tries to work with code for their first time, this is something that you learn fast: you need a labeling (organizational) system~convention

amongst real coders, they got standardized labeling systems~conventions, but I'm only a noob to coding, so I got my own, ya it's a lot more character length, but I know exactly what is going on with~in every code line, as I'm so descriptive, which helps me with crafting, writing, reading, and troubleshooting code.

------

for me personally, I would not use:

foreach (team_member, game.team_members) {

because, I'd so easily mess up on whether my variable is suppose to have the 's' at the end or not, lol. By adding my '_x', it enables my old eyes and old brain to notice '_x' vs no '_x', laughs, so...

I'd use this:

foreach (team_member_x, game.team_member) {

I leave off the 's' entirely, as just using plural is a pain to remember, whether the Attribute's name is plural or not... lol

I love underscores too, as you might have noticed, lol.

clockworkdragon
I noticed XD

Now I am just trying to figure out why the script keeps pulling objects for when they are NOT part of the list.

clockworkdragon
EDIT: Ok so I am still having problems with non list members following the player XD code highlighted in red was omitted

game.party_members = NewObjectList()
list add (game.party_members, Bob)
list add (game.party_members, Jill)
SetObjectFlagOn (Bob, "follow")

foreach (follow, game.party_members) {
if (GetBoolean(Bob, "follow")) {
MoveObjectHere (Bob)
msg ("Bob has arived.")
}
if (GetBoolean(Jill, "follow")) {
MoveObjectHere (Jill)
msg ("Jill has arived.")
}

jdpjdpjdp
You're doing, just... WAY more work than you need to. Here:

clockworkdragon wrote:game.party_members = NewObjectList()
list add (game.party_members, Bob)
list add (game.party_members, Jill)
SetObjectFlagOn (Bob, "follow")


That part is fine. This part is not:

foreach (follow, game.party_members) {
if (GetBoolean(Bob, "follow")) {
MoveObjectHere (Bob)
msg ("Bob has arived.")
}
if (GetBoolean(Jill, "follow")) {
MoveObjectHere (Jill)
msg ("Jill has arived.")
}
}



In that first line, it shouldn't say (follow, game.party_members). The first parameter should be 'object' (without the quotes). Also, the entire point of a foreach is that you set it to do the same action to everything on the list; you don't need to check it against each member. Try this:

foreach (object, game.party_members) {
if (GetBoolean(object, "follow")) {
MoveObjectHere (object)
msg (" " + object.alias + " has arrived.")
}
}


What that code says is, for each object in the list game.party_members, we check for the flag "follow". It it's there, we print the message specifying each name, and move them to the current room. If you try it again with this, but leaving the first part as is, Bob should follow (with a message saying as much), while Jill, who doesn't have the flag, won't go anywhere.

HegemonKhan
you almost got it clockworkdragon, just still some slight misunderstandings though (due to me being a bad helper, you're getting this very quickly, I'm jealous, hehe)!

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

you're possibly having issues due to using 'follow' for both your Boolean Attribute's Name and for your 'foreach' Function's placeholder variable label (you may be over-writing your 'follow' Boolean Attribute with your 'foreach' Function's 'follow' placeholder variable, and you also need to KEEP (USING) your placeholder variable's label:

I switched your 'follow' placeholder variable to 'item' (but you can use whatever you want, if you don't like 'item', just don't use 'follow' though, and for the same reason, I wouldn't use 'object' either, if you like 'object', than use 'obj' instead as many people do)

the edited fixing of your code:

( if you never gave~set your Objects' 'aliases' )

game.party_members = NewObjectList()
list add (game.party_members, Bob)
list add (game.party_members, Jill)
SetObjectFlagOn (Bob, "follow")

foreach (item, game.party_members) {
if (GetBoolean(item, "follow")) {
MoveObjectHere (item)
msg (item.name + " has arived.")
}
}


or

( if you gave~set your Objects' 'aliases' )

game.party_members = NewObjectList()
list add (game.party_members, Bob)
list add (game.party_members, Jill)
SetObjectFlagOn (Bob, "follow")

foreach (item, game.party_members) {
if (GetBoolean(item, "follow")) {
MoveObjectHere (item)
msg (item.alias + " has arived.")
}
}


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

we'll get into how to do the dynamic msg'ing that I'm doing above, it's confusing unless you know the 'trick' to doing them.

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

@jpjpjpj's post:

you don't have to use the label of 'object' for your placeholder variable in the 'foreach' Function, you can use whatever label that you want (though make sure it is unique: do NOT use 'follow' for it, as 'follow' is your Boolean Attribute, so there's no over-write conflict issues, and make sure you use it in the rest of your scripting within the 'foreach' Function block of code)

jdpjdpjdp
HegemonKhan wrote:@jpjpjpj's post:

you don't have to use the label of 'object' for your placeholder variable in the 'foreach' Function, you can use whatever label that you want


Oh, I know. I tend to stick to basic ones like object, obj, item (as in your example), just so I remember if I'm doing objects or strings, and so I avoid conflicting variable names like clockwork seems to have fallen into here.

As an aside, I feel proud that we posted basically identical code! I remember not very long ago when I didn't even know what "foreach" was even for. :lol:

HegemonKhan
same with me, I like being descriptive (knowing what variables I'm working with), but I'm more leery of over-writing already existing things, as I don't fully understand the workings of coding.

being descriptive helps especially if you're doing multiple (chain) foreach's, so you know what variable is what variable... hehe :D
or, if its the same type of variable... then I just add more x's, hehe:

item_x
item_xx
item_xxx
object_x
object_xx
object_xxx
player_x
player_xx
player_xxx
room_x
room_xx
room_xxx
etc etc etc

so I don't use 'object' as that's used by quest's built-in underlying code (and I don't like abrevs, like 'obj' or 'attr' or 'int' ~ these annoy me! ~ I know I can change this but the underlying code is still too advanced for me, lol ... I found that, using abrevs, out when I did my first combat code... lol. I couldn't even figure out ~ nor remember, what my abrevs stood for, laughs. I now write out everything, no abrevs, laughs)

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

@clockworkdragon:

in algebra, if we want to keep:

X = 7

then, we don't overwrite it by doing this:

X = 4

as now, X is no longer 7, it is now 4

instead, we use a different (a unique) variable, such as:

Y = 4

leaving

X = 7

such as for this math function:

X + Y = ??
X + Y = 11

because if we didn't use 'Y', having used X again, we'd have:

X + X = ??
4 + 4 = 8

as you can see, we don't even have:

7 + 7 = 14

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

in coding~programming, just like in real life and with people, computers need an 'ID' Attribute to identify that thing as that thing. And for quest, that ID Attribute is the 'name' String Attribute.

let's pretend my name is 'John'

is this my ID Attribute?

no, many people can share the name of 'John'

well, in quest, the default Attribute of this NON-ID (quest doesn't care at all about it), is the 'alias' String Attribute.

so, what in real life, with people (well any organism actually), is our ID Attribute?

DNA

the DNA of quest is its: 'name' String Attribute

no two things can have the same 'name' String Attribute, the 'name' String Atribute MUST be unique.

the default Player Object's 'name' String Attribute: player
the 'player' Player Object's 'alias' String Attribute, for example: HK

same with Attributes:

(Object's 'name' String Attribute: player)
Attribute's 'name' String Attribute: strength
Attribute's Type: int (integer)
Attribute's Value: 100

-----

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

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

ERROR!!!!

-----

<object name="playerA"
-> <alias>HK</alias>
</object>

<object name="playerB"
-> <alias>HK</alias>
</object>

NO error.

-----

<attr name="strength" type="int">100</attr>

<attr name="strength" type="string">strong</attr>

ERROR!!

-----

<attr name="strength_integer" type="int">100</attr>

<attr name="strength_string" type="string">strong</attr>

NO error

------

<verb name="fight">
</verb>

<command name="fight">
</command>

ERROR!!

-----

<verb name="fight_verb">
</verb>

<command name="fight_command">
</command>

NO error

The Pixie
game.party_members = NewObjectList()
list add (game.party_members, Bob)
list add (game.party_members, Jill)
SetObjectFlagOn (Bob, "follow")

Are you having a list of potential party members, and then flagging the ones that are following? I.e., Bob and Jill are both objects that might follow, but only Bob is at the moment?

Why not just keep a list of objects in the party, and do away with the follow attribute altogether? Add objects to the list when the follow, remove them when they stop.

HegemonKhan wrote:

"Clockworkdragon"

do you know of a way to pull all objects with a certain flag into the same room with out running a long list of if/then statements for each and every npc? Even if they are in a list?



the lazy method:

AllObjects ()
http://docs.textadventures.co.uk/quest/ ... jects.html

this is an object list of the entire game's objects, hence its the 'lazy' method, laughs


An advantage of AllObjects is that it will check all the objects in the game, so if something went wrong when the player moved into the last room and some followers got left behind, they will still get picked up when the player moves into the next room.

A disadvantage is that it might be slow if you have a huge number of objects. I would guess that that is not an issue (the vast majority you just check an attribute and move on to the next; modern system should be able to cope with that).

Sometimes the lazy way is also the best way.

jdpjdpjdp
The Pixie wrote:Are you having a list of potential party members, and then flagging the ones that are following? I.e., Bob and Jill are both objects that might follow, but only Bob is at the moment?

Why not just keep a list of objects in the party, and do away with the follow attribute altogether? Add objects to the list when the follow, remove them when they stop.


Thank you! I suggested that like a week ago, and then the conversation went another way... started to make me worry I'd totally missed the point of lists...

HegemonKhan
clockworkdragon is going with using Booleans ('follow') at the moment, so I just went with that, as clockworkdragon is still new and learning, he~she has the grasp of flags (on~off; Booleans), but I think that lists are new for him~her and a big step up for new people to understand, that are not easy things to grasp: iteration of lists via 'foreach', and all the other stuff you can do with lists too, takes a bit of time to learn. So, I just helped with the structure that he~she presented to us. And using Attributes with lists is certainly something that is valuable, you don't want to always create individual lists for everything... sometimes you want fewer lists, using Attributes to select the items from those few lists, instead of having lots of individual lists of already the items that you want selected. It took me a long time to learn lists too.

The Pixie
Using attributes is fine - that is how I would do it. The code I saw seemed to be using attributes AND a list too. Either way will work, but you only need one.

clockworkdragon
Ah...ok. I'm afraid I have not had a chance to really experiment with either. I am still trying to wrap my head around it and that will take some time. Thank you all for the help though!

Also, Clockworkdragon is a male :D for future reference.

Eventually I hope to incorporate the party system into combat but first i am just trying to make this work with out making the code dirty and sluggish.

HegemonKhan
if you're struggling with anything, or need help with anything, let us know, so we can help you out. Try to learn on your own, but if you're stuck, we're eager to help out. We've got a really good community here, everyone is very helpful, I would never be where I'm at now if it weren't for others here also helping me out with learning quest and with (for me wanting to) learning to code.

I apologize for all the code, I just don't have the time to make posts that guide you through using the GUI~Editor (whereas, doing code, is generally quick for me), as I'm really exhausted from work each day (and the few days I got off, I use up to get my needed hours of sleep, sighs), and I've not used the GUI~Editor for a long time now too... I'd have to look up everything myself with how stuff is done via the GUI~Editor, but there's others who're good at the GUI~Editor who'll help you. So, just ignore my code posts and wait for them, hehe. Maybe for a lot of people, once they start to tackle coding, they can come back to all of my posts, and it may help them with learning to code in quest, as they got a bit more of a sense of coding by then, and hopefully my code posts will then be of help to them, hehe.

I'll get around to making that demo code+game for you with what you want (as it's also something that I want~need too, laughs, as we're both trying to learn to make a RPG, hehe, and I too need the same system, so it'll be good learning+practice for me myself in creating a demo code+game for you on parties!), soon as I find the time and energy to do so... sighs.

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

Support

Forums