Page 1 of 1
Posted: Mon Apr 17, 2006 12:51 am
by :) Da Cid (: McCl
Yo.
Say, in this hypothetical situation (which I may be putting into action soon), there's a huge army of warriors. They're going to be in a situation where they get hurt. Some will die, some will live, some will be horribly injured. Either way, their families will never see them again.
Now, I have a load of artifacts sitting on the edge of the map, one for each warrior. When a warrior's health goes below 0.5, I want the artifact to go to him.
Okay, I've got this working for one guy, individually. I was just wondering if there's a way I can do this without having seperate map actions for each warrior? I tried just selecting the whole group of warriors in the subj and all the artifacts in the unit control, but that didn't really work (0.5 health of the whole group instead of each one).
So basically I just want a more compact way of doing this, because I plan on having a lot of warriors. :/
-TGP-
Posted: Mon Apr 17, 2006 5:30 am
by haravikk
You'll need a geometry filter, have this periodically check (I usually tend to give it a short delay so it isn't running constantly) for units among the group of warriors whose health has fallen below the 0.5 limit, and give them the artifact
If you want to go a step further, you should be able to build up a separate container for warriors who already have the artifact, this allows you to subtract them from the filter so you don't keep trying to give the same units artifacts they already have.
Basically what a Geometry filter will do is search for subj identifiers in a linked container (or you can place them directly in the GEOM if you feel like it), filter based on the flags, then throw the results into another empty container (using the results action identifier). You then specify how you what them saved (in this case add a tested items inside field parameter) so you can save them as subj, obje, enem or whatever you require. You can then finally tell it what to do when it succeeds.
Posted: Mon Apr 17, 2006 8:28 am
by William Wallet
Aye I had a shot at this for Cid, works fine - except:
16 warriors, 16 projectiles. It seems to assign a projectile to each half-health warrior, but the script doesn't seem to work on 3 or so warriors, each time. It leaves the test projectile on the ground.
So the script works, assigns the slow-me-down projectile to the wounded guy, yet it's not working for some of the guys.
Any ideas?
Posted: Mon Apr 17, 2006 8:45 am
by William Wallet
What's funnier, is that sometimes the script won't work immediately, but 30 seconds later the guy will be slowed down and recieve the artifact.
I guess it takes some people longer to succumb to their injuries? Now that's realism.
Posted: Tue Apr 18, 2006 9:12 am
by :) Da Cid (: McCl
Okay, thanks.
-TGP-
Posted: Tue Apr 18, 2006 4:11 pm
by haravikk
Hmm, I suspect the script might be trying to allocate artifacts that have already been given perhaps? ie it takes a while because it has to go round several times before it gives them the artifact? Would have to double check it.
A possible solution could be to have a GEOM find the units that need artifacts (and don't already have them, I'm pretty sure GEOMs can check for artifacts now), then have another GEOM find one artifact for each warrior and give them that result.
I'd need to create a test to see what can be done, I haven't scripted properly in a while now =(
Posted: Tue Apr 18, 2006 10:54 pm
by A-Red
I don't think it's possible for a GEOM to try to give the same artifact twice, since when it gets given out it is no longer on the map. However, it may be trying to give artifacts to the same units multiple times.
Try setting up a second GEOM that uses the "Subtract Monster Lists" flag. If you use this flag and provide a link to two monster containers, it will subtract the monsters in the smaller container from the list in the larger one. So your first GEOM can put units in a special container of units to recieve artifacts, and once they have recieved the arti you can subtract that container.
A-Red
Posted: Fri Apr 21, 2006 12:51 pm
by Graydon
I'm having a very similar problem on my map, and have yet to try my fix for it, but in theory, it should work. Like haravikk said, it's trying to give out a listed artifact that has already been given. Ared's right... it's no longer on the map, but it IS still in the list. SO what you need is a second GEOM.
Trigger this second GEOM as an ACOS on the first one, and have the geometry polygon set up around your collection of piled up artifacts. They're all projectiles, so you can search in the GEOM for projectile type inside location field name. It should find all the projectiles of given type, in that area. You can then feed that list into the original link you have for all these artis (or feed it directly as a param to the previous GEOM if you want.
By doing this, you effectively remove the artifact you've just given away from the list, every time an artifact is given away.
Edit: But like i said, I have yet to test this theory.
Edited By Graydon on 1145641930
Posted: Fri Apr 21, 2006 1:34 pm
by William Wallet
Theory perhaps, but it seems sound. I must try it out at once- wait, maybe I'll let Cid do it.