Page 1 of 1

Close-combat attack for Dwarf and Warlock

Posted: Sat Oct 27, 2007 11:33 am
by The Vile
People from ProjectMagma,

I was recently roaming my FEAR and noticed something interesting: in the Dwarf collection at the COLLECTION REFERENCES directory, the frames 289 to 328 show the Dwarf unit pulling out a small sword to swipe through the enemy's chest/throat. It's possibly an unimplemented last-resource melee attack for the Dwarf unit (similar to Bowmen close-range dagger attack). I've created a new PROJECTILE named "dwarf sword swipe" to implement this resource (case possible).

Also, I've discovered in the PROJECTILES directory a melee magic attack for the Warlock unit named "23 warlock's staff attack" (not be confused with "23 warlock's staff of magic") in which the Warlock approaches an nearby enemy and casts from his scepter a bolt of lightning (similar to the Fetch's lightning strike) to fry and disintegrate the enemy instantly. I've taken this projectile and from it created a new one named "warlock staff attack" in order to fit every Warlock/Warlock Hero unit. Returning to the COLLECTION REFERENCES directory, the frames 91 to 138 and 141 to 198 from the Warlock collection are unused frames, possibly for this unimplemented magic attack.

So I'll throw now my question: how can I implement these melee attacks for Dwarf (sword swipe) and Warlock (lightning strike) respectively? Thanks a lot for any positive response!

OK, I'm going for now!

Posted: Sat Oct 27, 2007 12:31 pm
by A-Red
I'm pretty sure the Dwarf already has the melee stab, doesn't it?

Well anyway, you can just make them primary attacks, and make their maximum range lower than the minimum range of their distance attack. That way the unit will automatically choose whichever attack is appropriate for the distance of the enemy they're supposed to attack.

If you want to make it a double-click attack like the bowman's knife...I think if you give it a short range and don't check any boxes, it will automatically make it a double-click attack. Check the bowman's attack to see.

Posted: Sun Oct 28, 2007 7:30 am
by The Vile
I'm pretty sure the Dwarf already has the melee stab, doesn't it?

Well anyway, you can just make them primary attacks, and make their maximum range lower than the minimum range of their distance attack. That way the unit will automatically choose whichever attack is appropriate for the distance of the enemy they're supposed to attack.

If you want to make it a double-click attack like the bowman's knife...I think if you give it a short range and don't check any boxes, it will automatically make it a double-click attack. Check the bowman's attack to see.
Well, I tried out both solutions (in the Dwarf's case), but there's the same problem: instead of attacking with his sword, the Dwarf approaches the enemy, turns back and starts running away, then faces the enemy and keeps giving run and so. The same happens to the Warlock. Is there any solution can I fix this?

OK, I'm going for now!

Posted: Sun Oct 28, 2007 5:14 pm
by gugusm
Try to change his class to melee in monster tag maybe...

Posted: Sun Oct 28, 2007 10:43 pm
by Gleep
In the units attack box, you have to know the priorities. Primary attack is first, unmarked attacks are next. If you have more than one then the first in order goes first, unless you are not in range or need mana.

Copying the dwarf's throw attack to put it last in order and deleting the original should take care of your problem. Make sure the stab isn't marked as primary.

Posted: Mon Oct 29, 2007 5:09 pm
by haravikk
If you uncheck primary attack, and secondary attack for the melee attack you've created, then the attack will become a double-click attack, which is ideal for ranged units such as dwarves and warlocks, as it allows them to behave like ranged units and still have the stab option like bowmen. If in doubt then copy the bowman attack.

The problem you may be having is that if a unit has just attacked then it will be subject to recovery time, which for dwarves is quite long (comparatively), so the default behaviour for a ranged unit is to fall-back until they have recovered and can attack again.

Make sure the minimum range for the melee attack is 0.0, do not set a velocity for the attack (that one is more good practise than anything else). Make sure the attack type you selected is in fact a melee attack and not something confusingly named such "Bowman Knife" which is in fact a knife projectile that the dwarf will want to throw but can't due to aiming quirks (too low velocity etc).

Though it's unlikely you're hitting this one; if you put the maximum range of the melee attack to a number lower than the path-finding radius of the unit, then it won't ever attack, because it wants to move away to avoid being within the enemy's path-finding circle.

Posted: Mon Oct 29, 2007 7:47 pm
by The Vile
Hey, that's great! Thanks a lot for you who've helped me! I've tried out these hints, and now both Dwarf's sword attack and Warlock's thunder strike work fine. But there's one last problem: I configured the Warlock's staff attack to throw lightning bolts like the Fetch's primary attack, and the Warlock's strikes only inflict damage randomly and each "correct" strike deals minimun damage, such like a Warrior's sword blow. I want the Warlock to fry and disintegrate the attacked enemy with the same amount of damage and power just like the Fetch's lightning strike does. Thanks a lot for anyone who sheds some light into this final problem!

OK, I'm going for now!

Posted: Thu Nov 01, 2007 10:45 am
by The Vile
My Warlock's lightning strike still has the problem: it only randomly damages the enemies, but, strangely enough, deals normal damage (or even kills) an allied unit if I use the Control-click method to test it! When it strikes the enemy it does not cause the same great damage as a Fetch's lightning blast does! I just want the Warlock to have this powerful lightning attack as a defensive manuever against any close threats! Please, people from ProjectMagma, shed me a light on this!

OK, I'm going for now!

Posted: Tue Dec 02, 2008 9:38 am
by The Vile
Aaahhh, finally I'm done with this... Took some some brain-breaking but it's done after all (I only hope the Warlock's thunderblast isn't too cheap beacuse of it being too powerful for close distance despite using up his whole mana bar). Anyway, thanks a lot for help!