Posted: Mon Sep 17, 2007 9:41 am Post subject: Random Maze
I know I have seen a maze generator script somewhere, but as with all things, I can't find it when I get around to using it.
There has to be a better way to make a 10*10 maze instead of the way we did: Used a random maze generator, and scripted in the 4 dirs for each and every room. As you can imagine we dont want to repeat this again!
[offtopic]
We should recode a VB mapping program, we made 2 years ago, to output a maze in trigedit script format.. but that would lead to making a zone outputter that would handle our new ascii mapping, and all kinds of nasty graphic orientated stuff that circle doesn't need, and Mortermer would have my head for even suggesting it, because it actually sounds like a better way to handle 64 different sector types.. and the new system needs 3*3 ascii's for every room.. OOH I can't wait to tell him!
[/offtopic]
Ps. does anyone know where i can find a random room-exits/maze generator script?
Thank you!
Last edited by geengyr on Mon Sep 17, 2007 9:45 am; edited 1 time in total
Random has a random (no pun intended) exit maze generator. He doesn't mind people using his triggers so long as they are credited to him somewhere. If you log onto The Builder Academy (builderacademy.net; 9091) and ask, I'm sure he will let you have it, he might even post it here for you if you ask nicely
I'm on my way out the door, but if anyone is willing to grab the appropriate triggers from zone 130 on TBA, I'm more then willing to have it posted here. _________________
This is the trigger in full, so it is specific to the type of mobs and messages that Random originally made for it. I'm sure you will be able to grab the bits that you need from it though and make it the way you need. Comes in two parts, one that sets up the exits and loads mobs, the second purges exits.
Code:
1) Name : Maze Trigger
2) Intended for : Rooms
3) Trigger types: Enter
4) Numeric Arg : 100
5) Arguments :
6) Commands:
* Random
* Mist Maze
* Using random directions maze a "maze" useing loaded and purged exits
* and load the mobs that will exist in this room
*
* first remove any exits that may already exist
eval thisRoom %self.vnum%
* if %self.people% == 0
%door% %thisRoom% north purge
%door% %thisRoom% south purge
%door% %thisRoom% east purge
%door% %thisRoom% west purge
wait 1 sec
set bottomRoom 13000
set upperRoom 13078
* bottomRoom is the lowest room number in the maze
* upperRoom is the highest room number in the maze
set numExits 0
eval totalRooms %upperRoom% - %bottomRoom%
* 1:4 chance for any direction to show up, but more than one may show
while !%numExits%
eval exitN %random.4%
eval exitS %random.4%
eval exitW %random.4%
eval exitE %random.4%
if %exitN% == 1
eval temp %%random.%totalRooms%%%
eval targetRoom %temp% + %bottomRoom%
%door% %thisRoom% north room %targetRoom%
eval numExits %numExits% + 1
else
return 0
end
if %exitS% == 1
eval temp %%random.%totalRooms%%%
eval targetRoom %temp% + %bottomRoom%
%door% %thisRoom% south room %targetRoom%
eval numExits %numExits% + 1
else
return 0
end
if %exitW% == 1
eval temp %%random.%totalRooms%%%
eval targetRoom %temp% + %bottomRoom%
%door% %thisRoom% west room %targetRoom%
eval numExits %numExits% + 1
else
return 0
end
if %exitE% == 1
eval temp %%random.%totalRooms%%%
eval targetRoom %temp% + %bottomRoom%
%door% %thisRoom% east room %targetRoom%
eval numExits %numExits% + 1
else
return 0
end
done
%send% %actor% The mists swirl at your entrance revealing a new path.
%echoaround% %actor% %actor.name% causes the mists to swirl revealing a path.
*
* Now load the mobs
eval totalMob %random.3%
eval totalMob %totalMob% -1
set howMany 0
while %howMany% < %totalMob%
switch %random.4%
case 1
%load% mob 13000
%force% feeling kill %actor.name%
eval howMany %howMany% + 1
break
case 2
%load% mob 13001
%force% feeling kill %actor.name%
eval howMany %howMany% + 1
break
case 3
%load% mob 13002
%force% feeling kill %actor.name%
eval howMany %howMany% + 1
break
case 4
%load% mob 13003
%force% feeling kill %actor.name%
eval howMany %howMany% + 1
break
default
%echo% This trigger is broken, please report to an immortal.
break
done
done
*
* Check to see if the players "hear" anything in the background
eval doHear %random.5%
if %doHear% < 3
wait 20 sec
switch %random.3%
case 1
%echo% Voices in the distance can be heard complaining about wasting arrows shooting in the distance, since they don't have a crown to peek ahead.
break
case 2
%load% obj 13008
%echo% A torn piece of paper floats in on a soft breeze.
break
case 3
%echo% A voice from behind you cusses at a tombstone, then cusses when he pokes himself with an arrow.
wait 2 sec
%echo% An arrow flies past your face and strikes the ground nearby.
%load% obj 13003
break
default
%echo% This trigger is broken, please report to an immortal.
break
done
end
* end
And...
Code:
1) Name : Mist Maze exit trigger
2) Intended for : Rooms
3) Trigger types: Leave
4) Numeric Arg : 100
5) Arguments :
6) Commands:
* Random
* Swirling mists maze clean up trigger
* Removes all the room exits when a player leaves the room
wait 1 sec
eval thisRoom %self.vnum%
if !%self.people%
%door% %thisRoom% north purge
%door% %thisRoom% south purge
%door% %thisRoom% east purge
%door% %thisRoom% west purge
else
return 0
end
I don't want put in your credits, or a monument, just please leave the header on the triggers where my name is located. That's all I ask of anyone that uses my triggers.
You'll notice that for the most part, all you need to do is plug in the zone numbers, then change the upper and lower limits for the rooms in the maze, and as Amber said, make the message work for your theme.
The "feelings" that this trigger loads are mobs from my zone called feeling and upon loading, it forces them to fight the player who triggered the maze. The interesting thing about it is that if 2 players enter the room, the second one also triggers it, loading more mobs and is also attacked.
The part about "hearing" things can be removed, since all it does is give some background noises to the zone.
These triggers just need added to each room in the maze, and when the rooms are built, make sure there are NO exits. _________________
Posted: Tue Sep 09, 2008 4:49 pm Post subject: Hello
Sorry for "resurrect" this topic. But I apply this trigger in "my" mud, and some errors are displayed when executed.
The errors are:
[Room 32736:: wload: room vnum target does not exist (loading mob to room vnum 32701)]
[Room 32736:: wforce: No target found]
[Room 32726:: wload: room vnum target does not exist (loading mob to room vnum 32703)]
Any ideas of how to fix?
Code:
Name: 'Labirinto', VNum: [32701], RNum: [ 640]
Trigger Intended Assignment: Rooms
Trigger Type: Enter , Numeric Arg: 100, Arg list: None
Commands:
* Random
* Mist Maze
* Using random directions maze a "maze" useing loaded and purged exits
* and load the mobs that will exist in this room
*
* first remove any exits that may already exist
eval thisRoom %self.vnum%
* if %self.people% == 0
%door% %thisRoom% north purge
%door% %thisRoom% south purge
%door% %thisRoom% east purge
%door% %thisRoom% west purge
wait 1 sec
set bottomRoom 32701
set upperRoom 32779
* bottomRoom is the lowest room number in the maze
* upperRoom is the highest room number in the maze
set numExits 0
eval totalRooms %upperRoom% - %bottomRoom%
* 1:4 chance for any direction to show up, but more than one may show
while !%numExits%
eval exitN %random.4%
eval exitS %random.4%
eval exitW %random.4%
eval exitE %random.4%
if %exitN% == 1
eval temp %%random.%totalRooms%%%
eval targetRoom %temp% + %bottomRoom%
%door% %thisRoom% north room %targetRoom%
eval numExits %numExits% + 1
else
return 0
end
if %exitS% == 1
eval temp %%random.%totalRooms%%%
eval targetRoom %temp% + %bottomRoom%
%door% %thisRoom% south room %targetRoom%
eval numExits %numExits% + 1
else
return 0
end
if %exitW% == 1
eval temp %%random.%totalRooms%%%
eval targetRoom %temp% + %bottomRoom%
%door% %thisRoom% west room %targetRoom%
eval numExits %numExits% + 1
else
return 0
end
if %exitE% == 1
eval temp %%random.%totalRooms%%%
eval targetRoom %temp% + %bottomRoom%
%door% %thisRoom% east room %targetRoom%
eval numExits %numExits% + 1
else
return 0
end
done
%send% %actor% The mists swirl at your entrance revealing a new path.
%echoaround% %actor% %actor.name% causes the mists to swirl revealing a path.
*
* Now load the mobs
eval totalMob %random.3%
eval totalMob %totalMob% -1
set howMany 0
while %howMany% < %totalMob%
switch %random.4%
case 1
%load% mob 32701
%force% vulto kill %actor.name%
eval howMany %howMany% + 1
break
case 2
%load% mob 32702
%force% vulto kill %actor.name%
eval howMany %howMany% + 1
break
case 3
%load% mob 32703
%force% vulto kill %actor.name%
eval howMany %howMany% + 1
break
case 4
%load% mob 32701
%force% vulgo kill %actor.name%
eval howMany %howMany% + 1
break
default
%echo% This trigger is broken, please report to an immortal.
break
done
done
*
* Check to see if the players "hear" anything in the background
eval doHear %random.5%
if %doHear% < 3
wait 20 sec
switch %random.3%
case 1
%echo% Voce ouve vozes vindo de uma certa distancia. Porem, voce nao consegue distinguir de qual direcao.
break
case 2
%load% obj 32701
%echo% Um pedaco de pano rasgado flutua carregado pela leve brisa que passa entre as arvores.
break
case 3
%echo% Uma brisa vindo do nada parece atravessar seu corpo.
wait 2 sec
%echo% Uma grande pena cai a seus pes, aparentemente vindo do nada.
%load% obj 32702
break
default
%echo% This trigger is broken, please report to an immortal.
break
one
end
* end
Joined: Nov 26, 2005 Posts: 1390 Location: Shelby Township, Michigan
Posted: Tue Sep 09, 2008 5:58 pm Post subject:
My guess is you don't have the mobs that it is attempting to load. It tries to load mob 32701, 32702, or 32703, then tries to force the mob. If it fails to load due to those vnums not existing the force following the load will fail due to having no target. _________________ DG Script Reference Forum 4 Dimensions
Index VNum Mobile Name Level
----- ------- --------------------------------------------- -----
1) [32701] Um vulto sombrio. [ 10]
2) [32702] Um vulto sombrio. [ 15]
3) [32703] Um vulto sombrio. [ 20]
Fiz, the mobs are some (apparently)
I put the triggers (the two) in each room of the maze. The funny is that with the mob does not give error 32702. Only with the 32701 and 32703!
Joined: Nov 26, 2005 Posts: 1390 Location: Shelby Township, Michigan
Posted: Wed Sep 10, 2008 10:06 am Post subject:
Hmm, makes no sense to me. The error looks to be saying the room it is trying to load the mob in doesn't exist. What's odd about it is that the script doesn't use %at% and isn't a mob script and as such should never attempt to load mobs in any room other than the room that the script is attached to, which obviously must exist.
I doubt it has anything at all to do with the error, but I did notice the last done at the bottom is missing a d and is just 'one'. _________________ DG Script Reference Forum 4 Dimensions
goto room 32701
stat room
cut and paste the results of stat for us please...
also... why does your listing of the mobs show that those mobs are already loaded someplace in some amount? _________________
Joined: Nov 26, 2005 Posts: 1390 Location: Shelby Township, Michigan
Posted: Fri Sep 12, 2008 2:20 pm Post subject:
I get this:
Code:
[ Room 1204 :: Argument is mob 1200 ]
from this script:
Code:
Trigger Editor [1271]
1) Name : new trigger
2) Intended for : Rooms
3) Trigger types: Command
4) Numeric Arg : 100
5) Arguments : testload
6) Commands:
%load% mob 1200
W) Copy Trigger
Q) Quit
When I added:
Code:
wld_log(room, "Argument is %s", argument);
At the top of do_wload in dg_wldcmd.c
Obviously arg gets passed what I expected it did, so in the case of the above script it gets passed: mob 32701
This then goes through a:
target = two_arguments(argument, arg1, arg2);
at which point
arg1 = mob
arg2 = 32701
target should be null.
That error though isn't sent unless target has a value due to:
Code:
/* load mob to target room - Jamie Nelson, April 13 2004 */
if (is_abbrev(arg1, "mob")) {
room_rnum rnum;
if (!target || !*target) {
rnum = real_room(room->number);
} else {
if (!isdigit(*target) || (rnum = real_room(atoi(target))) == NOWHERE) {
wld_log(room, "wload: room target vnum doesn't exist (loading mob vnum %d to room %s)", number, target);
return;
}
}
The problem is obvious if you highlight the script. You have a space at the end of two of the %load% lines. It is reading the space as a target, so it passes past the if target == NULL check but not the is_digit check.
Essentially you can do this:
'%load% mob 50 300'
that loads mob 50 in room vnum 300.
You can also do this:
'%load% mob 300'
What you're trying to do is this due to the space:
'%load% mob 300 '
That tries loading the mob in room vnum of ' ' which for obvious reasons doesn't exist there is no room with a non-digit vnum. _________________ DG Script Reference Forum 4 Dimensions
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