WizWom Posted September 20, 2006 Share Posted September 20, 2006 Well, I decided I'd try to get a handle on Rane() since I made a script where the NPC was switching to melee weapons at long range, and I needed to get a handle on why. So i make a script with a bunch of blocks, checking for range from 1 to 11. Range 8 is about 1-1/2 target circle widths. Range 2 is with target circles partially overlapping. Range 3 is a little bit of distance. Ok, I don't know how that works, since he was attacking me with a dagger at what the script interpreted as range 3. whatever, not a big deal. So, I made the ranges from 1 to 5 and up to 50... It took from sight contact to range 20-24 (which seemed to be about 2/3 visual range) for the script to kick over on a new enemy. Then I got script action at 15-20, 10-15, and 5-10. I'll have to test with a slow moving creature. With a Green slime, I get the first range trigger at 30-34, then 2-3 each of the groups until it gets into "contact" at a trigger of Range(,5) but not triggering Range(,1). Further tweaking makes it certain the furthest is 30 that "Range(NearestEnemyOf(Myself),)" gets triggered. Outside of that range, even if the enemy is seen by a freindly, the script won't pick it up. Now we get to the counter-intuitive bit: IF See(NearestEnemyOf(Myself)) !Range(NearestEnemyOf(Myself),5) THEN RESPONSE #100 DisplayStringHead(Myself,63078) // Where did Carston come from? END IF See(NearestEnemyOf(Myself)) Range(NearestEnemyOf(Myself),5) THEN RESPONSE #100 DisplayStringHead(NearestEnemyOf(Myself),4002) // Must you crowd so close? 'Tis bad enough I must walk with you chimps. END The first block triggers for any range greater than 5! Then the second block triggers as the target closes! It seems range triggers if the range is less than the specified number. Link to comment
WizWom Posted September 20, 2006 Author Share Posted September 20, 2006 Er, Actually, the IESDP already lists Range and triggering on less than or equal to the range you specify. And having a maximum of visual sight, 30. I even have written scripts doing that - er, I must have had a brain fart. Good job, igi! Link to comment
devSin Posted September 20, 2006 Share Posted September 20, 2006 A stinky one too. I'd always thought the association between Range(n) and "is within range n" was too logical to transpose. But yes, Range() is <= and !Range() is >. As for values, I don't think anybody has cared enough to precisely map in-game feet to pixel distance, so it's always just best guess. Link to comment
WizWom Posted September 20, 2006 Author Share Posted September 20, 2006 well, I wanted to have a melee weapon readied if anyone could get to my character before he could react with a script. Only switch to ranged weapon when an actual target was seen and targetable at range... But i messed up and wrote the Rangge() backwards, so it didn't work like I wanted .... heh. Newbie bug! Link to comment
igi Posted August 18, 2007 Share Posted August 18, 2007 W00t, the IESDP gets one right, yay. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.