Weapons system

Xialian

Member
Reaction score
8
Hi again!
Adding on to the endless train of random questions!

I've recently played two maps with a friend:

Map one was a Counter-Strike map, having an ammo system with reloading, picking weapons, using them from "spells" and manual shooting, than can fly a few degrees from the target point, adding spread.

Map two was a map called "Afterlife", having different characters based on your weapon choice, having ammo scattered around. The weapons would give ammo to the gun after reloading, and reloading would consume ammo from the inventory.

Both maps are protected, and by that I have no way of figuring out, how any of those systems could be remade for a map, that my friend and I could play together.

I can link or upload both maps if necesarry.
 

Varine

And as the moon rises, we shall prepare for war
Reaction score
803
I would imagine each weapon has some kind of scripting set up for it that makes an array to hold the relevant information, and uses a dummy spell or something to use for tracking it. Or it just uses a dummy spell that detracts from the inventory system, with another trigger that says when selected weapon's ammo <= 0 it reloads from auxiliary supply. Have you tried anything yet?

Besides that, there are ways of unprotecting the maps. If it runs in the game, you can get into it running in the WE.
 

Xialian

Member
Reaction score
8
I don't have any idea on, how it's made. No attempts yet. I'm terrible at deprotecting, but watched a few guides and such, but they all resultet in the map being visible, but units and triggers not appearing.

I've asked the author on Hive, although he's not that active and haven't responded yet.
So I'm on square one, as I have no idea, where to start and how to do stuff about that.

BTW, Do you know of the map, or should I link it to you?

Edit: I also hope that it's GUI, because I know absolutely nothing about JASS or vJASS
 

DrEvil

FCRI Associate!
Reaction score
111
I made a map with a friend quite some time ago and we had a secondary weapon system.
You first registered all weapon types at the start.
Name, Max Ammo, Reload Time, Shoot delay, Damage, Model, Size e.t.c..
And then you would call a function to set a unit's weapon to a specific weapon in the list.
(Pick up a gun item, it changes your current gun, type of ammo...)
When the shoot ability was activated it would check if it was reloading, had ammo, if it passed all the criteria it would fire, reset the delay, remove 'N' bullets.

Fundamentally it isn't complicated until you want the weapons to be complicated, machine guns, rocket launchers, accuracy when running, bullet's do less damage further they travel, you get the drift.
The concept of having guns, ammo and shooting is nothing too hard :p
 

Varine

And as the moon rises, we shall prepare for war
Reaction score
803
Without JASS it's probably going to be somewhat of a pain in the ass, but I'd imagine it's possible.

What I would do initially is set up a system and have your character do a base of 0 melee damage. Each of the weapon items could would increase the range and attack damage (both of which I think there things ingame that do that, so it wouldn't even involve triggers I don't think).

Then, with the ammo system, you would have a trigger that checks if the player has ammo in their inventory before each attack sequence (I'm guessing it you can do that somehow as a condition, I haven't even looked at Warcraft for like four years). If so, attack proceeds, if not attack is canceled.

That would be a really basic workflow for a basic system. Obviously, you would have to do this for each weapon type, but I don't think it's exactly what you want. It would be a start though.

And as Drevil said, it becomes more complicated. The game isn't really designed for units to attack while moving, so you have to circumvent shit like that (I'm sure that Hive has some resources to do it). Basic physics systems have been implemented into games like this (bullets act individual entities basically, and can collide with other things so you can hide behind cover, eventually hit the ground, etc), and then things like rocket launchers will probably need another trigger to handle the explosion and AOE damages.
 

afisakov

You can change this now in User CP.
Reaction score
37
I am not familiar with counterstrike, but I know that afterlife "equips" the gun by replacing the hero with a version whose attack is that gun type and then transfers all the items to the replacement hero and sets his lvl/exp accordingly.
I have a pseudo deprotected version of afterlife that only has the object editor data in it, bt that can show you how the items and heroes are set up.
Unfortunately I have no way to revert the triggers to Jass so you would probably have to make your own version.
If someone can remind me how to post a map to here or you want me to email it to you I can do that so u can see the units.
 

Xialian

Member
Reaction score
8
Can't you use the "Upload a File" button next to the "Post Reply" button for the map?

Also, the system I'm looking for is somewhat like Afterlife. I'm planning on making some sort of Co-op shooter / 1v1 map with guns, reloads and all that kind of stuff. Can you explain how the shooting spreads and when it takes ammo out of the inventory and reloads? Because I can't think of how that works.

*How do I edit that "Member" thing into something I'd like?
 

afisakov

You can change this now in User CP.
Reaction score
37
Here is the object data.
Every weapon has a dummy ability called reload. When used it checks if the weapon is equipped, if so then it has a delay and then "reloads" by increasing charges in teh gun to max and subtracts from the "clip". Presence of a clip checked by item type and its charges are decreased by the appropriate amount.
Keeping track of ammo type can be done with an array or with a dummy stat on the transformed unit.
If gun not already equipped using the dummy reload ability equips it, replacing the unit with the one of the type of gun equiped and sets hp, mana, exp, items the same.
 

Attachments

  • afterlife stuff.w3x
    103 KB · Views: 285

Varine

And as the moon rises, we shall prepare for war
Reaction score
803
The best way to make a spread is to treat the projectiles as individual entities. When the player fires, it creates x projectiles travelling through some algorithmic path and wait to collide with another entity, then are destroyed and damage is inflicted to whatever they ran into. Which is going to be a pain in the ass with GUI, but whatever.

I don't see why you're focusing on any of this currently though; you need to get a basic firing system running and can modify and build from there. It doesn't work the other way around.
 

Xialian

Member
Reaction score
8
Alright. Can I make one with some damage detection system? I think something like that registers, when you attack. Then I can make it hit X amount of times, then you have to reload it from the inventory. The spreading was in the CS map, and is completely unnecesarry when it comes to what I will focus on now.

I think I can make my own system, but I have no idea on how to make it check for ammo, use it and such.

Also, when it comes to that map, I realize all models are missing. This doesn't matter, though. Not at all. I'll try to make a demo map with different weapons, and see, if it'll work.
Thanks for all the information so far, though!

Edit: Things I am missing
-Ammo system
-Probably something else I forgot, but I can't remember
 

afisakov

You can change this now in User CP.
Reaction score
37
some of the triggers to help with this, and/or give you an idea of what to do.
The array setup would have to include all the ammo types you are using.
The reload one is not fully finished yet, but should still get the point across and I was just getting tired.
I made them in the afterlife obj map that I now reattached.
I know the models are missing, this is only object data from the map to give an idea of how it was made. Adding all the models back in would have more than tripled map size.
For a test map yo can just choose a couple units and set their models to wc3 defaults like rifleman so u can see them.
Or import one of the tons of models available on Hive workshop.
Code:
setup
    Events
        Time - Elapsed game time is 1.00 seconds
    Conditions
    Actions
        Set gun_wielders[1] = AA-12
        Set gun_wielders[2] = AK-47
        Set guns[1] = AA-12 Automatic Shotgun
        Set guns[2] = AK-47
        Set max_ammo[1] = 20
        Set max_ammo[2] = 30
        Set ammo_type[1] = .17 cal Ammo
        Set ammo_type[2] = .223 Ammo Belt
        Set ammo_type[3] = .338 Lapua Magnum
        Set ammo_type[4] = 12 Gauge Shotgun Shells
Code:
reload
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Reload 
    Actions
        For each (Integer A) from 1 to 10, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Unit-type of (Triggering unit)) Equal to gun_wielders[(Integer A)]
                    Then - Actions
                        Set int1 = (Integer A)
                        -------- runs through all gun_wielder types and sets integer to the one you are using. --------
                    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Charges remaining in gun_equipped[(Player number of (Owner of (Triggering unit)))]) Less than max_ammo[int1]
                ((Triggering unit) has an item of type ammo_type[(Item level of gun_equipped[(Player number of (Owner of (Triggering unit)))])]) Equal to True
            Then - Actions
                Set ammo_to_use = (Item carried by myhero of type ammo_type[(Item level of gun_equipped[(Player number of (Owner of (Triggering unit)))])])
                Set stock_ammo = (Charges remaining in ammo_to_use)
                -------- the arithmetic here of giving increasing charges to max in equipped item if stock_ammo has more than (item_max-item current) and decreasing ammo in stock by that amount... getting tired here. --------
            Else - Actions
Code:
use ammo
    Events
        Unit - A unit Is attacked
    Conditions
        (Owner of (Triggering unit)) Not equal to Player 12 (Brown)
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Charges remaining in gun_equipped[(Player number of (Owner of (Attacking unit)))]) Greater than 0
            Then - Actions
                Item - Set charges remaining in gun_equipped[(Player number of (Owner of (Attacking unit)))] to ((Charges remaining in gun_equipped[(Player number of (Owner of (Attacking unit)))]) - 1)
            Else - Actions
                Unit - Order (Attacking unit) to Stop
                Floating Text - Create floating text that reads out of ammo! above (Attacking unit) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 30.00% transparency
                Floating Text - Change (Last created floating text): Disable permanence
                Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
 

Attachments

  • afterlife stuff.w3x
    104.5 KB · Views: 256

Xialian

Member
Reaction score
8
These triggers make sense to me! Hurray!

Even though the models aren't necesarry, I would love to have them, as file size doesn't matter. Do you have the icons as well?
I may have misread it and you don't have anything, but I'm really interested.


Just to ask for something completely differerent but still relevant: Are any of you good map deprotectors?
 

vypur85

Hibernate
Reaction score
803
Just to ask for something completely differerent but still relevant: Are any of you good map deprotectors?
Well, let's leave this question to continue be irrelevant. It's not supported.

afisakov has done a lot to help. Perhaps try out what's been suggested using your own creativity.
 

Xialian

Member
Reaction score
8
He has. I'm very grateful, afisakov! It might not show a lot (sorry), but I am. The system should work, when I start adding some items and fiddle around with it. Copied the triggers (thanks again) and will continue working on it a little later.

The deprot thing was just some off-topic stuff for other maps. In tihs case, I would most likely only want the art from Afterlife, which is a great map with some cool stuff in it. I was only able to find the attack button and some descriptions in the files, although it looks messy.
 

afisakov

You can change this now in User CP.
Reaction score
37
It should be possible to extract the model files using an MPQ editor... I personally have not tried using the models in any other map and I doubt a tutorial on how to steal model files from a map would be too welcome on this site. That said, it is definitely possible if you know what you are doing and cannot find a good alternative on sites like the Hive.

The system I made for you is to give the idea and would need to be completed. As you can likely see it does a decent job of handling reloading if using the weapon equipped, but I did not make the portion of the trigger for equipping a new weapon. As you can probably tell from the partial map I uploaded here, the concept is to replace the hero with the new type that "wields" weapon desired. Though you will have to find a way to detect if using same if different weapon.

Now that I think about it, you could probably use the "use item" event instead of the use ability event to detect reloading. The you can use a condition for used item to check if the used item is the one "equipped" or if the hero needs to be replaced to "equip" the new gun.
 

Xialian

Member
Reaction score
8
When I open it with the MPQ editor, I get some files called "File(random gibberish)", which I can open, but don't contain any visible data somehow. It's really weird.

One thing I don't understand about the triggers, is the one with the Intergers A 1 to 10 something and such. How does that work exactly?

Another is how it detects attacking. You set it to "Unit is attacked", "User is Not equal to Player 12 (Brown)"

And then it continues with

Trigger:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Charges remaining in gun_equipped[(Player number of (Owner of (Triggering unit)))]) Less than max_ammo[int1]
      • ((Triggering unit) has an item of type ammo_type[(Item level of gun_equipped[(Player number of (Owner of (Triggering unit)))])]) Equal to True
    • Then - Actions
      • Set ammo_to_use = (Item carried by myhero of type ammo_type[(Item level of gun_equipped[(Player number of (Owner of (Triggering unit)))])])
      • Set stock_ammo = (Charges remaining in ammo_to_use)
    • Else - Actions


Item level? The item levels on the guns are 1 or 5.
 

afisakov

You can change this now in User CP.
Reaction score
37
Actually, now that I think of it, that trigger should say attacking unit instead of triggering unit.

The check for player 12 is under the assumption that you will set the zombies to player 12, and since they melee attack they do not need ammo. Therefore this trigger should not apply to them.

Afterlife did not really change item level, I am not certain how it kept track of which guns used what kind of ammo.
Item lvl was my idea of a way to keep track what guns use which ammo. If you for instansce set 9 mil=lvl 1, shotgun=lvl2, .762=lvl 3 etc it will be a way to keep track which ammo pool the guns draws from.
After all you don't want your pistols reloading with shotgun shell or sniper bullets, or vice versa.
 

Xialian

Member
Reaction score
8
Aha!
The item level system makes sense now, that's cool.
Now, with the attacking unit thing, does it register attacks, or does it just consume one and not anything else until I re-enter combat?
 

afisakov

You can change this now in User CP.
Reaction score
37
It runs every time the unit attacks. That is why I wrote that it should say attacking unit instead of triggering unit.
The idea is that if you have charges in the weapon, the trigger removes 1 charge and lets the unit attack as normal. If you don't, then it issues a stop command to the unit to prevent its attack.
An improvement would probably be to order the unit to use the item ability at this point, to automatically reload.

There is likely a better way to temporarily stop the unit from attacking but I cannot think of it at the moment.
 

Xialian

Member
Reaction score
8
A unit is attacked, does that trigger on spell damage as well?

I already thought of making it auto-reload, but thanks for suggesting it :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top