ID:169063
Aug 1 2005, 11:08 am
|
|
How would I go about making an NPC that blocks your path until you get a certain item?
|
Aug 1 2005, 11:44 am
|
|
well you could have a variable that once you have a certain item in in view(-1) it sets the variable to 1 if the variable is 0 the gate is dense if the varaible is 1 then it has the gate not dense
|
My way (and me being an ineffecient coder that atleast gets the work done) would be to make a turf that's where the NPC is at and the path you want to block (x - turfs, O - NPC with the turf there, | = wall) eg:
|xxoxx| If the client (let's assume you only want players to be blocked) tries to enter where the X is, it won't let them pass without that certain item... the coding would be something like this: turf Even if N.guard was not set to 1 or N was not near, M could not pass without the item... remember to replace things and not just copy/paste/run PS: I tested this and it worked, just remember to make sure everything is correct (like NPC's path, the object's name and path, etc) and to place the turfs along the path you want to block. Also add the guard var as a tmp since only certain NPCs will be using it and you can enter it in it's coding like so: mob/var/tmp/guard=0 //Default is 0 If you want anything explained, ofc (ofcourse) ask here or if you want to ask me directly, check up my email in my profile ;) |
In response to Flame500
|
|
Flame500 wrote:
well you could have a variable that once you have a certain item in in view(-1) it sets the variable to 1 if the variable is 0 the gate is dense if the varaible is 1 then it has the gate not dense Not, everything should be done that way. Sometimes, other people wish to have it different. GhostAnime's way seems resourceful enough. |
In response to MasterLink2003
|
|
Uhhh, mine's a text rpg, so I also want that when you go to that area, the NPC automatically talks to you and says that you can't go through.
|
In response to Seraphrevan
|
|
mob Thats extremely rough code, not sure if it works :P If it doesn't, look up Bump() in the DM reference |
In response to Nukes4U
|
|
I have no idea what I'm coding, but would something like this work:
if(ismob(M) && M.client) |
turf Not tested it should work... |
In response to Seraphrevan
|
|
Not sure if you still live (;/) but you just have to tweak my turf code a bit
turf |