Ways to simplify this trigger???

Do you need World Editor help? Ask here!
Forum rules
Before making a new topic:
First, check if your question has already been answered in the Tutorials section.
If you didn't find a solution, use the search function.
If searching didn't help either, you can make a new topic.

Topic title & content:
You must use a descriptive title. (Help plz is not good) (Need help with Dialog buttons is good)
Go into much detail when posting. You should post attachments. Like screenshots of the problem, the map you are making, replays of the error. Or you could even make a screencast (video) of your problem and upload it here.

Spelling:
Grammar seems to be a serious problem amongst teenagers, so use a spell checker or you will get no love.
Read your posts twice, before pressing the reply button.
And do not use profanity. Chatspeak (y r u nub) and Leetspeak (1 C4N S33 H4X) are not welcome here either.

Only World Editor related questions are allowed here!
(Click for Battle.net help) (Click for World Editor help)
BugMeNot
Posts: 141
Joined: Wed Jan 21, 2009 12:46 pm

Ways to simplify this trigger???

Unread post by BugMeNot »

Code: Select all

P1
    Events
        Unit - A unit enters layer1 <gen>
    Conditions
        (Owner of (Triggering unit)) Equal to PlayNum[1]
        ((Unit-type of (Triggering unit)) Equal to Footman) or (((Unit-type of (Triggering unit)) Equal to Sniper) or (((Unit-type of (Triggering unit)) Equal to Mortar) or (((Unit-type of (Triggering unit)) Equal to Gyrocopter) or (((Unit-type of (Triggering unit)) Equal to Priest) or (((Unit-type of (Triggering unit)) 
    Actions
        Unit - Change ownership of (Triggering unit) to Player 11 (Dark Green) and Change color
        Unit - Order (Triggering unit) to Attack-Move To (Center of second <gen>)


This map will have many more units added and is a pain to keep updating condition so basically a general condition that will make action apply to all units
Last edited by 3ICE on Tue Jun 21, 2011 7:26 am, edited 1 time in total.
Reason: If you don't know how to use the [TRIGGER] tag, don't use it.
This is a guest account intended for use by people who wish to remain anonymous or hate registering.
(Please don't forget to sign your posts with your name if you want us to know who you are.)
http://www.bugmenot.com/view/3ice.hu

User avatar
3ICE
Admin
Posts: 2629
Joined: Sat Mar 01, 2008 11:34 pm
Realm: Europe
Account: 3ICE
Clan: 3ICE
Location: Hungary
Contact:

Re: Ways to simplify this trigger???

Unread post by 3ICE »

Unit classifications! Make all units you want the trigger to work for classified as "Ancient" and then use the condition: Unit is Ancient.

If you want it to apply to all units, why have a condition at all? You don't need to have a condition in every trigger. You can just leave it empty and it will work always. Conditions are used to restrict. For example to disallow some units.

Are you willing to move it to JASS? You can create condition functions in jass:

Code: Select all

function P takes unit u, player p returns boolean
if
    (Owner of u) Equal to p
    (Unit-type of u) Equal to Footman or Sniper or Mortar or Gyrocopter or Priest or...
then
    return true
else
    return false
endif
endfunction
Or JASSify the whole trigger:

Code: Select all

function Px takes nothing returns nothing
if
    (Owner of u) Equal to p
    (Unit-type of u) Equal to Footman or Sniper or Mortar or Gyrocopter or Priest or...
then
    Unit - Change ownership of u to Player 11 (Dark Green) and Change color
    Unit - Order u to Attack-Move To second
endif
endfunction
The above two functions are pseudocode, not real JASS.

p.s.: If you don't know how to use the [TRIGGER] tag, don't use it. Or click here to learn.

p.p.s.:
Topic title:
Ways to simplify this trigger???
should have been
Ways to simplify this trigger?
Please don't use three question marks, one is enough. Ask, do not demand.
(Three question marks mean you are demanding help and that is rude.)
ImageImageImageImageImage
Image
ImageImage

BugMeNot
Posts: 141
Joined: Wed Jan 21, 2009 12:46 pm

Re: Ways to simplify this trigger???

Unread post by BugMeNot »

Ya the jass method would actually help. how do you alter it if you make the event and action same but make a condition like to exclude certain builders(around 5) and buildings? Basically in the map, the only change in ownership is units. It would be a perfect fit if you can make it only change all units except for builders and buildings. Also im not too great with jass, i understand what the trigger is doing in each line but wheres the region part?
This is a guest account intended for use by people who wish to remain anonymous or hate registering.
(Please don't forget to sign your posts with your name if you want us to know who you are.)
http://www.bugmenot.com/view/3ice.hu

User avatar
3ICE
Admin
Posts: 2629
Joined: Sat Mar 01, 2008 11:34 pm
Realm: Europe
Account: 3ICE
Clan: 3ICE
Location: Hungary
Contact:

Re: Ways to simplify this trigger???

Unread post by 3ICE »

Oh. You don't need JASS for that. Just two simple boolean conditions. Builders can be filtered out with: t_uni Unit - Unit classification is Worker and buildings in a similar way: t_uni Unit - Unit is a Building. Reverse them both (separately) with the t_if Not function available in conditions.
ImageImageImageImageImage
Image
ImageImage

Post Reply

Who is online

Users browsing this forum: No registered users and 120 guests