Ideas for traps/detecting/removing

  • Jan
  • Jan's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 months 1 week ago - 2 months 1 week ago #6784 by Jan
Jan created the topic: Ideas for traps/detecting/removing
Hi

Anyone who ever made a trap/detect traps/remove traps skill system ? Who wanna share how you did it, or ideas how to make it.

Maybe even with trigges, i know traps themself can be make with that. But what about detecting them and removing.

Also maybe the possibility for a ranger to set a trap.
Last Edit: 2 months 1 week ago by Jan.

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

More
2 months 1 week ago #6785 by Thomas
Thomas replied the topic: Ideas for traps/detecting/removing

JTP wrote: Anyone who ever made a trap/detect traps/remove traps skill system ? Who wanna share how you did it, or ideas how to make it.

Maybe even with trigges, i know traps themself can be make with that. But what about detecting them and removing.

Also maybe the possibility for a ranger to set a trap.


it depends what you mean by traps. I made a system once, where you could block an exit for a short period (I think it was called spiders web or something). This was a special magic spell, which blocked the exits from the current room for one or two battle ticks. It was efficient for keeping the monsters from fleeing - in practice trapping them there.

If you are referring to creating "touch" traps, or "land mines", you could easily create an object with an "enter" trigger, that explodes/implodes/sends arrows/spikes when someone enters, damaging them. Or even put in a short delay, so they might try to disarm it. Or check their "sense trap" skill (if applicable). Or check their dexterity.

If you are referring to boobytrapping chests and the like, this would almost certainly have to be a skill/spec_proc.

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

  • Jan
  • Jan's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 months 1 week ago #6786 by Jan
Jan replied the topic: Ideas for traps/detecting/removing
Could an actual skill remove a room Or obj trigger, If so How ?

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

  • Jan
  • Jan's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
2 months 1 week ago - 2 months 1 week ago #6787 by Jan
Jan replied the topic: Ideas for traps/detecting/removing
And what about detecting traps ? Making the skill it self is easy, but having it tell the player when entering a room sense a trap, comming from a trigger ?
Last Edit: 2 months 1 week ago by Jan.

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

More
2 months 5 days ago #6791 by Thomas
Thomas replied the topic: Ideas for traps/detecting/removing
As I wrote above, this would have to depend on the kind of trap you are creating.

If you are going the way of having a skill ("create trap"?) that allows you to create an object in the room, this object could have the necessary triggers to handle what you are looking for.

Let's say you have an item "fire trap" with a couple of different triggers.
An enter trigger, which checks the "detect traps" skill of the entering character and sets a variable if it is detected.
An enter trigger, which checks the variable set above. If detected, it performs a dex check or similar to see if any damage should be avoided. It sets the damage factor as a variable.
An enter trigger, which fetches the two variables above, and does the actual damage, if any. Also tells the player if he avoided damage. If the trap is triggered, remove it. If the trap is detected, leave it in the room (it might hit the next guy).
A get trigger, which again checks for the detect traps skill, and conditionally destroys the trap, if the skill is too low.

In this scenario, you can create different traps by tweaking the variables.

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

  • Jan
  • Jan's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 month 4 weeks ago - 1 month 4 weeks ago #6806 by Jan
Jan replied the topic: Ideas for traps/detecting/removing
Ok here goes the beginning:

i made ITEM_TRAP and skill sense trap.

then i added case ITEM_TRAP
    switch (GET_OBJ_TYPE(obj)) {
    case ITEM_NOTE:
      if (obj->action_description) {
        char notebuf[MAX_NOTE_LENGTH + 64];

        snprintf(notebuf, sizeof(notebuf), "There is something written on it:\r\n\r\n%s", obj->action_description);
        page_string(ch->desc, notebuf, TRUE);
      } else
        send_to_char(ch, "It's blank.\r\n");
      return;

    case ITEM_DRINKCON:
      send_to_char(ch, "It looks like a drink container.");
      break;

    case ITEM_TRAP:
      if (GET_OBJ_TYPE(obj) == ITEM_TRAP && GET_SKILL(ch, SKILL_SENSE_TRAP > 0)) {
        send_to_char(ch, "You sense a trap.");
      } else
        send_to_char(ch, "You see nothing special..");
      break;

    default:
      send_to_char(ch, "You see nothing special..");
      break;
    }
    break;

  default:
    log("SYSERR: Bad display mode (%d) in show_obj_to_char().", mode);

ok it Works, but i would like it to also show description or extra description.

how can i do that ?

Would also be good if different skill % still had a chance to fail giving info.
Last Edit: 1 month 4 weeks ago by Jan.

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

  • Jan
  • Jan's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 month 4 weeks ago #6807 by Jan
Jan replied the topic: Ideas for traps/detecting/removing
I also tried to add it when looking in a direction...works when there is a direction. But If there is only an exit South, and i try to look north. Game crashes. See attached file for that code, and see If you Can see why i crash.
Attachments:

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

  • Jan
  • Jan's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 month 4 weeks ago #6808 by Jan
Jan replied the topic: Ideas for traps/detecting/removing
Backtrace file
Attachments:

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

More
1 month 2 weeks ago #6809 by Thomas
Thomas replied the topic: Ideas for traps/detecting/removing
The crash happens because going_to is never checked for validity before bring used.

First off, move the initialization beneath the first if statement. Then add "going_to != NOWHERE &&" at the beginning of the trap check.

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

  • Mosheh Ben Avraham
  • Mosheh Ben Avraham's Avatar
  • Offline
  • Gold Boarder
  • Gold Boarder
More
1 month 2 weeks ago #6810 by Mosheh Ben Avraham
Mosheh Ben Avraham replied the topic: Ideas for traps/detecting/removing
Just noticed you have your parenthesis a little off in that code....
    case ITEM_TRAP:
      if (GET_OBJ_TYPE(obj) == ITEM_TRAP && GET_SKILL(ch, SKILL_SENSE_TRAP > 0)) {
        send_to_char(ch, "You sense a trap.");
      } else
        send_to_char(ch, "You see nothing special..");
      break;

You probably want this?
GET_SKILL(ch, SKILL_SENSE_TRAP) > 0

Website
www.luminariMUD.com

Main Game Port
luminariMUD.com:4100

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

  • Jan
  • Jan's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 month 2 weeks ago #6811 by Jan
Jan replied the topic: Ideas for traps/detecting/removing
Tried what you said Thomas, got a bunch of errors.
static void look_in_direction(struct char_data *ch, int dir)
{

  if (EXIT(ch, dir)) {
   room_rnum going_to != NOWHERE && EXIT(ch, dir)->to_room;
    if (EXIT(ch, dir)->general_description)
      send_to_char(ch, "%s", EXIT(ch, dir)->general_description);

    if (EXIT_FLAGGED(EXIT(ch, dir), EX_CLOSED) && EXIT(ch, dir)->keyword)
      send_to_char(ch, "The %s is closed.\r\n", fname(EXIT(ch, dir)->keyword));
    else if (EXIT_FLAGGED(EXIT(ch, dir), EX_ISDOOR) && EXIT(ch, dir)->keyword)
      send_to_char(ch, "The %s is open.\r\n", fname(EXIT(ch, dir)->keyword));
    else if (ROOM_FLAGGED(going_to, ROOM_DEATH) && GET_SKILL(ch, SKILL_SENSE_TRAP) > 95)
      send_to_char(ch, "You sense that a trap might be there.\r\n");

    } else
    send_to_char(ch, "Nothing special there...\r\n");
}


act.informative.c: In function ‘look_in_direction’:
act.informative.c:619: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘!=’ token
act.informative.c:619: error: expected expression before ‘!=’ token
act.informative.c:629: error: ‘going_to’ undeclared (first use in this function)
act.informative.c:629: error: (Each undeclared identifier is reported only once
act.informative.c:629: error: for each function it appears in.)

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

More
1 month 2 weeks ago #6812 by Thomas
Thomas replied the topic: Ideas for traps/detecting/removing
I'm afraid my communcation was lacking - it obviously wasn't clear enough.
What I mean was:
static void look_in_direction(struct char_data *ch, int dir)
{

  if (EXIT(ch, dir)) {
   room_rnum going_to = EXIT(ch, dir)->to_room;
    if (EXIT(ch, dir)->general_description)
      send_to_char(ch, "%s", EXIT(ch, dir)->general_description);

    if (EXIT_FLAGGED(EXIT(ch, dir), EX_CLOSED) && EXIT(ch, dir)->keyword)
      send_to_char(ch, "The %s is closed.\r\n", fname(EXIT(ch, dir)->keyword));
    else if (EXIT_FLAGGED(EXIT(ch, dir), EX_ISDOOR) && EXIT(ch, dir)->keyword)
      send_to_char(ch, "The %s is open.\r\n", fname(EXIT(ch, dir)->keyword));
     else if (going_to != NOWHERE && ROOM_FLAGGED(going_to, ROOM_DEATH) && GET_SKILL(ch, SKILL_SENSE_TRAP) > 95)
      send_to_char(ch, "You sense that a trap might be there.\r\n");

    } else
    send_to_char(ch, "Nothing special there...\r\n");
}
Note - it is WAY easier to answer this post because the code was pasted there, than it was when it was an image.

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

  • Jan
  • Jan's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 month 2 weeks ago #6813 by Jan
Jan replied the topic: Ideas for traps/detecting/removing
Hmm
static void look_in_direction(struct char_data *ch, int dir)
{

  if (EXIT(ch, dir)) {
   room_rnum going_to EXIT(ch, dir)->to_room;    <<--621
    if (EXIT(ch, dir)->general_description)
      send_to_char(ch, "%s", EXIT(ch, dir)->general_description);

    if (EXIT_FLAGGED(EXIT(ch, dir), EX_CLOSED) && EXIT(ch, dir)->keyword)
      send_to_char(ch, "The %s is closed.\r\n", fname(EXIT(ch, dir)->keyword));
    else if (EXIT_FLAGGED(EXIT(ch, dir), EX_ISDOOR) && EXIT(ch, dir)->keyword)
      send_to_char(ch, "The %s is open.\r\n", fname(EXIT(ch, dir)->keyword));
    else if (going_to != NOWHERE && ROOM_FLAGGED(going_to, ROOM_DEATH) && GET_SKILL(ch, SKILL_SENSE_TRAP) > 95)  <<--629
      send_to_char(ch, "You sense that a trap might be there.\r\n");

    } else
    send_to_char(ch, "Nothing special there...\r\n");
}

gcc -g -O2 -Wall    -c -o act.informative.o act.informative.c
act.informative.c: In function ‘look_in_direction’:
act.informative.c:621: error: expected ‘)’ before ‘[’ token
act.informative.c:629: error: ‘going_to’ undeclared (first use in this function)
act.informative.c:629: error: (Each undeclared identifier is reported only once
act.informative.c:629: error: for each function it appears in.)
make[1]: *** [act.informative.o] Error 1

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

More
1 month 2 weeks ago #6814 by Thomas
Thomas replied the topic: Ideas for traps/detecting/removing
re-read the code. You are missing a = on the line it is complaining about :)

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

  • Jan
  • Jan's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 month 2 weeks ago #6815 by Jan
Jan replied the topic: Ideas for traps/detecting/removing
Cool thanks the missing = helped

But if the character dont have sense trap and type look up or l u in a direction where there is an up.

No message at all comes, it just makes an empty line ?

Looking in any direction that isnt there i get Nothing special there.

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

More
1 month 2 weeks ago #6816 by Thomas
Thomas replied the topic: Ideas for traps/detecting/removing
Do not use "else if" on that line, just "else"

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

  • Jan
  • Jan's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 month 2 weeks ago - 1 month 2 weeks ago #6817 by Jan
Jan replied the topic: Ideas for traps/detecting/removing
If i change the last else if to else, then i get:

act.informative.c: In function ‘look_in_direction’:
act.informative.c:630: warning: value computed is not used
act.informative.c:630: error: expected ‘;’ before ‘send_to_char’
make[1]: *** [act.informative.o] Error 1

If i put a ; in the end. Then i still get the value computed is not used ?
Last Edit: 1 month 2 weeks ago by Jan.

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

More
1 month 2 weeks ago #6818 by Thomas
Thomas replied the topic: Ideas for traps/detecting/removing
Does this work?
static void look_in_direction(struct char_data *ch, int dir)
{

  if (EXIT(ch, dir)) {
    if (EXIT(ch, dir)->general_description)
      send_to_char(ch, "%s", EXIT(ch, dir)->general_description);

    if (EXIT_FLAGGED(EXIT(ch, dir), EX_CLOSED) && EXIT(ch, dir)->keyword)
      send_to_char(ch, "The %s is closed.\r\n", fname(EXIT(ch, dir)->keyword));
    else if (EXIT_FLAGGED(EXIT(ch, dir), EX_ISDOOR) && EXIT(ch, dir)->keyword)
      send_to_char(ch, "The %s is open.\r\n", fname(EXIT(ch, dir)->keyword));
    
    room_rnum going_to = EXIT(ch, dir)->to_room;
    if (going_to != NOWHERE && ROOM_FLAGGED(going_to, ROOM_DEATH) && GET_SKILL(ch, SKILL_SENSE_TRAP) > 95)  
      send_to_char(ch, "You sense that a trap might be there.\r\n");

    } else
    send_to_char(ch, "Nothing special there...\r\n");
}

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

  • Jan
  • Jan's Avatar Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
1 month 2 weeks ago #6819 by Jan
Jan replied the topic: Ideas for traps/detecting/removing
What you wrote compiles.

But samt problem, if you dont have the skill. And look in an existing direction, no message comes.

But looking in what ever direction that doesnt exists, says Nothing special there.

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

More
1 month 2 weeks ago #6820 by Thomas
Thomas replied the topic: Ideas for traps/detecting/removing
Aah - now I understand what you mean. Well, yes, that is what this code does. If the exit exists, you will never get to the "nothing special here" case. So, to preserve that particular functionality, we need to do some racking of whether or not something is special in that direction:
static void look_in_direction(struct char_data *ch, int dir)
{
  int anything_special = FALSE;

  if (EXIT(ch, dir)) {
    if (EXIT(ch, dir)->general_description && anything_special = TRUE)
	  send_to_char(ch, "%s", EXIT(ch, dir)->general_description);
    
    if (EXIT_FLAGGED(EXIT(ch, dir), EX_CLOSED) && EXIT(ch, dir)->keyword && anything_special = TRUE)
      send_to_char(ch, "The %s is closed.\r\n", fname(EXIT(ch, dir)->keyword));
    else if (EXIT_FLAGGED(EXIT(ch, dir), EX_ISDOOR) && EXIT(ch, dir)->keyword && anything_special = TRUE)
      send_to_char(ch, "The %s is open.\r\n", fname(EXIT(ch, dir)->keyword));
    
    room_rnum going_to = EXIT(ch, dir)->to_room;
    if (going_to != NOWHERE && ROOM_FLAGGED(going_to, ROOM_DEATH) && GET_SKILL(ch, SKILL_SENSE_TRAP) > 95 && anything_special = TRUE)  
      send_to_char(ch, "You sense that a trap might be there.\r\n");
    }

	if (!anything_special)
		send_to_char(ch, "Nothing special there...\r\n");
}

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

Time to create page: 2.015 seconds