29 Aug, 2009, boblinski wrote in the 1st comment:
Votes: 0
Hi there..

I'm wanting to make a special function that stops players from moving rooms so I can give certain mobiles this special function..

Does anyone have a pre-made spec_ I could look at? Or any advice on how I go about creating something to do this?
29 Aug, 2009, Exodus wrote in the 2nd comment:
Votes: 0
What codebase? Since you're referring to spec_funs I'll guess SMAUG or something similar. If you're attempting to force players to wait while the mob performs actions, consider creating a function that makes use of WAIT_STATE. I believe there's even an mpdelay command they can use via progs that does exactly this.

If you're wanting to prevent people from moving out of the room entirely while the mob is there, consider adding a new ACT flag like 'blocker' and create an ifcheck in the move_char function that checks for mobs in the current room of the player that has this, send them a message and return prematurely.

Hope that helps! If you still can't figure it out, please elaborate more on what you're trying to do and we'll see what we can do.

Edit: Oops, noticed this was in the ROM section.
29 Aug, 2009, boblinski wrote in the 3rd comment:
Votes: 0
Well, it's a spell.. called "bonewall"

You cast the spell in a direction, ie- north and it creates two mobs..

one in your current room, and one in the room north of you..
An undead barricade blocks your way north.
An undead barricade blocks your way south.

I want them to stop people moving between the two rooms until someone kills them.. (hence them being MOBs).
29 Aug, 2009, Igabod wrote in the 4th comment:
Votes: 0
check out the godwars codebase, there is a vampire skill called bloodwall I think that can show you how to do this. I'm sure there are other codes that have similar skills too but I don't know which ones off hand.
29 Aug, 2009, tphegley wrote in the 5th comment:
Votes: 0
What you can do is is in something like move_char, you can put an if check to see if your 'wall' mob is there and not let them move.
29 Aug, 2009, Antron wrote in the 6th comment:
Votes: 0
I'd use a mobprog. when the mob spawns, it removes/hides/locks the exit, or however you want to handle it. when it dies, it unhides/creates/unlocks the exit.
01 Sep, 2009, boblinski wrote in the 7th comment:
Votes: 0
I'd really like to hard-code this stuff.

Has anyone got any suggestions for how to make a spec_function trigger off the mob dying?
01 Sep, 2009, David Haley wrote in the 8th comment:
Votes: 0
You wouldn't do this with a spec_func. You would do this by intercepting the movement attempts and stopping them. spec_funcs are things that the mob does every once in a while, like an AI routine if you will.

EDIT: That said, I wouldn't do this with a mobprog either. I would have the move functions test for presence of one of these wall things. If you don't like testing the character list on every move, you can instead set flags and so forth, but then you have to be extremely careful that the flags are always removed when appropriate lest you end up with blocked exits with no walls present.
01 Sep, 2009, Ssolvarain wrote in the 9th comment:
Votes: 0
Might be able to code something off the Exit trigger for mprogs… No need to reinvent the wheel ;P
02 Sep, 2009, boblinski wrote in the 10th comment:
Votes: 0
I've done the coding to stop movement when a wall is present… (in act_move).. however now.. I'm wanting to make a spec_fun to trigger some code when the bonewall is killed… how might I do this?
02 Sep, 2009, Davion wrote in the 11th comment:
Votes: 0
I think you're confused with what a spec_func actually is ;). Just take a look how they're called. It's in update.c. spec_func's are not triggered, they are executed every time a mobile is updated. You need something that is triggered (an event is raised, caught, and reacted to). People suggesting mprogs is one way to go about this, simply because of the fact they're triggered on an event. These are currently the -only- things that are trigger based.

You'd have to come up with some other form of mechanics to do what you're suggesting with hard code.

Edited because I have a problem with trigger/triggered :)
02 Sep, 2009, David Haley wrote in the 12th comment:
Votes: 0
The method I proposed (of checking for a wall on each movement) obviates the need for a death trigger. The performance hit would be very small unless you had lotsalotsa mobs in the room.
02 Sep, 2009, boblinski wrote in the 13th comment:
Votes: 0
I'll explain a little more..

To stop people moving out and -in- to the room with the wall in it, there are now two mobs.. one in the room.. and one in the room next to it… If one is killed- I want the other one to die too.. can this be done with hard coding in any newbie-friendly fashion?
02 Sep, 2009, Davion wrote in the 14th comment:
Votes: 0
Uhh, I dunno. Do you have a way for the mobs to be aware of one another?

Just a side note. The way you appear to be doing sounds kinda… uhh bad? My guess is one mob is created to block players from leaving, the other is to block players from entering. Instead, you should just have an exit flag (EX_BLOCKED?) that handles this all for you. The only issue here, is the way exit flags are saved/loaded from the game. It uses some funky 'lock' system to make sure that locked doors are closed, etc (logical stuff). One way to handle it is perserve the logical checks by setting/unsetting the specific bits, and then saving the flag variable instead. This way allows you do expand exit flags to do other stuff, like hidden exits, damage-causing exits, etc. Being a coder and using solutions fit for a builder seems… odd :P.
02 Sep, 2009, David Haley wrote in the 15th comment:
Votes: 0
Extend my solution to check for walls in either the target room or the current room; problem solved without needing to deal with triggers or multiple copies of a mob, or exit flags, or anything like that.
02 Sep, 2009, boblinski wrote in the 16th comment:
Votes: 0
I've made it a mob because in RP aspects.. it's a bonewall made of skeletal minions etc…

Also- I want people to be able to attack the wall and kill it, thus unblocking the exit.

I've put mobs on both side to represent the wall "spilling" over into the next room.. and also so that it can be attacked from either side…
02 Sep, 2009, Skol wrote in the 17th comment:
Votes: 0
Bob, if you do the way you're looking at you'll have to extend the mob (or char) structure to include something like 'otherside'.

IE: in the deathcry function when it kills a mob, do something like this:
if (ch->otherside != NULL)
// blah whoop the otherside mob's ascii etc, extract it, and set ch->otherside to NULL
02 Sep, 2009, ATT_Turan wrote in the 18th comment:
Votes: 0
You can do what Skol says, or you can use some unused part of the mob's data - for example, I'm making the presumption that your walls are inert and do not participate in combat. If that's the case, when you create one you can create another mob in the room it's blocking the way you have it now, and set their CHAR_DATA *victim field to each other; this way, they each know where their other side is.

Then, you'd make an ACT_WALL flag to set on them each - this flag will want to do the following things:
* Not set their CHAR_DATA *victim field to players who attack the wall.
* Not clear their CHAR_DATA *victim field in violence_update because their victim is not in the same room.
* Check for its presence upon a mob's death, and if it's set as a wall, destroy the mob pointed to by CHAR_DATA *victim (and display a wall crumbling message in its room).

I would definitely do the movement-blocking aspect as David suggested and make sure that's part of your move_char.

If your walls are not inanimate (golem walls or made of elementals or something that you would want to attack characters back) then you'd have to do what Skol said and add a new field to the MOB_DATA structure instead of using CHAR_DATA *victim, but this should give you an idea of how to do it.