TFMurphy
Level: Smitemaster
Rank Points: 3118
Registered: 06-11-2007
IP: Logged
File: kolby.txt (213.5 KB) Downloaded 59 times. License: Public Domain
|
Re: Kolby's Challenge Sequel (+4)
I think you were overthinking the solution. There's a very simple brute-force way of doing exactly what you want with as many monsters as you want, and it has the benefit of not suffering from the kind of bugs that cropped up in Kolby's (like The passageway: Twice West). The drawback is that it does involve about 6 to 8 times the length of code. Oh, and you can't use it with NPC monsters unless you want to double the code's size.
I've attached the script. While it is much bigger than the scripts in Kolby's Challenge, it'll do the job, and has about the same impact on DROD's running speed as Kolby's Challenge (which isn't that much in the grand scheme of things).
Alternatively, you can wait until the DROD RPG commands are ported back to TCB sometime in the future (when that'll be is anyone's guess, but it likely won't be the next patch, at least). With that, it'll be very trivial to code what you want. But until then....
EDIT: Here's a slightly smaller version that still does the same job. I'll note that it does actually take a bit longer to run through both the original script and this one, but since it's only one script and not really that complex a script (no hundreds of loops per turn or anything), it's still really not that bad. Running time *could* be improved by adding a "Go to End" after every Monster check, but that'll push the size back up to the original script's level.
EDIT 2: Actually, thinking about it - both this and the original script I attached should be faster than Kolby's: in a worst case scenario, the script will check the player's position up to 70 times (from 70 commands), and check for a monster's position 9 times (from 1 command). A player position check is very fast (it only compares the known position of the player to the boundaries of the rectangle), while a monster position check must check each and every square in the rectangle. By comparison, Kolby's checked for the player's position 70 times (70 commands) no matter what, and checked for a monster's position 2432 times (from 70 commands). And Kolby ran fine, as far as I'm aware. A group of Slayers would have far more of an impact than this lot of scripting.
Can't really do anything more about the script size though, I'm afraid.
[Last edited by TFMurphy at 07-15-2009 08:55 PM]
|