Jump to content

move_to_loc_x_y question


Recommended Posts

In my creature script (haven't got it handy at the moment, though) I have the creature summon a specific monster on one of nearby spots nearby under the following conditions:

the spot is visible (easy to get)

some health vs max health or energy (easy to get)

the spot is unoccupied (also easy to get)

the spot is reachable - i.e. if its height is greater/lesser than where the summoner is then the script is to make sure that there is a way for the summoned one to climb it up); also to check if the terrain in there allows creatures to go on that space (hopefully the call works that way).

 

For the last condition I use the call

if (move_to_loc_x_y(co-ordinates go here) == FALSE)

so that the summoner is not going there and the path is not blocked.

Then, and only the may the summoned guy be, well, summoned.

But will this call work? Theoretically, of course.

Link to comment
Share on other sites

Sorry, but it doesn't work that way. move_to_loc_x_y doesn't return a value, so you can't use it in a conditional statement. There isn't really an easy way to do what you want. In fact, even BoA's ordinary summoning spells don't always get it right; they can sometimes summon creatures on top of unreachable ledges.

Link to comment
Share on other sites

No, the call move_to_loc_x_y doesn't return any value, and I'm not sure that it would create the desired effect anyway even if it did.

 

EDIT: You may want to use the call approach_waypoint

 

EDIT 2: Thuryl posted as I was ... at least we said the same thing.

 

You may want to pick several spaces for the summoned monster to go (memory cells?) and place runes there or something. Then you can randomly place s/he on one spot. Another answer is just to not have any unreachable ledges around the summoner.

Link to comment
Share on other sites

From Wikipedia Reference Guide:

 

short move_to_loc_x_y(short which_char_or_group,short x,short y)

 

Has the character move as close a possible to location {x,y}. If the character is already moving, the old destination is forgotten. Returns 1 if the character doesn’t move (because it is close already or can’t find a path there), 0 otherwise.

 

Does this no longer apply?

Link to comment
Share on other sites

It appears (based on the old bugs page ) that move_to_loc_x_y didn't used to work but was fixed for a more recent version. It seems likely that it was changed from a short to a void in that time in order to make it functional.

 

The easy way to test it, obviously, is to make a creature script with print_num(move_to_loc_x_y(my_number(),some_x,some_y)) in the START_STATE.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...