• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Giving a melee hero a bow and making him ranged

Status
Not open for further replies.
Level 14
Joined
Jul 26, 2008
Messages
1,009
So I want to do what many oRPGs have already done, take a unarmed ranged hero, attach a bow to him, and make him fire arrows.

Saw a few different ways to do this after googling but some of them don't work, or others are just incompatible. The morph and chaos method seem like they might do me more harm than good, as transforming a model may remove changed stats, bonuses, exp and skills added by abilities. Correcting that is problematic at best.

How do you set up these range changes most effectively?
I figure it may be World-Editor related but I also feel it could be script related.
 
There are several methods, it just depends on how much you can devote to working on it...

The morph/chaos method is pretty good, but you seem not to have the devotion to work on making it applicable for your map...

You can create a custom attacking system which will stop your unit from attacking if his current distance from the enemy is greater than the allowed distance of the weapon equipped... So basically, give him a super long range then make the system do the work for you...

anyway, no matter which method you choose, it will be hard work... though I think Nestharus has some kinda range system at the jass section...
 
Level 14
Joined
Jul 26, 2008
Messages
1,009
Well the Chaos method wouldn't be so bad if it wasn't for the fact that the heroes can get just about any spell in WC3 on a whim, making detecting what spells they had before transformation an over-the-top under-taking. Not to mention detecting their bonuses is also majorly difficult.

Also what about the missile for a ranged system, changing it from nothing to something? I might be able to do that, and just not worry about the tooltip, but we'll see. Not sure the mechanics, if those could be explained.
 
Level 14
Joined
Jul 26, 2008
Messages
1,009
Naw, not getting that far out of Warcraft 3's base system.

What I meant for the missile going from something to nothing was the model. When you attack melee there is no missile, but when you go to ranged you have to set a missile. I figure orbs or lightning attack will do the trick there.

Let me post my snippet I made in the WEHZ looking for help to describe my dilemma. If there's a way to code this using that UnitInRange JASS snippet then so be it, I'm just not sure how to use that snippet to accomplish this goal. Also isn't there a Native IsUnitInRange boolean by Blizzard already?

The problem is that the characters can be so heavily customized with any spell in WC3 on a whim and attachments for appearances the person sets themselves, detecting what was on the character before and after transformation is just not feasible.

So I have to figure out a way to make the character change from melee range with no missile to ranged after equipping a bow or staff and a missile model.
 
you can just use this library to do the range restriction of the attacks

http://www.hiveworkshop.com/forums/submissions-414/system-unit-attack-213779/

you can add/remove orb based abilities together when you equip/unequip the bow to do it I think... give the unit a missile art of none and then set the correct missile via the orb based abilities... then adjust the min/max ranges too of that unit on the above library when you equip/unequip the bow or whatever weapons...


but if missiles can change via the spells too, then you will really need to find a way to keep track of anything that happens to the hero...
 
You can create a custom attacking system which will stop your unit from attacking if his current distance from the enemy is greater than the allowed distance of the weapon equipped... So basically, give him a super long range then make the system do the work for you...

This is a bad idea. I tried once to order a unit to stop if it was about to attack a unit outside of it's field of fire - the result was basically that the unit would aquire the target over and over again so fast that it caused massive lag spikes if i had several units trying to do this at once.
 
JASS:
call SetPlayerAbilityAvailable(GetOwningPlayer(witchunit), ability_based_on_metamorphosis_id, true)
call IssueImmediateOrder(witchunit, "metamorphosis")
call SetPlayerAbilityAvailable(GetOwningPlayer(witchunit), ability_based_on_metamorphosis_id, false)
SotP has around 70 lines long script that handle few animation changes as well as melee/range calculations.
This above should be all you need to know.
 
I said stop it from attacking and it is not equal to using the stop order since there is a variety of ways to cancel and attack order... I think Nes used the follow order on his system...

Is that so?
Could i perhaps ask you, without hijacking this thread i hope, how you would then do to limit a units attack to, say, a 60 degree feeld towards a certain angle? Someone suggested i would give a disabled spellbook with an orc burrow+cargo hold ability in it to disable the units attack if it tried to target a unit outside it's field of fire, but in theory, that would screw up if there are other available units in front of it.
If anyone has an answer to this, i would be glad if you told me, perhaps by PM rather than here.
 
Level 14
Joined
Jul 26, 2008
Messages
1,009
-Kobas-, Will that system also transfer all non-initial abilities (I.E. Ones given by Scripts) and added attachments over to the metamorphed unit without me having to code it all myself?

No? Then I would rather not use it, as the Skill System and Attachment system in my game would complicate this. The characters can be assigned an unlimited list of spells and attachments with little to no detection on what those are. (It is a sandbox game)

I'm hoping UnitIndexer can be easily tweaked for compatibility with AutoIndex, as a majority of my spells use it. Either way I'm testing the system now.
 
Level 10
Joined
Aug 14, 2009
Messages
309
-Kobas-, Will that system also transfer all non-initial abilities (I.E. Ones given by Scripts) and added attachments over to the metamorphed unit without me having to code it all myself?

No? Then I would rather not use it, as the Skill System and Attachment system in my game would complicate this. The characters can be assigned an unlimited list of spells and attachments with little to no detection on what those are. (It is a sandbox game)

I'm hoping UnitIndexer can be easily tweaked for compatibility with AutoIndex, as a majority of my spells use it. Either way I'm testing the system now.

I've created a system where a hero can pick up a bow item and get a ranged attack; the only way to create it smoothly is by using metamorphosis.

A solution to your spell problem might be that when giving a spell to a unit storing the spell ID in a hashtable. When the unit picks up the bow and morphs just give him all the spells that are stored inside the hashtable.

(Note: if you're working with spell books there might occur a bug; you'll have to remove the spell book once).
 
Status
Not open for further replies.
Top