Item = No Attack

Axe.killer

New Member
Reaction score
24
I want it so that when a user has no bow, and no arrows, to stop the attack. The only thing is i want it for all my different bows. This is what i got so far, giving you examples of 2 different bows and arrows - if the unit dosent have this, he cant attack. Basically, if the user dosent have SOME TYPE OF BOW, and SOME TYPE OF ARROw, he cant attack. The code i have dosent work. You guys never fail me, and thanx in the past. Here it is.

Bow # 1
Code:
ErrorandStop
    Events
        Unit - A unit Is attacked
    Conditions
        And - All (Conditions) are true
            Conditions
                (Unit-type of (Attacking unit)) Equal to Archer
                ((Attacking unit) has an item of type Wind Arrow(s)) Equal to False
                ((Attacking unit) has an item of type Beginner's Bow) Equal to False
    Actions
        Unit - Add No more ammo or no weapon wielded dummy to (Attacking unit)
        Unit - Order (Attacking unit) to Stop

Bow # 2
Code:
ErrorandStop Copy
    Events
        Unit - A unit Is attacked
    Conditions
        And - All (Conditions) are true
            Conditions
                ((Attacking unit) has an item of type Wind Arrow(s)) Equal to False
                (Unit-type of (Attacking unit)) Equal to Archer
                ((Attacking unit) has an item of type Huhuran's Stinger) Equal to False
    Actions
        Unit - Add No more ammo or no weapon wielded dummy to (Attacking unit)
        Unit - Order (Attacking unit) to Stop
 

Tinki3

Special Member
Reaction score
418
Try something like this:

(it should work)
Code:
NoAmmo
    Events
        Unit - A unit Is attacked
    Conditions
        (Unit-type of (Attacking unit)) Equal to Archer
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                And - All (Conditions) are true
                    Conditions
                        ((Attacking unit) has an item of type Wind Arrow(s)) Not Equal to True
                        ((Attacking unit) has an item of type Beginner's Bow) Not Equal to True
            Then - Actions
                Unit - Add No more ammo or no weapon wielded dummy to (Attacking unit)
                Unit - Order (Attacking unit) to Stop
            Else - Actions
 
M

Metalelf

Guest
Try something like this:

(it should work)
Code:
NoAmmo
    Events
        Unit - A unit Is attacked
    Conditions
        (Unit-type of (Attacking unit)) Equal to Archer
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                And - All (Conditions) are true
                    Conditions
                        ((Attacking unit) has an item of type Wind Arrow(s)) Not Equal to True
                        ((Attacking unit) has an item of type Beginner's Bow) Not Equal to True
            Then - Actions
                Unit - Add No more ammo or no weapon wielded dummy to (Attacking unit)
                Unit - Pause (Attacking Unit)
                Unit - Unpause (Attacking Unit)
            Else - Actions
Try this just changed the stop to pause and unpause if it dosent work i duno
 

Tinki3

Special Member
Reaction score
418
Try removing the 'And all Conditions are True', then move the 2 condition functions so that they are normal conditions - not in the 'And' part.

Just try changing things around. You will never get it to work unless you try different things.
 

Axe.killer

New Member
Reaction score
24
Code:
ErrorandStop
    Events
        Unit - A unit Is attacked
    Conditions
        (Unit-type of (Attacking unit)) Equal to Archer
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                And - All (Conditions) are true
                    Conditions
                        ((Attacking unit) has an item of type Wind Arrow(s)) Equal to False
                        ((Attacking unit) has an item of type Beginner's Bow) Equal to False
            Then - Actions
                Unit - Add No more ammo or no weapon wielded dummy to (Attacking unit)
                Unit - Order (Attacking unit) to Stop
            Else - Actions
 

Axe.killer

New Member
Reaction score
24
Code:
ErrorandStop
    Events
        Unit - A unit Is attacked
    Conditions
        (Unit-type of (Attacking unit)) Equal to Archer
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                And - All (Conditions) are true
                    Conditions
                        ((Attacking unit) has an item of type Wind Arrow(s)) Equal to False
                        ((Attacking unit) has an item of type Beginner's Bow) Equal to False
            Then - Actions
                Unit - Add No more ammo or no weapon wielded dummy to (Attacking unit)
                Unit - Order (Attacking unit) to Stop
            Else - Actions
tried countless of different scenarios. this is the best "looking" one i got. It looks flawless, what's wrong tho. I think its that the condition hero has item only is compatable with 1 condition.
 

Tinki3

Special Member
Reaction score
418
its a hero.

Have you tried separating the condition functions into two separate triggers? For example, 1 trigger will have the conditions as to 'if' the Archer has 1 of your items, and the other will do the same but for the other item?

Try that, as it is worth a try :)

And if that doesn't work.. just wait for AceHart :D
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> And - All (Conditions) are true

The "and" is not needed. Conditions are already "and" by nature.


There is absolutely not difference between

Conditions:
- Some condition
Actions:
- Some action

and

Conditions:
Actions:
If some conditions then
- Some action

Other than the fact that, sometimes, it's not possible to use the first one.

With the examples given though, it's just the same.
Using conditions on the trigger seems cleaner here though.


> just changed the stop to pause and unpause

"Pause" generally doesn't reset the current order.

What should work though is:
Pause unit
Order unit to stop
Unpause unit


> I think it's that the condition "Hero has item" only is compatible with 1 condition.

Actually, no. Can be used any number of times.
Countless "recipe" triggers out there use it and they all work just fine.


> Are you using the 'Hero Has Item of Type' Condition Function for a non-hero?

Doesn't matter.
That condition works with anything that has an inventory.

Same with, for example, "Hero - Create item for Hero" which can be used on any unit, Hero or other.


> Have you tried separating the condition functions into two separate triggers?

Not a very good idea.
If nothing else, it's messy. You don't really see anymore what the trigger is doing without also looking at its partner.

There's also house-keeping issues, as in, both triggers need to know what the other one was doing...


> got it to work

This is, indeed, good to hear.

Care to post that trigger?
 

Sooda

Diversity enchants
Reaction score
318
Why not just configure in Object editor Attack1 for melee (Means attacking range would be ~100 to 200) and Attack2 for ranged attacks (Means attack range is as huge as is aquirering range [Rofl how to spell it ?].). Then from Combat- Attacks Enabled: None (Means don' t enable Attack1 or Attack2 for that unit), repeat it with all your heroes. Then modify Orb of Slow or any other Orb and change item picture to bow (For Items what will enable Attack2.) or to sword (Will enable Attack1.). I didn't read all posts saw that you triggered it but it can be made with ObjectEditor as well. I don' t know are you useing orbs for different purposes though, just an idea. Don' t bash me, thanks
~ Sooda
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top