Hey everyone,
What I'm trying to do right now is put together an entry_prog that will cause my mob to react to people when the mob itself enters a room. I've got a greet program that works fine when someone else walks in, that's not the issue at all. My problem is that I can't seem to get the mob to react properly when people come in.
For example. I want to do a very simple ifcheck such as
if isevil($n)
and isnpc($n)
or is<blah>($n)
etc etc...
murder $n
endif
This works fine for the greet_prog but not the entry_prog. I read somewhere that the entry trigger requires you to use $r so I tried that, but it doesn't work either. I guess you probably see what I'm trying to do with this? I basically want the mob to kill anything that fits a certain demographic when either a) he goes into a room or b) they come into the room where he's already at. I've gotten part B to work out fine. It's only the entry half of it that gives me grief.
Does anyone have suggestions on how to make an ifcheck like this work, or some way to facilitate what I'm trying to do? I'd like it to do this with both NPC's and, say, pkillers for now. Like I said I can program this just fine for a greet_prog and it works like a charm but obviously the same won't work for entry_progs an I need to know how I should change it.
Any help is greatly appreciated!
Where did you put the $r? This is what the help file says ...
Syntax: entry_prog <NUMBER>
Again a percentage argument.
NOTE: The opposite of a greet_prog. Whenver the mobile itself enters a new
room, this can be triggered. Useful for looking around, or waving
or other things that real PCs do when they arrive at a crowded room.
Only the first successful one of these is done so the mobile doesnt
look stupid by repeating commands resulting from multiple MOBprograms.
Sigh...
Here we go again. Yes I read the manual. I read the helpfiles, I went to websites. That's where I got the notion that you can't use $n with the ifchecks in the entry_prog at or at least not the first one[s], because it needs to be a random person/actor in the room since no one person $n triggered it.
I did a simple entry_prog 100 that went something like this;
if isevil($r)
murder $r
endif
This won't work. I've tried copying my exact greet program into an entry program:
if isevil($n)
and isnpc($n)
or ispkill($n)
say Death to thee $n!
murder $n
endif
I swap out the $n's with $r's and nothing changes, still doesn't work when used as an entry prog. So what am I doing wrong? How do I go about getting my mobs to randomly target someone with this entry program and execute whatever kinds of commands (in this case killing them)?
For starters, if the examples you gave are anything close to what youre attempting to test on your mud there are several very definate issues to address.
1) The entry triggers check for evil npc or pkill targets.
2) If yer trying to test with an immortal character (and I suspect you are) the mprog engine is designed NOT to trigger any violence on immortals.
3) If you arent testing voilence triggers be certain you aren't wizinvis or the mob wont see you to react to you.
4) It has been my experience that using entry progs to initiate combat is **at best** difficult. More often than not, using entry progs to initiate combat is more trouble than its worth when simply slaping an aggo flag on the mob will acomplish the same results. If you absolutely have to have the mob react to a specific set of chars with violence, make it stationary and use a grall prog.
I tested this countless ways, as I did the other one. I had the mob enter with me in the room. I had the mob enter with another player in the room of any particular level, pkill or otherwise. I even tried stripping the requirements and just having it kill SOMEONE, ANYONE at random when it entered. Nothing happened. I tried having other mobs wait in the room, made sure to 'switch' into my killer mob and make sure he could 'see' these people waiting there when he walked in. The mob is entering the room, seeing the people, but this entry_prog will never trigger.
As a side note, the greet_prog I have, which does work, strangely enough *will* attack me when I go into the room with the mob, as long as I'm not invis or something. But I never banked on the results of testing with an imm character anyway. Like I said I tried using regular players and other mobs in plain sight as bait for the trigger when I had this mob walk into the room. The targets are there, and the mob can see them, but when the mob enters the room his entry_prog never triggers and he never attacks anyone.
I'd love to just use an aggressive flag on the mob, which I did with another similar character, but I want **this** particular wandering mobile to be picky about who he's aggressive towards when he strolls into a room. That's the whole motivation for this. I also want to be able to get it to be aggressive against others mobs in the same way my earlier specified greet program is, which an agg. flag won't accomplish.
Does this make sense? Any other suggestions?
Suggestions? Write a spec function. All the function with none of the finickyness.
Run under gdb, set a breakpoint at mprog_entry_trigger and then trace mprog_driver to see what it thinks it is doing. The code is complex enough that it is hard to see what might be wrong.
Alternatively, put in some judicious printfs to see how far through the code it gets. eg. in mprog_entry_trigger, in mprog_driver near the start, and so on.