Trigger Help - Combineing Multiple Units

Status
Not open for further replies.
Level 4
Joined
Jul 9, 2004
Messages
81
I'm working on a map that allows you to upgrade your units and once they reach the last form you cna "combine" them to make an even stronger unit, the only problem is, I cant get a working trigger that will check both units types (because 2 DIFFERANT units will be combineing and there will be many multiple combinations for units).
CAn som1 help me get somthing like this to work.
-(Unit enters region = to combine)
--(# of units equal to 2),(unit type 1= footman)(unit type 2 = knight)
---(Remove triggering units in region combine),(create Strong Knight)

Somthing like that....and if all possible can you make a demo map sohwing this so others can learn how to do this 2.
 
Level 2
Joined
Mar 5, 2006
Messages
16
hmm i think i got it worked out for combining 2 units into one using an array of unit types and checking the name of the unit entering against a list of unit names to get a combination code. I didn't do a check for which player owns the units and just assumed red owned them. That could probably be added easily. I only added 10 combinations of units because making the custom units for all 50 possible combinations would be boring. You can only add 2 units from a list of 10. This is fairly primitive and slow, it could probably be improved alot, even without using JASS.

anyway http://www.wc3sear.ch/?p=Maps&ID=8111

ya this is a very primitive way to do it, hopefully you can improve it, but this is a cool idea.
 
Level 4
Joined
Jul 9, 2004
Messages
81
Thanks

Thank you very much, I'm going to download it and check it out right now, If i use this I will give credit in my map, if any1 else has a better method please feel free to post it, thnak you.
 
Level 4
Joined
Jul 9, 2004
Messages
81
????

The demo map you sent me was messed up, it seems you didn't add it to the site properly or the link you gave me was incorrect. Try clicking on the link you left me on my bulletion and if you cant upload it to the site you could allways send it to me at [email protected]
Thank you,
Josh
 
Level 2
Joined
Mar 5, 2006
Messages
16
oops sorry didn't realize that it needed a map description, should of read map submission rules, anyway.

http://www.wc3sear.ch/?p=Maps&ID=8124

it might have a few bugs in it such. If you try to combine two units that don't have a corresponding value then there total value will be 0 (Heavy Footman), but that can be fixed by giving the fused units their own values. To use more than 10 units in combining i would, in unit identifiers, just go past 9 on to 10 11 12.. and in fusion check in the second function where it says

For each (Integer A) from 0 to 9, do (If (UnitNames[1] Equal to UnitIdentifiers[(Integer A)]) then do (Set FusionCodeOutcomes = (FusionCodeOutcomes + ((Integer A) x 10))) else do (Do nothing))

i would change the * 10 to * 100 so you could add 100 units and the largest fusion code you could get would be 9999, and you could do combinations with 3 units and just do

For each (Integer A) from 0 to 9, do (If (UnitNames[3] Equal to UnitIdentifiers[(Integer A)]) then do (Set FusionCodeOutcomes = (FusionCodeOutcomes + ((Integer A) x 10000))) else do (Do nothing))

so that with combining 100 different units with 3 units in the region you could get a fusion code of 999999 and the number of possible combinations for this size fusion code would be around 500000 (would you even bother making that many units?)

you might want to change the entering region trigger to

entering region
Events
Unit - A unit enters Region 000 <gen>
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
[random upgrade here] Equal to (Researched tech-type)
Then - Actions
Set UnitNames[UnitsInFusionRegion] = (Name of (Triggering unit))
Set UnitRefferals[UnitsInFusionRegion] = (Triggering unit)
Game - Display to (All players) for 5.00 seconds the text: UnitNames[UnitsInFusionRegion]
Set UnitsInFusionRegion = (UnitsInFusionRegion + 1)
If (UnitsInFusionRegion Equal to 2) then do (Trigger - Run fusion check <gen> (ignoring conditions)) else do (Do nothing)
Else - Actions
Game - Display to (All players) for 5.00 seconds the text: unit is not at a high enough level!
Unit - Move (Triggering unit) instantly to (Center of (Playable map area))


or something like that to add the check for whether the unit is at a high enough level. the upgrade would be the highest upgrade for that unit. Im assuming with this that you are using upgrades that work on all units of a type. If you are not then you would have to change the condition to something more suited to your map.

also you should probably change the place to where the units are moved if they dont combine to another region just infront of the fusion region instead of the centre of playable area.
 
Level 2
Joined
Mar 5, 2006
Messages
16
ohh now i think i see why it got deleted again. i cant use this map as a map submission on this site because it is probably considered a trigger test, oops. hmm where is a good place to host it, or have you already got it?
 
Level 4
Joined
Jul 9, 2004
Messages
81
CAn you email it to me a.s.a.p please, and the best place for it would be in the "Spell" area. THats where most test triggers belong, it would be faster if u sent it to me FIRST please at:
[email protected] and then post it please.
 
Level 4
Joined
Jul 9, 2004
Messages
81
.....

Um, there seems to be many bugs/errors in your map. THe current #, when a unit goes in the region will allways be there so it will acumto like 300 then 400 and ect., I couldn't even make 1 unit because the thing kept getting bugged, cna you take a look at it and see whats wrong with it because I cant understand why the vairable doesnt reset back to 0.....
 
Level 2
Joined
Mar 5, 2006
Messages
16
did i send you the one with the

If - Conditions
Iron Forged Swords Equal to (Researched tech-type)
...

? because if i did disable that condition.

anyway in fusion trigger put

Set FusionCodeOutcomes = 0

in the Actions

and it should work. I hope. Without this change it should work the first time and then after that say that unit combination does not exist, or the fusioncodeoutcomes should continuosly increase. so your Fusion trigger should look kinda like

Fusion
Events
Conditions
Actions
Game - Display to (All players) for 3.00 seconds the text: (String(FusionCodeOutcomes))
Game - Display to (All players) for 3.00 seconds the text: (String(Combinations[FusionCodeOutcomes]))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Combinations[FusionCodeOutcomes] Not equal to (Unit-type of No unit)
Then - Actions
Unit - Remove UnitRefferals[0] from the game
Unit - Remove UnitRefferals[1] from the game
Set UnitsInFusionRegion = 0
Special Effect - Create a special effect at (Center of Region 000 <gen>) using Abilities\Spells\Human\DispelMagic\DispelMagicTarget.mdl
Unit - Create 1 Combinations[FusionCodeOutcomes] for Player 1 (Red) at (Center of Region 000 <gen>) facing Default building facing degrees
Else - Actions
Game - Display to Player Group - Player 1 (Red) for 2.00 seconds the text: Combination does no...
Unit - Move UnitRefferals[0] instantly to (Center of (Playable map area))
Unit - Move UnitRefferals[1] instantly to (Center of (Playable map area))
Set FusionCodeOutcomes = 0

do you want me to try and explain what the triggers do? I probably should of put the explanations in the trigger comments, awell. anyway to make this work with more players than just red you could probably make unit enters region and unit leaves region have player owned unit specific events and then have a check in the actions to figure out which player owns the unit and then put the unit in its own unit variable array for that player, and then have different fusion checks for each player, and then do somekind of checking for which players units are being combined in fusion trigger.
 
Status
Not open for further replies.
Top