A "floating object" is an object (usually scenery) that can appear in multiple locations. For example, if you have ten forest locations and you want to implement a tree (or trees) in every forest location, you don't want to create ten trees with lots of duplicated code, you just want to create one tree and move it around as the player moves around.
I tried doing this with code similar to the following:
: if (is_at "room01" && is_just_entered()) {
: create "front_gate";
}
: if (is_at "room02" && is_just_entered()) {
: create "front_gate";
}
Then I tried something like this in the on_command{} block in locations{}:
: match "n _" {
: create "front_gate" target = "room02" ;
}
I had to force a move with:
: match "n _" {
: create "front_gate" target = "room02" ;
: goto target = "room02";
: redescribe;
}
So what's the best way to implement floating objects?