Unit Spawn?

For fulfilled maps that most likely don't work on the latest patch (1.24 or later).

Moderator: Cheaters

User avatar
ZilvaX
Member
Posts: 52
Joined: December 16th, 2007, 2:23 am

Unit Spawn?

Post by ZilvaX »

What i want is a building is attacked, if the attacked building has no units owner by the owner of the attacked unit then create 3 footmen, i think the problem is with the conditions, but i dont know how to fix it.

Ownership 2
Events
Unit - A unit Is attacked
Conditions
(Number of units in (Units within 500.00 of (Position of (Attacked unit)) matching ((Owner of (Attacked unit)) Equal to (Owner of (Attacked unit))))) Equal to 0
Actions
Unit - Create 3 Footman for (Owner of (Attacked unit)) at (Position of (Attacked unit)) facing 270.00 degrees
Image
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Unit Spawn?

Post by Aero »

How the "Units in Group Matching Condition" function works is this:

It picks all units within 500 of the position of the attacked unit THEN it filters out units that don't match the condition. Since your condition was "(Owner of (Attacked unit)) Equal to (Owner of (Attacked unit))", that condition would always be true therefore units would never get filtered out. So as long as there was units within 500 of the position of the attacked unit (Which I assume there was since the condition is that A unit is attacked), the group was never empty (Therefore never equal to 0) and thus no units would spawn.

A simple fix...

(Owner of (Attacked unit)) Equal to (Owner of (Matching unit))
ZilvaX wrote:What i want is a building is attacked, if the attacked building has no units owner by the owner of the attacked unit then create 3 footmen, i think the problem is with the conditions, but i dont know how to fix it.

Ownership 2
Events
Unit - A unit Is attacked
Conditions
(Number of units in (Units within 500.00 of (Position of (Attacked unit)) matching ((Owner of (Attacked unit)) Equal to (Owner of (Matching unit))))) Equal to 0
Actions
Unit - Create 3 Footman for (Owner of (Attacked unit)) at (Position of (Attacked unit)) facing 270.00 degrees
Try that.
User avatar
ZilvaX
Member
Posts: 52
Joined: December 16th, 2007, 2:23 am

Re: Unit Spawn?

Post by ZilvaX »

It dosen't work :( , thanks for the help lately Aero i really couldn't work on my map with out you.
Image
User avatar
Aero
Forum Staff
Posts: 829
Joined: January 28th, 2007, 8:10 pm
Title: JASS Programmer
Location: Canada

Re: Unit Spawn?

Post by Aero »

No worky? Oh well.
I hate GUI, I'm so used to JASS I sometimes forget how to work with GUI.
soulcalibar3
Newcomer
Posts: 8
Joined: September 9th, 2008, 4:08 am
Title: Crack Whore
Location: CA

Re: Unit Spawn?

Post by soulcalibar3 »

i figured out your problem for the trigger just put in these specifications (be warned using this method means that you will have 2 do it for each building you want this effect on, but it works)

ex.

Events -
Unit - Barracks 0034 <gen> Is attacked
Conditions -
(Barracks 0034 <gen> is A structure) Equal to True
Actions -
Unit - Create 3 Footman for Player 1 (Red) at (Position of Barracks 0034 <gen>) facing 270.00 degrees
*Trigger - Turn off (This trigger)

(i believe that it works for everytime the building gets hit)(* put this in there if you only want it to work once, or you can make it everytime it is hit which is without the Trigger - Turn off (This trigger))

alright there you go, not exactly wat you wanted but i tried and thats what matters right? either way use that as a base for the other thing if you figure out how
siang05
Newcomer
Posts: 24
Joined: September 1st, 2008, 12:33 am

Re: Unit Spawn?

Post by siang05 »

ZilvaX wrote:What i want is a building is attacked, if the attacked building has no units owner by the owner of the attacked unit then create 3 footmen, i think the problem is with the conditions, but i dont know how to fix it.

Ownership 2
Events
Unit - A unit Is attacked
Conditions
(Number of units in (Units within 500.00 of (Position of (Attacked unit)) matching ((Owner of (Attacked unit)) Equal to (Owner of (Attacked unit))))) Equal to 0
Actions
Unit - Create 3 Footman for (Owner of (Attacked unit)) at (Position of (Attacked unit)) facing 270.00 degrees
i found that your condition is completely wrong. I am not understand Jass at all, but i'm not bad in Gui. It should be like this^^

Code: Select all

Events
        Unit - A unit Is attacked
    Conditions
        ((Attacked unit) is A structure) Equal to True
        (Number of units in (Units within 512.00 of (Position of (Attacked unit)) matching (((Owner of (Matching unit)) Equal to (Owner of (Attacked unit))) and (((Matching unit) Not equal to (Attacked unit)) and (((Matching unit) is alive) Equal to True))))) Equal to 0
    Actions
        Unit - Create 3 Footman for (Owner of (Attacked unit)) at (Position of (Attacked unit)) facing Default building facing degrees
It is working properly for me^^ Hope this is what you want. We must exclude the attacked unit from matching unit, and corpse as well