Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Idre
Newbie


Joined: 25 Aug 2002
Posts: 5
Location: Belgium

PostPosted: Mon Dec 09, 2002 7:02 pm   

Finding certain rooms?
 
I have a problem that I can't figure out.

I want a trigger to take me to a room with a certain criteria in it when it fires. (Basically it should take me to the closest "safe room".)

So far on my maps I have used color to mark safe rooms. But I am open to use anything. I could even mark down all safe rooms as having cost 23 to enter, or really any field. Just as long as a hp trigger can take me to the closest of the designated rooms.

Preferably in basic zmud, but at worst I will get zmapper.

I really, really want this. (And more people must have thought of it, and a thousand other uses for somethign similar.)
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Mon Dec 09, 2002 10:57 pm   
 
Here's something to get you started. I didn't try to test it. It assumes that each of your safe rooms has been an id with the word "safe" and a sequential number, i.e. safe1, safe2, safe3... , safe34, safe35.

If you've broken up your map into zones, you can put the variable @number_of_safe_rooms in the zone script section of map properties.



#ALIAS gosafe {
closest_room = ""
least_cost = 999999
#LOOP @number_of_safe_rooms {
safe_room = %concat("safe",%i)
this_path = %remove(".", %walk(@safe_room))
this_room = %roomnum
path_cost = 0
LOOP %len(@this_path) {
next_room = %roomlink(@this_room, %copy(@this_path, %i, 1))
path_cost = @path_cost + %roomcost(@next_room)
this_room = @next_room
#IF (@path_cost > @least_cost) {#ABORT}
}
#IF (@path_cost < @least_cost) {closest_room = @safe_room; least_cost = @path_cost}
}
#WALK @closest_room
}


Troubadour
(Win 98, Pentium III, 550 MHz)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net