• 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.

From Melee to Ranged by equipment (Like Bows)

Status
Not open for further replies.
Level 14
Joined
Jul 26, 2008
Messages
1,009
I want it so when my character equips a bow, his attacks go from melee to ranged. The only way is Transformation / Metamorphosis / Chaos from what I found googling.

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.
 
Last edited:
Level 12
Joined
Jan 30, 2009
Messages
1,067
Would using metamorphosis not work for what you're trying to do?

As in, when the bow is equipped, make it transform with metamorphosis. This would make it ranged.

Is that more or less what you're trying to do, or am I misunderstanding?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Wc3 doesn't allow that. You'll have to do a passive unit metamorphosis with triggers. It's pretty easy. There's a tutorial here in hive.
 
Level 14
Joined
Jul 26, 2008
Messages
1,009
Yeah, I know. It's extremely simple and easy and I've even done it several times for complex transformations.

Problem is, and I know I'm repeating myself here, transformation/chaos/metamorph/etc. completely wipes out any and all skills not initially on the base unit and also removes all attachments on the unit.

My map allows a TON of these to be added on a player whim if they choose. Re-adding them after transformation is almost impossible because there's no feasible way of detecting what skill/skill lvl/attachment was on the unit before change.

None-the-less everyone who has responded (Even if they may not have read my first post and only read the title) at least understands what I'm trying to do. Melee unit equips bow, and now has X range and fires arrows on attack.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Lol... keep track of the Abilities the unit has in a Hashtable and their levels. I think items too, then add those abilities and items to the new-morphed unit.
 
Level 14
Joined
Jul 26, 2008
Messages
1,009
Fair enough, Spartipilo.

I would have to save the level and skill level every time any trigger is called that adds an ability to a unit and save that ability in a slot. Also abilities can be removed, so I would have to find a way to adjust and remember which skills have been removed and which haven't.

That means 1 variable/key which cycles through to keep track of what skill has been removed and what one has been added.

One variable/key per skill to save the skill level of each skill.

A variable/key for every skill slot to store the skill in.

Then save each attachment for the attachpoint, attach slot, and the attach string. Also keeping track when that attach slot has been nulled or emptied.

I don't want to have to do it this way because it's bulky, messy, prone to bugs and lost values, could leak, and time consuming beyond all hell.

This makes metamorphosis my last choice, as it's easily a high-hour job just to adjust all my scripts to accommodate that.

And yet somehow, despite asking not to have to hear the suggestion of metamorphosis in my first and 2nd post it's been repeated to me to just do that. Even the system given is just a fancy Metamorph skill. I'm tempted just to make another thread that says in the title "WITHOUT METAMORPHOSIS OR CHAOS OR TRANSFORM". If nothing else I'll amend my first post for it.
 
Titanhex said:
as it's easily a high-hour job just to adjust all my scripts to accommodate that.

This is why base systems are the first one you should make when creating maps...

Plan out everything first about how the map should go and create the base systems that you need before creating things like spells and items and whatever... When talking of base systems, I mean systems like projectile systems, damage systems, stat systems, equip systems etc depending on what your map needs... and in this case it might include a system which keeps track of effects done by your spells...

Because just like you said, editing things afterwards when we add new systems and such is a tough job...

Btw, I posted a possible method on the other thread...
 
Level 14
Joined
Jul 26, 2008
Messages
1,009
Indeed. I stand by the basis of deep planning on any game anyone makes. Even to the extent of writing a Game Design Doc before beginning work/recruiting. I unfortunately do not have that luxury. I must make due. Even prepared to code something like the aforementioned for metamorphosis.

None-the-less, this has been an evolving game which has seen the addition of many features it previously didn't have plans for or didn't exist prior to it's inception.

Thank you for the possible method Adikutz, I'll be looking into it in the other thread. It looks like it might work.
 
Level 17
Joined
Jul 17, 2011
Messages
1,863
oh this is quite simple the orbs (i believe it was orb of slow) have an ability which allows you to enable your hero's second attack thus if your hero was mele after equiping an orb with a bow icon he will switch to second attack which you can set to be ranged in the object editor just play around with it
 
Using the second attack is not a good option actually, because the unit can only have 1 second attack meaning you can only have 1 melee attack and 1 ranged attack ranges... It has actually already been mentioned on the thread of Nes' system, because he was actually the one who thought about using orbs to enable second attack of a unit instead of using an external library like the one he made, but sadly it can only allow up to two attacks per unit...

so right now, the best will be using Nestharus' attack system then use orbs to adjust max/min range of attack and set the correct missile model... because using this, you can have almost infinite number of available attack ranges... though one major setback is that you won't be able most of the other orb effects...
 
Level 14
Joined
Jul 26, 2008
Messages
1,009
I would actually consider the ranged attack enabling through orbs for Attack Index 2, but I have no clue how to disable Attack 1 to make Attack 2 the primary attack when switching. As-is if I do it through enabling the index, he only fires bow-and-arrow at flying units.

With Auto-Index in my map, I'm having troubles making Nestharus's system compatible with Unit-Indexer.

May even just consider writing heavy code for Metamorph, though I don't want to. We'll see. At least a lot of things have been put on the table.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
...completely wipes out any and all skills not initially on the base unit...
This can be solved by using JASS function,

  • Custom script: call UnitMakeAbilityPermanent(udg_Unit, true, 'A000')
Unit as your Unit Variable type
A000 is your Ability ID which is to make it permanent even after morph

This function is to prevent abilities that are added to unit to disappear right after morphing into another units.
 
Level 14
Joined
Jul 26, 2008
Messages
1,009
Yeah, I realized that and decided to switch to using Metamorphosis and finding a way to transfer the attachments on morph (Haven't tested if they get removed.)

Unfortunately intertwining the custom inventory and equipment system with the metamorphosis is going to take some thought. I haven't started tackling it yet.
 
Status
Not open for further replies.
Top