• 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.

How to combine items with types a chat message

Status
Not open for further replies.
Level 3
Joined
Apr 8, 2016
Messages
58
hey anyone help me to make trigger item combination for my rpg map,

example:

to make Item 3:
required item 1 & item 2

and i already have item 1 & 2, then it will combinated when i type a chat message "-create"


sorry for my bad english & thanksss
 
Hardcoded-IF-Based:
You hardcode any Item requ-Checks with alot of ifs, and elses this method is hard to change later but is a lot easier to understand.


  • Create Item command IF
    • Ereignisse
      • Spieler - Spieler 1 (Rot) types a chat message containing -create as Exakte Übereinstimmung
      • Spieler - Spieler 2 (Blau) types a chat message containing -create as Exakte Übereinstimmung
      • and for any other player who should be able to do this
    • Bedingungen
    • Aktionen
      • -------- Find your Hero --------
      • Custom script: set bj_wantDestroyGroup=true
      • Einheitengruppe - Pick every unit in (Units currently selected by (Triggering player)) and do (Actions)
        • Schleifen - Aktionen
          • Set Unit = (Picked unit)
          • -------- Check if Hero --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Bedingungen
              • (Level of Inventar (Held) for Unit) Ungleich 0
              • (Owner of Unit) Gleich (Triggering player)
            • 'THEN'-Aktionen
              • -------- First Item-Check --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • 'IF'-Bedingungen
                  • (Unit has an item of type Ring des Schutzes +2) Gleich True
                  • (Unit has an item of type Ring des Schutzes +3) Gleich True
                • 'THEN'-Aktionen
                  • Gegenstand - Remove (Item carried by Unit of type Ring des Schutzes +2)
                  • Gegenstand - Remove (Item carried by Unit of type Ring des Schutzes +3)
                  • Held - Create Ring des Schutzes +4 and give it to Unit
                • 'ELSE'-Aktionen
                  • -------- Second CHeck --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • 'IF'-Bedingungen
                      • (Unit has an item of type Klauen des Angriffs +6) Gleich True
                      • (Unit has an item of type Klauen des Angriffs +9) Gleich True
                    • 'THEN'-Aktionen
                      • Gegenstand - Remove (Item carried by Unit of type Klauen des Angriffs +9)
                      • Gegenstand - Remove (Item carried by Unit of type Klauen des Angriffs +6)
                      • Held - Create Klauen des Angriffs +12 and give it to Unit
                    • 'ELSE'-Aktionen
                      • -------- and so on --------
            • 'ELSE'-Aktionen

Array-based:
This might be hard to understand.
Well you need to save all item-types you use for fusing or requirement in an big array. Then define fusions-recipse. If all requirements are unique your fusion check becomes easier. Now you make Integer Arrays which reference to item-types in the Array.
For each req-typ you'll need another, or you make a really complex system with good indexing.

This is more easy to change if you project goes on and becomes bigger. Cause you only change the init-trigger with its items.

Example
  • Init
    • Ereignisse
      • Map initialization
    • Bedingungen
    • Aktionen
      • Spielergruppe - Pick every player in (All players) and do (Actions)
        • Schleifen - Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Bedingungen
              • ((Picked player) controller) Gleich Benutzer
            • 'THEN'-Aktionen
              • Trigger - Add to Create Item command <gen> the event (Spieler - (Picked player) types a chat message containing -create as Exakte Übereinstimmung)
            • 'ELSE'-Aktionen
      • Set Item_Type[1] = Allerias Flöte der Genauigkeit
      • Set Item_Type[2] = Kelens Dolch des Entkommens
      • Set Item_Type[3] = Schlüssel der drei Monde
      • Set Item_Type[4] = Krone der Könige +5
      • Set Item_Type[5] = Frostkugel
      • -------- .---- --------
      • -------- Define an Fusion: Results to Krone des Königs --------
      • Set Item_Fusions[1] = 4
      • Set Item_Fusions_Req1[1] = 1
      • Set Item_Fusions_Req2[1] = 2
      • -------- Define an Fusion: Results to Frost-Orb --------
      • Set Item_Fusions[2] = 5
      • Set Item_Fusions_Req1[2] = 4
      • Set Item_Fusions_Req2[2] = 3
      • Set Item_Fusions_Last_Index = 2
  • Create Item command
    • Ereignisse
    • Bedingungen
    • Aktionen
      • -------- Find your Hero --------
      • Custom script: set bj_wantDestroyGroup=true
      • Einheitengruppe - Pick every unit in (Units currently selected by (Triggering player)) and do (Actions)
        • Schleifen - Aktionen
          • Set Unit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Bedingungen
              • (Level of Inventar (Held) for Unit) Ungleich 0
              • (Owner of Unit) Gleich (Triggering player)
            • 'THEN'-Aktionen
              • -------- This a hero under you Controll --------
              • For each (Integer A) from 1 to Item_Fusions_Last_Index, do (Actions)
                • Schleifen - Aktionen
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • 'IF'-Bedingungen
                      • Or - Any (Conditions) are true
                        • Bedingungen
                          • (Unit has an item of type Item_Type[Item_Fusions_Req1[(Integer A)]]) Gleich True
                          • Item_Fusions_Req1[(Integer A)] Gleich 0
                      • Or - Any (Conditions) are true
                        • Bedingungen
                          • (Unit has an item of type Item_Type[Item_Fusions_Req2[(Integer A)]]) Gleich True
                          • Item_Fusions_Req2[(Integer A)] Gleich 0
                      • Or - Any (Conditions) are true
                        • Bedingungen
                          • (Unit has an item of type Item_Type[Item_Fusions_Req3[(Integer A)]]) Gleich True
                          • Item_Fusions_Req3[(Integer A)] Gleich 0
                    • 'THEN'-Aktionen
                      • Gegenstand - Remove (Item carried by Unit of type Item_Type[Item_Fusions_Req1[(Integer A)]])
                      • Gegenstand - Remove (Item carried by Unit of type Item_Type[Item_Fusions_Req2[(Integer A)]])
                      • Gegenstand - Remove (Item carried by Unit of type Item_Type[Item_Fusions_Req3[(Integer A)]])
                      • Held - Create Item_Type[Item_Fusions[(Integer A)]] and give it to Unit
                    • 'ELSE'-Aktionen
            • 'ELSE'-Aktionen

Or download a Item-Fuse System give credits and manipulate its combining event to your chat message

For example http://www.hiveworkshop.com/threads/m-fis-v1-8.210505/#resource-46217
 
Status
Not open for further replies.
Top