System Switch between a gun, and a sword

Dimaspy

New Member
Reaction score
19
Greetings!
First of all, credits to kc102 for giving a random idea for making this, since I had this problem.

-- Remember to post a reply about what you think, and +rep if you think it's good :) --

So, you have made a map. And you think "Wow, what if a unit picks up a gun, and it can shoot ranged attacks? And if it drops it, and maybe pick up a sword, it will do melee attacks?"
I thought this, and I tried to make this happen.
What I didn't realize at first, this is -very- hard to make, if you don't know how to make it! I figured it out with some help, and therefore, I'll give you a small guide of how you will be able to do the same. In this tutorial, I will also give a few examples of what you can do about the item stats, however if you are already done with this, jump to step 3.

1. The startup - Abilities
Alright, so let's get to it! The first thing we should create, is a new custom ability, out of the 'Item Attack Fire Bonus'. This is probadly the best choice of base ability to use, because it improves your attack, and also makes melee units attack air.

First of all, a gun can't possibly shoot big fireballs at slow speed, but small bullets at very high speed. Therefore, you should change the value of "Art - Missile Art" to something more fitting, such as 'Rifleman ... '.
Now, the art, cost, tooltips and alike can you change later. Now, let's move on to the data.

As a small safety thing, we will add these new stats to the combat attack 1. This will be the ranged 'gun' attack, and attack 2 will be the 'sword' attack. So, change the values of the following to more fitting ones for a gun, then copy this ability and change them to fit melee combat:
Code:
Data - Damage Bonus
Data - Enabled Attack Index   (Most important! use '1' for the gun, and '2' for the sword)
Stats - Cast Range
Stats - Targets Allowed (For gun: "Air, Debris, Ground, Item, Structure, Ward", remove Air for sword)

2. Next stop - Items
So, we used Item Attack Fire Bonus, didn't we? Well, let's use the item using this ability; "Orb of Fire".

This is probadly the easiest step, there is just one value to change: "Abilities - Abilities Your-Created-Ability"

Then of course, this was just the basic. You should change the texts, the art, the cost.. Just modify at your own free will.

3. "Boff, Boff, Ding!" - Upgrade
Alright, everybody knows that you can't degrade an upgrade (Huh?), so we will need two upgrades made out of the base of "Flying Machine Bombs". Aye, we shalt bomb thou!
However, there is another way of which you can change the levels, which means you only need one upgrade. But I'll make this very basic and simple, so we need two.

Now, change the names and whatever you want on these upgrades, for example, they tell you if the unit is using a gun, or a melee combat weapon at the moment.
Then, if you see "Data - Effect 1", you will see the value "Enable Attacks". On the gun upgrade, set the value of "Data - Effect 1 - Attacks to Enable" to "Attack 1 Only", as this is the gun attack of your unit. Why? I will tell you soon enough. And of course, on the melee upgrade, set the value to "Attack 2 Only".

4. Our beloved units - A choice of your own
Alright, switch back to Units in your object editor, and see the unit you would like to use these items with.
Now, what you choose here, will be the primary things used. Combat - Attack 1 should be ranged specialized, and Combat - Attack 2 for close combat. As Attack 1 is ranged, the unit will rather use the ranged attacks instead of close combat.

When you are done, roll down to "Techtree - Upgrades Used", and add your two upgrades.

NOTE: During gameplay, if one player has two units of the same type using these upgrades, they will both go ranged/melee when one of them has the item! I haven't solved this problem yet, I don't need to, and I wont add the solution if I find out! Sorry.

5. There's always one in each game - Triggering
This took me a while to figure out, but I will explain it.
Code:
Random trigger name
    Events
        Unit - A unit Acquires an item
    Conditions
        ((Triggering unit) is A Hero) Equal to True
        (Item-type of (Item being manipulated)) Equal to Insert-Gun-Name-Here
    Actions
        Player - Set the current research level of Flying Machine Bombs (2) to 0 for (Owner of (Triggering unit))
        Player - Set the current research level of Flying Machine Bombs to 1 for (Owner of (Triggering unit))
Alright, everything from the beginning.
Event: The unit picks up the item.
Conditions: The unit is a hero (no need to really), and the item being manipulated is the gun.
Actions: First we turn set the level of the close combat upgrade to 0, and the level fo the gun upgrade to 1.

And for the dropping:
Code:
Random trigger name 2
    Events
        Unit - A unit Loses an item
    Conditions
        ((Triggering unit) is A Hero) Equal to True
        (Item-type of (Item being manipulated)) Equal to Insert-Gun-Name-Here
    Actions
        Player - Set the current research level of Flying Machine Bombs to 0 for (Owner of (Triggering unit))
        Player - Set the current research level of Flying Machine Bombs (2) to 1 for (Owner of (Triggering unit))
Event: The unit drops the item in some way.
Conditions: The unit is a hero, and the item is the gun.
Actions: Set gun upgrade level to 0, and close combat level to 1.

5. The results of your work - Trying it out
Alright, save and try out your work!
And for those who didn't bother making at the same time as you read, here's the result done a little quick: RandomMapName.w3x.


Alright, thank you for looking this through, I hope it solved a problem of yours, and I wish you luck with your mapping!
And if you need some of the original colours added to your map, here's another tutorial made by me that will go through everything about it:[Tutorial] Colors in a nice way

See you around!
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
589
Stopped reading at step one.
Please go into more detail and maybe post a SS of the options you used to give readers a better understanding.
 

Dimaspy

New Member
Reaction score
19
Ehh... More detail? As in "open object editor, see Units" and such? I think it's pretty obvious.. :nuts:
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
589
No, I have no idea what you did or what to change to what.
 

Dimaspy

New Member
Reaction score
19
Right.. Well, I thought that only people who already know how to use WE in all ways was going to read this, newbies don't have much use of it.

But sure, I can rewrite the tutorial. But I'll have to do that in a few days, got to finish a release an update of my map first.
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
589
I'm just trying to help you make this more user-friendly.
 

Sim

Forum Administrator
Staff member
Reaction score
534
This should be a system, not a tutorial really.
 

Dimaspy

New Member
Reaction score
19
You think?
Yeah, I guess I could turn it into a system.. I don't have to explain how to make it in a system, I hope.. Well, explain what things does of course.

Whatever, I'll update this thread as soon as I have gone through it fully in my map.

I should've waited posting this thread.. :(
 

Prometheus

Everything is mutable; nothing is sacred
Reaction score
589
No, people can still learn from this, it'll just allow you to know what you did wrong or what needs improvement.
 

esb

Because none of us are as cruel as all of us.
Reaction score
329
Cool, i have been looking for a tutorial/system like this :D Thanks!
 

Dimaspy

New Member
Reaction score
19
Good thing it's appreciated, only need to update it now..

I made it weeks ago! Okay, I'll get to work right now :p
 

_markone_

New Member
Reaction score
0
i gotta disapoint u, but this
" Player - Set the current research level of Flying Machine Bombs (2) to 0 for (Owner of (Triggering unit))
Player - Set the current research level of Flying Machine Bombs to 1 for (Owner of (Triggering unit))"

do not work if u want to switch more then 1 time...
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top