10 Aug, 2009, tphegley wrote in the 1st comment:
Votes: 0
I am developing a wall spell that when cast, will drop a wall in whichever direction the mage desires. I have the basic layout for it and it partly works. My problem is that it is only finding just one wall when there are more then one wall in the room.

Example: I cast a wall south spell and a wall north spell. What should happen is I wouldn't be able to move north or south with those walls, what actually happens is the last wall I set is the one it uses to see if I can move or not. So if I had set the wall north last, then I won't be able to travel north, but can travel south, even though there is still a wall there.

act_move.c
function move_char

bWalls = FALSE;

for (obj = ch->in_room->contents; obj; obj = obj->next_content)
{
if (obj->deleted)
continue;
if (IS_SET (obj->extra_flags, ITEM_WALL_SOUTH)
|| IS_SET (obj->extra_flags, ITEM_WALL_NORTH)
|| IS_SET (obj->extra_flags, ITEM_WALL_EAST)
|| IS_SET (obj->extra_flags, ITEM_WALL_WEST)
|| IS_SET (obj->extra_flags, ITEM_WALL_UP)
|| IS_SET (obj->extra_flags, ITEM_WALL_DOWN))
{
bWalls = TRUE;
break; <———-I believe this to be the culprit
}
}

if (bWalls)
{
if ( (door == DIR_SOUTH && IS_SET (obj->extra_flags, ITEM_WALL_SOUTH))
|| (door == DIR_NORTH && IS_SET (obj->extra_flags, ITEM_WALL_NORTH))
|| (door == DIR_EAST && IS_SET (obj->extra_flags, ITEM_WALL_EAST))
|| (door == DIR_WEST && IS_SET (obj->extra_flags, ITEM_WALL_WEST))
|| (door == DIR_UP && IS_SET (obj->extra_flags, ITEM_WALL_UP))
|| (door == DIR_DOWN && IS_SET (obj->extra_flags, ITEM_WALL_DOWN)))
{
act ("There is a wall blocking your movement.", ch, NULL, fch, TO_CHAR);
act ("A wall blocks $n's movement!", ch, NULL, fch, TO_ROOM);
return;
}
}


I figure that break point is the culprit, but when I take the break point out, then it will crash on whatever direction the walls is when i try to move it, because of the wall not being in memory(?)

GDB

Program received signal SIGSEGV, Segmentation fault.
0x08055383 in move_char (ch=0xb6c31e1c, door=2) at act_move.c:347
347 if ( (door == DIR_SOUTH && IS_SET (obj->extra_flags, ITEM_WALL_SOUTH))
(gdb) bt
#0 0x08055383 in move_char (ch=0xb6c31e1c, door=2) at act_move.c:347
#1 0x08055e6b in do_south (ch=0x0, argument=0xb6bcaa96 "") at act_move.c:744
#2 0x0808d8b3 in interpret (ch=0xb6c31e1c, argument=0xb6bcaa96 "") at interp.c:3366
#3 0x0806fa17 in game_loop_unix (control=6) at comm.c:921
#4 0x0806f54b in main (argc=1, argv=0x6) at comm.c:521
(gdb) frame 0
#0 0x08055383 in move_char (ch=0xb6c31e1c, door=2) at act_move.c:347
347 if ( (door == DIR_SOUTH && IS_SET (obj->extra_flags, ITEM_WALL_SOUTH))
(gdb) print obj->extra_flags
Cannot access memory at address 0x3c
(gdb)


I guess my question is, how do I put the obj->extra_flags into the memory so it knows to look for that flag?

It doesn't crash when the break is not commented out.
10 Aug, 2009, David Haley wrote in the 2nd comment:
Votes: 0
You are correct that you don't want to break on the first wall you find, because if that wall isn't the right one, you will fail to detect the right one. So, as soon as you find a wall object, you want to check if it's in the same direction that the character is trying to move in.

Try moving the stuff inside "if (bWalls)" to where your break is.
10 Aug, 2009, tphegley wrote in the 3rd comment:
Votes: 0
That seems to work so far.

I'll further test it more.
10 Aug, 2009, Chris Bailey wrote in the 4th comment:
Votes: 0
I like your idea for a wall spell. I'm stealing it. :P
10 Aug, 2009, Igabod wrote in the 5th comment:
Votes: 0
I've seen a similar spell on a godwars mud. It is a spell for vampires called bloodwall or something like that. It's been a long time since I played a vampire on any GW muds. You might check out the GW code to see how it was done. I don't know who the original author is or even which version of GW I saw it in though.
10 Aug, 2009, Skol wrote in the 6th comment:
Votes: 0
Chris Bailey said:
I like your idea for a wall spell. I'm stealing it. :P

Rofl, I was just thinking the same thing, along with the ability to construct/destruct/reset walls.
10 Aug, 2009, KaVir wrote in the 7th comment:
Votes: 0
Igabod said:
I've seen a similar spell on a godwars mud. It is a spell for vampires called bloodwall or something like that.

GodWars Deluxe has wall of granite, wall of water and wall of flame. The first two block movement, the last inflicts damage on those who pass through it. There are also wards against ghouls, werewolves, vampires and spirits, which work in much the same way, but only block specific classes from passing.
10 Aug, 2009, tphegley wrote in the 8th comment:
Votes: 0
Well, You guys can 'borrow' it, but stealing is bad. :biggrin:

My original thoughts on this are that the walls will have a timer when cast to give like 2-3 ticks of protection OR not allowing people to escape. I had originally thought to make the walls mobs that could be attacked but not attack back, so you could 'knock down' a wall by killing it, but I went ahead with items instead and could lead to different types of skills/spells different classes could use to free themselves.

The syntax would be something like 'cast wall north'

My Up walls are properly named magical ceilings and my down walls are magical floors.

If anyone has more questions, I might just make this into a snippet I guess if people want to use it.

EDIT***
Eventually the walls will end up like Kavir just mentioned. If you climb over it, some walls will hurt (barbed wire? flames?) and some will hinder and so forth.
10 Aug, 2009, Skol wrote in the 9th comment:
Votes: 0
More blah thought on walls.

Walls:

Wall of force/stone/wood spells
Also 'build' out of materials, wood, stone, brush, thatch, adobe.

Values:
0 - Wall type - log, brick & mortar, stone & mortar, thatch, adobe, force, ice, fire.
1 - height
2 - thickness
3 - direction blocking
4 - HP

Wall type will dictate damage types that affect it, damage reduction, speed of
creation, materials required. Magical walls will be force, ice, fire, etc.
Magical walls will be timered.

Object resets in a room, the descriptions will be generated via Object values:

Wall is say adobe, 8 feet tall, 12 inches thick, and blocks north:
An adobe wall standing eight feet tall blocks passage north.
10 Aug, 2009, Ssolvarain wrote in the 10th comment:
Votes: 0
Or, or or….

make a series of mobs that are unable to attack and have exit triggers blocking each respective direction. Would have to pop its cousin on the other side of the wall, provided it's not a 1-way exit.

Quick thought: Plague walls!
10 Aug, 2009, Skol wrote in the 11th comment:
Votes: 0
Rofl, Ssolvarain, I was thinking of a system that could actually be 'used' in a Rom-ish game heh.

Although, I DID use a system like that on some ship areas, 'shiprails' that stop exiting over the side into the waters.
But yeah, I think an actual coded 'wall' would be way more useful and less 'bailing wire and chewing gum' heh.
10 Aug, 2009, Ssolvarain wrote in the 12th comment:
Votes: 0
But can you kill your walls? :tongue:
11 Aug, 2009, Skol wrote in the 13th comment:
Votes: 0
Lol of course! HP is the 5th value on them, then type of wall/thickness determines damage reduction etc.
It's all //blah at this time anyway but yeah, completely 'hit' them, it wouldn't be like fighting a mob, but more chop/bash/kick north wall kind of a thing, maybe built into each regular 'attack' command.
I'm not talking an easy add-on, but more of an ability to beat down the 'object' (obviously not stock heh).
Again, this is just blah, aka theory before looking at implementing.
It wouldn't 'set fighting' as the wall isn't going to fight back heh. But it might put you in a 'destroying crap' mode where you continue the same action etc. Again, thinking outloud ;).
11 Aug, 2009, tphegley wrote in the 14th comment:
Votes: 0
Glad to start the smarts workin.

Keep tossin out ideas. Good stuff.
11 Aug, 2009, KaVir wrote in the 15th comment:
Votes: 0
In GodWars Deluxe, the spells would create an actual 'wall' object in the room as well as setting the exit flags. When the object timer expired the object was destroyed, and on destruction it would clear the exit flags.

If you use that approach, and allow players to attack and destroy objects, then destroying the wall would automatically clear the exit flags. Alternatively, as suggested by Ssolvarain, the wall could be represented as a mob instead of an object (although you'd have to make sure it couldn't move or be moved).

Using mobs to represent walls might seem a bit odd at first glance, but it would perhaps be the easiest way to let people destroy them with regular attacks. It would also let you have walls that attack back (such as a 'blade barrier' spell, or a living wall, or whatever).

The same code could be used to let regular mobs (and players) block exits and prevent other people from passing through, although in that case you might want to treat it more like the flame wall. Perhaps players can attempt to shove past, or dodge past, with the blocker either preventing them from leaving or getting a free automatic attack as they move past.

Traps could also be handled in the same way as the flame wall, but beware of bored players leaving traps in newbie areas.
11 Aug, 2009, David Haley wrote in the 16th comment:
Votes: 0
KaVir said:
Using mobs to represent walls might seem a bit odd at first glance, but it would perhaps be the easiest way to let people destroy them with regular attacks. It would also let you have walls that attack back (such as a 'blade barrier' spell, or a living wall, or whatever).

I did exactly this to implement destructible barriers, such as castle doors. I had a flag that marked it as "inanimate", so that it was a mob that didn't have any normal mob AI (including combat, although spells that "fight back" would still work allowing blade barriers etc.) – in other words for all intents and purposes it was an object that you could attack.

In the future, I'll be doing away with this distinction entirely, I think, and allow people to target objects just as they would mobs.
11 Aug, 2009, KaVir wrote in the 17th comment:
Votes: 0
David Haley said:
I did exactly this to implement destructible barriers, such as castle doors. I had a flag that marked it as "inanimate", so that it was a mob that didn't have any normal mob AI (including combat, although spells that "fight back" would still work allowing blade barriers etc.) – in other words for all intents and purposes it was an object that you could attack.

In the future, I'll be doing away with this distinction entirely, I think, and allow people to target objects just as they would mobs.


In GW2 I also define (destructable) buildings and furniture as specialised mobs, but it's not a solution I'm entirely happy with - I feel as if I'm breaking the OO design. Although you can attack regular objects as well, I built most of the combat functionality and messages into the creature class (because creatures have attributes, abilities and body part names). That was fine for things like stamping on a helmet or slicing up a shirt, but eventually I decided that I wanted destructable houses that were highly resilient to most forms of damage, could be attacked with descriptive location-specific messages, and would drop loot like a mob. It ended up being easier just to add them as specialised creatures.

I've toyed with the idea of moving all of the combat-specific functionality into the base class, but the fact is that most of it wouldn't be needed (or even used) for the majority of objects.

It's not just combat, either. I ended up with a "bookcase" that needed to be attackable in the same way as a creature, but had a lock that could be picked in the same way as an object. There are also certain buildings (which are actually creatures) that you can freely enter and leave - I've still not decided how best to handle their internal layout. It's becoming clear that a lot of things don't fall into the neat categories I'd originally envisioned.
11 Aug, 2009, Hades_Kane wrote in the 18th comment:
Votes: 0
David Haley said:
KaVir said:
Using mobs to represent walls might seem a bit odd at first glance, but it would perhaps be the easiest way to let people destroy them with regular attacks. It would also let you have walls that attack back (such as a 'blade barrier' spell, or a living wall, or whatever).

I did exactly this to implement destructible barriers, such as castle doors. I had a flag that marked it as "inanimate", so that it was a mob that didn't have any normal mob AI (including combat, although spells that "fight back" would still work allowing blade barriers etc.) – in other words for all intents and purposes it was an object that you could attack.

In the future, I'll be doing away with this distinction entirely, I think, and allow people to target objects just as they would mobs.


I think I called our act flag "statue" that makes a mob otherwise behave just as an object. It can't move, can't attack back, it displays in the room in the same way objects do, when you look at it you only see the description… It would be simply to script it to attack back in some customized manner, however.

I spent so much time building on games where little to no extra code was added to OLC or our mprogs and that forced us to become very inventive in what we could do with our progs and mobs… which has led to me thinking a bit outside of the box in regards to a lot of the area designs, OLC and program additions I've made over the years. I probably spend more time enhancing our OLC and program capabilities than anywhere else in the code, really.
0.0/18