• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Request - [System]

Status
Not open for further replies.
Hm, i might give it a try. Here is a very simple System made in Jass. To import it, simply copy the Trigger 'Ammo System' Into your Map. Units now will loose 1 Mana per Attack and cant attack without mana.
It has 2 known glitches: 1. The System leaks 1 Trigger every time a unit fires all his ammo and dies without reloading 2. The System drestroys Triggers, so Warcraft could crash, but i doubt that. It never appeared during tests.
 

Attachments

Detects attacks by damage. It will play the animation and sound, as if the unit is actually trying to fire the gun, but will deal no damage. Is this for the map I sent you?
  • Damage
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Trigger - Add to Ammo <gen> the event (Unit - (Triggering unit) Takes damage)
  • Ammo
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Mana of (Damage source)) Greater than 0.00
        • Then - Actions
          • Unit - Set mana of (Damage source) to ((Mana of (Damage source)) - 1.00)
        • Else - Actions
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (Damage taken))
 
GhostThruster, your System has a flaw in case of low HP. If the damage of an attack without ammunition kills a unit, it will die because the HP refund happens after the dying. And i think it would look strange if a horde of Marines fire with their guns at the Zombies, and these dont take damage because your ammo is empty. I think it is better if you cant fire at all without ammonition.

€: I cold convert my System back to GUI, if you wish.
 
If you're looking for a GUI triggerer, I'm your man.
The reason why I involved life, Mr Lucent, is because that my system is based on damage, but if you have no mana, then you will deal no damage.
eg. A unit with 0 mana attacks, with attack damage 5 dealt. However, since his mana is 0, the attacked target is healed by 5, thus creating the illusion as if the target was never attacked. And yes, this works with a unit that has 3 health and is dealt 5 damage without it dying.
 
If you're looking for a GUI triggerer, I'm your man.
The reason why I involved life, Mr Lucent, is because that my system is based on damage, but if you have no mana, then you will deal no damage...

Hive is a place for community, friendships, help and altruism, not a place for some cheap tries to badinage someone down or insult me. I am off of this topic, and you've went far from being constructive. I just asked a question, and you started a fight. I don't wanna go off-topic, so help thread creator, and I pledge you to not contact me anymore.
 

What kind of human are you to understand his message as a flame? It was a simple answer to a strange question.

But @Topic: Here is my System in GUI. One of the Triggers refers to the other, so make sure to import GUI Ammo Reload first and to have it before GUI Ammo Shoot in the Trigger List.
Do never deactivate GUI Ammo Shoot, or you will need jnpg to activate it again.
 

Attachments

Dude, how was I unfriendly, unhelpful or un-that last word?
Where did I insult or put down you in that comment?
I'm being constructive, because, as you can read clearly, I am telling you why this system is based on damage!
Tell me, where did I start any fight? In fact I don't even consider this a fight, I think it's a misunderstanding.

Thank you AlienAtSystem for defending me.

DemigoD, just change:
  • Events
    • Unit - A unit Is attacked
to:
  • Events
    • Unit - <YOUR UNIT> Is attacked
using the event Unit - Specific Unit Event
If the unit is a variable, eg. TheHeroDude, you can use
Trigger - Add New Event and make it:
  • Trigger - Add to GUI Ammo Shoot <gen> the event (Unit - TheHeroDude Is attacked)
And change the actions of the second trigger:
  • Actions
    • -------- Do not touch the Custom script, or the having no ammo branch will bug --------
    • Custom script: local trigger clean
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Mana of (Attacking unit)) Less than 0.50
      • Then - Actions
        • -------- This is the branch for having no ammunition. Add whatever you like, but please leave the Custom Scripts untouched als long as you dont know what they do --------
        • -------- 'Cargo Hold' does nothing bad to your units except disabling the Attack Button. --------
        • Unit - Add Cargo Hold (Orc Burrow) to (Attacking unit)
        • Unit - Remove Cargo Hold (Orc Burrow) from (Attacking unit)
        • Custom script: set clean=CreateTrigger()
        • Custom script: call TriggerRegisterUnitStateEvent( clean, GetAttacker(),UNIT_STATE_MANA, GREATER_THAN, 0.50 )
      • Else - Actions
        • -------- This is the branch for having ammunition left. You can do everything here. --------
        • Unit - Set mana of (Attacking unit) to ((Mana of (Attacking unit)) - 1.00)
 
GhostThruster, this wont work, because then every unit EXCEPT the Hero would use Mana as Ammunition. The Right way is to add a Condition to the second Trigger, for example using Boolean Comparison (((Attacking Unit) is (a Hero)) equal to (true) for example if you want it only for heroes), Unit-Type Comparison ((Unit-Type of (Attacking Unit)) is equal to (Marine), if you want it only for Marines) or Unit Comparisons ((Attacking Unit) equal to (HeroDude), to take GhostThrusters example).

€: Wait a sec. What ist 'Remove Cargo Hold (Orc Burrow) from (Attacking Unit)' doing in this trigger? That would make the whole System useless. GhostThruster, thanks for trying to help, but please, do not touch the code unless you understood what it does.
 
Okay, I admit that was my mistake. Got confused with attacker and attackee! Thanks for the point-out.
DemigoD, the best way is to use conditions.

But your second paragraph is wrong. I tested it, and it does work, same as the damage thing I posted previously. The thing is, it works immediately, so it will stop the unit from attacking immediately, and immediately remove it the slightest nanosecond after.
And even still, you did the same thing as me, except in two triggers and with some stupid 1 second wait after it. I don't even understand why you included custom script and put 'Less than 0.5' instead of '1.0'. Maybe it doesn't work for you because we have different WC3 patch versions.
I don't mean to brag or flame, but please don't under-estimate me. I'm not useless...completely.:)
Try it.
 
But your second paragraph is wrong. I tested it, and it does work, same as the damage thing I posted previously. The thing is, it works immediately, so it will stop the unit from attacking immediately, and immediately remove it the slightest nanosecond after.
And even still, you did the same thing as me, except in two triggers and with some stupid 1 second wait after it. I don't even understand why you included custom script and put 'Less than 0.5' instead of '1.0'.
In fact, i did not the same thing as you, because your unit continues to attack (without dealing damage or showing a missile) without having ammo, while mine stops attacking (and even flees) until the mana is refilled. And please, show me the wait i am using, i want to learn how to improve my code :crazz:.
The 0.5 is a mood point since Ammunition appears only in integers and therefore the Mana too.
 
In real life, marines can still click the trigger of a gun with no ammo, but no sound or stuff comes up. And you yourself can just order the unit to run away, thus making the trigger pure GUI and a bit less complex and more simple, I myself dislike it when they flee or attack without my orders.
You explained that the Cargo Hold is removed when mana is generated, I though it was because of some 'wait' action you put in! So, I'm wrong there.
The last bit, 0.5, it isn't wrong or incorrect, but more like doing this:

Events:
Map Initialization
Actions:
Run Example

Example
Events:
Actions:
Melee Game - Blahblahblah

instead of this:

Events:
Map Initialization
Actions:
Melee Game - Blahblahblah

if you know what I mean, when you could have left .5 to just 1 as they result in the same effect(I'm lazy).
 
Well, just use a simple Player Message.
Given the attack speed of a machine gun, the screen then would somehow look like this:
imagninary screen

You run out of ammunition, please reload.
You run out of ammunition, please reload.
You run out of ammunition, please reload.
You run out of ammunition, please reload.
You run out of ammunition, please reload.
You run out of ammunition, please reload.
You run out of ammunition, please reload.
You run out of ammunition, please reload.
You run out of ammunition, please reload.
You run out of ammunition, please reload.
You run out of ammunition, please reload.
:grin:

But as you said, both methods have advantages and disadvantages, so we could simply let DemigoD decide which system he uses.
 
Status
Not open for further replies.
Back
Top