HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Ability that only affects one player - Best way?

03-13-2005, 05:19 PM#1
AnarkiNet
Hi,
OK, i have some passive critical-strike-based abilities that i only want to hit a certain player on the other team. (this is for my Lords of Magic map, Life units have a bonus against Death units, etc.)
the only way i can think of is to make the ability hit like only wierd things ("suicidal" or "bridge") and set all of that player's units to being that target.

Does anyone have an idea on how i could accomplish this with a more "sure" method? (that will work ALL the time and may not be quirky like my idea?)
thanks.
03-13-2005, 07:49 PM#2
Quickshok
Well you could trigger the abilities, but that would get pretty dicey with abilities like critical strike.
03-13-2005, 07:58 PM#3
Anitarf
I think your method isn't at all quirky, it's actually quite a good way to have the bonus effects you want without having to resort to triggers.

Well, you would need the triggers for one thing, to assign the classifications to the units when that player trains them, unless he has specific units no other player has, in that case, you can already set the classification in the object editor.
03-14-2005, 04:28 PM#4
AnarkiNet
Hmm, so what would be the best classifications to use?

the map is 8 players total, two teams of 4, so i only need 4 different classifications.
i can use "enemy" so it wont trigger if a player force-attacks an ally it wont trigger...

im thinking: tree, suicidal, bridge, something else... (im at school library now, cant think of a fourth lol )
would these conflict with anything?

thanks
03-14-2005, 07:22 PM#5
Anitarf
As far as I know, "suicidal" has no visual effect, neither does "aincent". Other classifications may be more of a problem. Some, like "Tauren", can't be assigned with triggers. Most others, like "mechanical", have a more or less considerate effect on gameplay, and they mostly also display the classification under the unit's name (this last problem can probably be fixed under advanced> game interface, but I am not certain).
03-15-2005, 05:24 AM#6
AnarkiNet
alright, thanks.
i'll experiment around and see what i come up with.
03-15-2005, 05:38 AM#7
AnarkiNet
odd..i cant edit post above...anyways,
it looks like i need to be able to change the "targetted as" field not the "classification', at least im pretty sure thats how its going to have to work. i only see "add classification" or remove, not "targetted as"
03-15-2005, 06:58 AM#8
Anitarf
Not neccesarily, the "targeted as" only appears to be important as far as air/ground is concerned, in my planeshifter map, I use unit clasifications to limit the targetability of units just fine. (and, if you check original war3, siege tanks, for example, have their classification field set to "mechanical", not their targeted as field, and they still can't be affected by heal or inner fire)
03-16-2005, 08:07 AM#9
Bulletcatcher
While classifications should work, I'd suggest replacing abilities instead.

It's not nessecarily better than the classification solution, and might even cause lag if massive amounts of units with the abilities attack eachother, but it's... safer. It *will* work 100% of the time if done correctly. (I can't guarantee my solution below is 100% correct, but it *should* be, unless passives that trigger on attacks work in very mysterious ways.)


The way to do this is to give, for example, your "life" units an ability that *looks* like critical strike, and says in the description that it works only on "death" units... but that doesn't actually *do* anything.

Do the same for other opposed factions, so you have a whole bunch of critical strikes that do absolutely nothing.

Next, copy the abilities and create versions that actually work of each ability. Don't bother with classifications and such, make 'em work against everything. Make sure the tooltips, icons and all other visible parts are identical to the abilities that do nothing.

Next, create a single trigger:

Code:
Event: A unit is attacked

Conditions:
You can leave this blank, but you might be able to reduce lag by adding some if it seems to be needed.

Actions (Copy these for all players, replacing abilities and players): 
If
(Ability level of  (Critical Strike vs Death (Dummy)) is greater than 0 for (Attacking unit)
and
Owner of (Attacked unit) is (Death Player)
then
Remove ability (Critical Strike vs Death (Dummy)) from (Attacking unit)
Add ability (Critical strike vs Death (Real)) to (Attacking unit)
endif

If
(Ability level of  (Critical Strike vs Death (Real)) is greater than 0 for (Attacking unit)
and
(Owner of (Attacked unit) is (Death)) equal to FALSE
then
Remove ability (Critical Strike vs Death (Real)) from (Attacking unit)
Add ability (Critical strike vs Death (Dummy)) to (Attacking unit)
endif

The way this works is that, whenever a unit is about to attack another one, it either gains or loses the ability to score critical hits depending on who the owner of the target is. If it's not supposed to crit, it can't - the ability is gone before the attack hits. If it's supposed to crit, it will - the ability to do so is added before the actual attack happens.

Hope it helped somehow, and if it didn't, just ignore this post.
03-16-2005, 11:10 AM#10
Guest
i might use that trigger
03-16-2005, 05:44 PM#11
Anitarf
I think that trigger should function correctly. With a good system using variable arrays, you could also decrease the ammount of if-then-else function the trigger has to go through considerably, but to be able to give you any advice on how to do that, you would have to give more detailed specifications regarding how many players you have, which player you want to have bonuses against which, etc...
03-17-2005, 02:08 AM#12
AnarkiNet
thanks for the help...i kind of solved the problem in a different way, i'm going to make each faith have different units so i can just use the "targetted as" field for each faith without any triggers whatsoever (for this part at least)