Here's my code. It's not working quite right. Instead of only doing the stuff where "dostuff" is located if the object is a MineFragProjectile, it does it regardless of the kind of projectile it's found. Please don't tell me that "dostuff" is invalid, I know that, I'm simply focusing on the logic here. My actual script has stuff in there, but what's in there has nothing to do with filtering the reference walking results which is what this is about. The MineFragProjectile is just a convenient thing for me to use to test the logic, since I can lay down different kinds of mines and make sure only the frag mine triggers the code.
set WalkRef to GetFirstRef 51 depth 0 ; Projectiles
if WalkRef != 0 ;* * * NPCref exists
if WalkRef.gbo == MineFragProjectile
dostuff
endif
set WalkRef to GetNextRef ;Get the ref of the next WalkRef
Goto 51 ;Loop continues as long as WalkRef exists
endif
Anyway, how do I go about writing the filter since this code isn't working? I'm not new to programming by any means, please don't think that I'm asking you to write code for me. My job is actually video game programming in a *wide* variety of languages. I do mods for Bethesda games as a hobby. Thing is, the script language for Bethesda's games sometimes throw me off when I'm trying to do certain things since comparing and setting variables weird and it's not always obvious how to go about doing something. Heck, what I wouldn't give to be able to write functions. It would make some of my scripts a LOT easier to code and maintain.