another post cause phone

skroton May 27th, 2016 (edited) 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. To add to my post, the way to do factions in acs would be, all monsters get user var in decorate that will be faction, then run script on spawn that passes arg to script that sets their faction var from arg (in case needed later) then gives them a unique tid and stores it in the global array, and increments entry count for faction by one.
  3. Global array would be used since unlimited, but can't have multidimensional global array so array management would be needed. Array management would be: separate factions by largish number (say 1000) and first number in each faction (so faction[0], faction [1000], faction [2000], etc) is just the entry count for the faction, so if there are 52 monsters in faction 1, then faction[0] is set to 52, which is used so that the upper limit to check is known. You would also need an open script that continually checks if any particular faction is getting full, and if so shuffles everything in the array forward by 1000 (or whatever number) to make room, and a exit script to zero out the entire array.
  5. Now, for the actual scripts, you'd have in the spawn state along with the a_look calls to a script that would use
  7. to check line of sight between itself and monsters in enemy factions (after first checking that the tid does not reference a corpse) and then, for monsters that are in its line of sight, any max distance you would like to set. Either go with the first result that meets the above criteria or store them in a script level array until all are checked, at which point you can have them choose which to use
  9. on, either something like go after the closest or maybe pick a random one from all of them so that all monsters in one faction don't all target the same monster from an enemy faction.
  11. Then, during see state have a similar script that has a much smaller max distance and in addition checks players as well as monsters in enemy factions. Would also probably be a good idea for both scripts to limit how frequently a monster can pick a new target, like monsters do already. Easiest decorate way to do this would be to have a timer var that gets set to something like 100 or whatever when the targeting script successfully picks a target, then in the decorate this gets decremented every couple of tics and the targeting script immediately terminates whenever it gets called and the timer var is any value above 0.
  13. That would pretty much be all you need to do factions in zdoom, I think. It probably wouldn't even take that long to implement, if you wanted to upload your mod someone here could do it.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand