<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>
<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 (GetBoolean(Zeak, "follow")) {
MoveObjectHere (Zeak)
}
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
}
}
foreach (object_x, AllObjects () ) {
if (GetBoolean (object_x, "follow") ) {
if (not object_x.parent = player.parent) {
object_x.parent = player.parent
}
}
}
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'
}
}
}
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'
}
}
}
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'
}
}
}
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?
foreach (K, AllObjects () ) {
if (GetBoolean (K, "follow") ) {
if (K.visible = false) {
K.parent = player.parent
}
}
}
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 + ".")
}
}
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 + ".")
}
}
clockworkdragon wrote: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.")
}
}
foreach (object, game.party_members) {
if (GetBoolean(object, "follow")) {
MoveObjectHere (object)
msg (" " + object.alias + " has arrived.")
}
}
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.")
}
}
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.")
}
}
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
game.party_members = NewObjectList()
list add (game.party_members, Bob)
list add (game.party_members, Jill)
SetObjectFlagOn (Bob, "follow")
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
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.