HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Help with Charm-like skill

09-20-2003, 07:58 PM#1
ManniVersion3
I am making a skill that is based on charm. It is called "Recruit". Therefore it works on allied units only and it is, unlike charm, a regular skill, not an ultimate.

I got the above to work pretty easily using the ability editor. However, I want to impose some restrictions on the skill. On Level 1, you are supposed to only recruit footmen. On Level 2, you can also recruit archers, on Lvl 3 also knights and priests. Furthermore you shall be able to control only 3 units on skill level 1, 5 units on level 2, 7 units on level 3.

I tried to to it using triggers, but it does not seem to work at all :(
09-20-2003, 08:09 PM#2
Saethori
Sounds complex.

I don't think you can do something like that with Charm, so best bet would be to create a dummy skill that can target units, and use triggers to accomplish what you want, like..

Event - Unit casts 'Recruit' (may need different skills for multiple levels)
Condition - Variable 'Amount' lesser than 3

Then set up Ifs that check unit type, for each successful match based on level execute
Action - Set Amount to Amount+1
Action - Give 'targeted unit' to owner of 'casting unit'
Else do something which says it didn't work, like display "You may only recruit Footmen"
09-21-2003, 01:43 PM#3
ManniVersion3
Okay I created a dummy skill based on banish and tried to make a trigger like the one you described. However, I can't make the event you described. I can only make an event

Unit (my hero) begins casting an ability or
Unit (hero again) starts the effect of an ability.

I cannot specify the ability, like "Unit begins casting Dummyskill 1".
09-21-2003, 03:30 PM#4
Dragon
E- Unit Begins Casting an Ability
C- Ability equal to (Your ability here)
09-22-2003, 02:56 AM#5
ManniVersion3
I got it to work now, thanks to you and to this helpful thread. I have these 2 triggers:

Trigger 1:
E: Unit - A unit owned by Player 1 (Red) Starts the effect of an ability
C: (Ability being cast) Equal to Recruit1
A: Unit - Change ownership of SpellTargetUnitVariable to Player 1 (Red) and Change color

Trigger 2:
E: Unit - A unit owned by Player 1 (Red) Is issued an order targeting an object
C: (Issued order) Equal to (Order(banish))
A: Set SpellTargetUnitVariable = (Target unit of issued order)

However, since I wanted the skill to be able to recruit only footmen at level 1, I added this condition to Trigger 2:

(Unit-type of (Targeted unit)) Equal to Footman

But it does not work; whereas without this condition I can recruit any unit, the skill works not at all with this condition.
09-22-2003, 03:11 AM#6
Dragon
T1
E: Hero Learns Spell
C: Spell equal to Recruit
A: Set FootmanRecruit to 1

T2
E: Hero Begins casting a spell
Hero Targets a unit
C: Spell Equal to Recruit
FootmanRecruit equal to 1
A: Bring footman to the darkside (lol)

Repeat for each level of the spell.
09-22-2003, 03:42 AM#7
Dragon
I tried to do it, but failed....

I'm sure my problem lay in the fact that I used "Targeted unit" a few times. Oh well...
09-23-2003, 04:13 AM#8
ManniVersion3
First of all, thanks very much, you already helped me a lot.

I tried to create the triggers you suggested, but I faced 2 problems:

On trigger 1, the condition "Spell equal to Recruit" does not work; for some reason I can only choose regular hero skills here. I tried this condition:

(Learned Hero Skill) Equal to Human Blood Mage - Banish

since I based the Recruit skill off banish, but it didn't work.


In trigger 2, the action does not work: "Bring footman to the darkside"

The basic problem is that the unit should only be brought to the darkside (oh well;) ) if it is a footman; that is why I need something like "(Unit-type of (Targeted unit)) Equal to Footman" as a condition.


The whole problem would be solved if only this condition: "(Unit-type of (Targeted unit)) Equal to Footman" worked properly. Can you imagine why it doesn't?
09-23-2003, 05:05 AM#9
UltimateJim
simplest way to do this: set footman level to 1 archer level to 2 and knight/preist level to 3

then make the charms spell only able to target units that r level 1 @ level 1, and level 2 units @ level 2, and level 3 units @ level 3, then maybe make food restrictions or something, or some triggers

a spell is cast, casting spell equel to charm

set variable to variable+1

another one

a spell is cast, spell eqel to charm

if variable equel to (however many units u want) then transer control of targteted unit to (last owner? or player 1 red or w/e)
display message: too many units controlled
09-23-2003, 09:58 PM#10
Otiluke
Just to warn you, this will be long and complicated work for you but it appears to be the only way.

By the way, use UMSWE4.0 because that is the tool I am using, and older less effective editors may not have the same functions.

Ok so you want to make a charm-like spell grant control over a limited number of units, and only units of a certain type, based on the level of the spell.

You have 3 variables here:
Variable 1 would be the number of units allowed
Variable 2 would be the types of units allowed
Variable 3 would be the level of the spell

And a few control variables:
Variable 4 would be the number of units controlled already

For short let's call them V1, V2, V3, and V4 respectively.

Next you need to identify when the spell is cast, what it was cast on, and how many units they already have, however due to a limiting factor in coditions you can't identify the spell.

Solution: Identify everything that it isn't, to identify what it is.

Now it is a matter of how many things exist that you cannot identify, and because the spell must have at least 3 levels that can be differentiated, there exist three unknowns.

Solution: Track what the player has access to.

By following their choice in and heroes and hero spells you can identify which spells they have and do not have access to, thereby narrowing the possible spells to one (This is because as you increase the level of the spell you lose access to the previous levels which you obtained earlier).

With the spell and level of the spell identified you have a condition to identify what the spell is, when it is cast.

Next you need to identify when the spell is cast, what it was cast on, if the target was legal, and what the spell should do about it.

Here is an outline of your triggers:

Trg1 (Level 1)
E: Unit - A unit owned by Player 1 (Red) Starts the effect of an ability
C: Ability being cast is NOT equal to (Place this condition once for every other possible ability)
+C: Value of V3 equal to 1 (V3 is identified above)
+C: Value of V4 less than or equal to V1
A:

Hold on let me figure out how to identify the unit that was targeted. I'll edit the post later.
09-30-2003, 03:22 AM#11
ManniVersion3
Sorry that my reply comes late, I've been without my comp for the last few days.

I got it to work now. In the end, I did it pretty much the way UltimateJim suggested, and I learned quite a lot by trying out all those different ways you described :D I could do it this way since the map I need it for is quite simple, otherwise I would have had to use one of the more complicated ways.

There is only one small thing that has to be fixed yet: If too many units are charmed, the unit above the unit limit is given back to the computer player. The hero, however, loses the 100 MP mana cost of the spell. I cannot find a trigger to set the mana to current mana + 100 so he actually loses nothing.


What would be even better: Is there a way I can make the spell uncastable while the player controls the maximum of units? Then this problem would not occur at all.
09-30-2003, 03:24 AM#12
UltimateJim
try "disable spell" i think its located under the player triggers, else just do search