Welcome to the Builder Academy

Question Triggers - Zones

More
22 Jul 2015 02:30 #5447 by cunning
Triggers - Zones was created by cunning
I have several transporter triggers. I converted hard coded transporters over to trigger based. I forgot one small detail, on of the transporters needs to check for the existence of a person within a specific amount of rooms.

hell i am not even sure if you can do it for entire zone, let alone a group of rooms inside a zone.

I am basically looking to break up gauntlets in a zone. Each set of rooms will represent a gauntlet. If someone is already in there, I want the trigger to deny entry.

I am just not sure if you can search a specific amount of rooms.

Searching for ideas...

Please Log in or Create an account to join the conversation.

More
22 Jul 2015 23:30 #5450 by Parnassus
Replied by Parnassus on topic Triggers - Zones
This trigger isn't commented but basically, it's checking 25 rooms in zone 89. These values are easy to change.

www.tbamud.com/forum/3-building/1079-tri...y-one-player-in-zone

Please Log in or Create an account to join the conversation.

More
31 Jul 2015 17:39 - 31 Jul 2015 19:21 #5484 by cunning
Replied by cunning on topic Triggers - Zones
I actually did something different. I used my coding skills :)
Code:
else if (!str_cmp(field, "players_inzone")) { if (subfield && *subfield) { struct descriptor_data *d; char zone_bot[READ_SIZE], zone_top[READ_SIZE], num_allowed[READ_SIZE]; int inzone = 0; three_arguments(subfield, zone_bot, zone_top, num_allowed); for (d = descriptor_list; d; d = d->next) { if (!STATE(d) && IN_ROOM(d->character) >= real_room(atoi(zone_bot)) && IN_ROOM(d->character) <= real_room(atoi(zone_top)) && GET_LEVEL(d->character) < LVL_IMMORT inzone++; } if (inzone >= atoi(num_allowed)) snprintf(str, slen, "1"); else snprintf(str, slen, "0"); } } else if (!str_cmp(field, "zonenumber")) snprintf(str, slen, "%d", zone_table[r->zone].number); else if (!str_cmp(field, "zonename")) snprintf(str, slen, "%s", zone_table[r->zone].name); else if (!str_cmp(field, "roomflag")) {

Wallah! No longer need to do a search into every room. I was worried that if you came across a room that did not exist in VNUM order, it would crash. I tried something different and works like a charm. I would not have thought outside of the box if not for Rumble's example above.
Last edit: 31 Jul 2015 19:21 by thomas. Reason: code tags added

Please Log in or Create an account to join the conversation.

Time to create page: 0.197 seconds