• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Trigger] Why isn't this trigger working?

Status
Not open for further replies.
Level 9
Joined
Aug 1, 2008
Messages
453
In my zombie game you can only have 1 enabled weapon at a time. and the trigger i have to do that isn't working here it is:
  • Only 1 Enabled
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Itt_Weapon_Disabled[1]
          • (Item-type of (Item being manipulated)) Equal to Itt_Weapon_Disabled[2]
          • (Item-type of (Item being manipulated)) Equal to Itt_Weapon_Disabled[3]
          • (Item-type of (Item being manipulated)) Equal to Itt_Weapon_Disabled[4]
          • (Item-type of (Item being manipulated)) Equal to Itt_Weapon_Disabled[5]
          • (Item-type of (Item being manipulated)) Equal to Itt_Weapon_Disabled[6]
          • (Item-type of (Item being manipulated)) Equal to Itt_Weapon_Disabled[7]
          • (Item-type of (Item being manipulated)) Equal to Itt_Weapon_Disabled[8]
          • (Item-type of (Item being manipulated)) Equal to Itt_Weapon_Disabled[9]
          • (Item-type of (Item being manipulated)) Equal to Itt_Weapon_Disabled[10]
    • Actions
      • -------- Disabled all weapons --------
      • For each (Integer A) from 1 to Int_Weapontypes, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Hero manipulating item) has an item of type Itt_Weapon[(Integer A)]) Equal to True
            • Then - Actions
              • Item - Remove (Item carried by (Hero manipulating item) of type Itt_Weapon[(Integer A)])
              • Set Poi_Temp[5] = (Position of (Hero manipulating item))
              • Item - Create Itt_Weapon_Disabled[(Integer A)] at Poi_Temp[5]
              • Hero - Give (Last created item) to (Hero manipulating item)
            • Else - Actions
      • -------- Changes the used weapon into a enabled one --------
      • For each (Integer A) from 1 to Int_Weapontypes, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item being manipulated)) Equal to Itt_Weapon_Disabled[(Integer A)]
            • Then - Actions
              • Item - Remove (Item being manipulated)
              • Set Poi_Temp[6] = (Center of (Playable map area))
              • Item - Create Itt_Weapon[(Integer A)] at Poi_Temp[6]
              • Hero - Give (Last created item) to (Hero manipulating item)
            • Else - Actions
      • Custom script: call RemoveLocation(udg_Poi_Temp[5])
      • Custom script: call RemoveLocation(udg_Poi_Temp[6])
Heres the trigger that setups the varibles
  • Weapon setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Here we are setting up the bullets attributes. --------
      • -------- Itt_Weapom[Array] is what weapon that shoots the bullet. The shoot trigger checks what weapon you have, and shoots the bullet according to the weapon. --------
      • -------- Unt_Bullet[Array] is what unit/bullet is spawned when shooting. --------
      • -------- Int_Bulletspawn[Array] is how many bullets the weapon shoot. Setting it to 3 will make 3 bullets apear per shot. --------
      • -------- Rea_Bulletspread[Array] is how accurate the bullets fly. 0 means they will fly at the exact point. The higher value, the more unprecise. For a shotgun, i recomend a value about 10-13. --------
      • -------- Bol_Bulletbounce[Array] Setting to true will make the bullet shift its shooting direction when it cant move, instead of disappearing. ---[[NOT WORKING PROPERLY!]]--- --------
      • -------- Rea_Reload time is how long you are paused when running out of Ammo (Lumber). To remove the Ammo usage (If you need lumber in your game) remove the condition in the shoot trigger. --------
      • -------- Int_Clipsize is how much lumber you get after reloading. --------
      • -------- Int_Weapontypes is used for other triggers. Leave it alone. --------
      • -------- Rifle --------
      • Set Itt_Weapon[1] = |cffFFCC00Rifle (Enabled)
      • Set Itt_Weapon_Disabled[1] = |cff949596Rifle (Disabled)
      • Set Unt_Bullet[1] = Rifle Bullet
      • Set Int_Bulletsspawn[1] = 1
      • Set Rea_Bulletspread[1] = 0.00
      • Set Bol_Bulletbounce[1] = False
      • Set Rea_Reloadtime[1] = 1.00
      • Set Int_Clipzize[1] = 1
      • Set Int_Accrucy[1] = 75
      • Set Int_Weapontypes = 1
      • -------- SMG --------
      • Set Itt_Weapon[2] = |cffFFCC00Sub Machine Gun (Enabled)
      • Set Itt_Weapon_Disabled[2] = |cff949596Sub Machine Gun (Disabled)
      • Set Unt_Bullet[2] = SMG Bullet
      • Set Int_Bulletsspawn[2] = 3
      • Set Rea_Bulletspread[2] = 0.50
      • Set Bol_Bulletbounce[2] = False
      • Set Rea_Reloadtime[2] = 3.00
      • Set Int_Clipzize[2] = 30
      • Set Int_Accrucy[2] = 75
      • Set Int_Weapontypes = (Int_Weapontypes + 1)
      • -------- Laser (DISABLED --------
      • -------- ------------------------------------------------------------------------------------------------------------------------------------ --------
      • -------- ------------------------------------------------------------------------------------------------------------------------------------ --------
      • -------- ------------------------------------------------------------------------------------------------------------------------------------ --------
      • Set Itt_Weapon[3] = |cffFFCC00Laser (Enabled)
      • Set Itt_Weapon_Disabled[3] = |cff949596Laser (Disabled)
      • Set Unt_Bullet[3] = Laser Bullet
      • Set Int_Bulletsspawn[3] = 1
      • Set Rea_Bulletspread[3] = 0.00
      • Set Bol_Bulletbounce[3] = False
      • Set Rea_Reloadtime[3] = 1.00
      • Set Int_Clipzize[3] = 2
      • Set Int_Accrucy[3] = 0
      • Set Int_Weapontypes = (Int_Weapontypes + 1)
      • -------- ------------------------------------------------------------------------------------------------------------------------------------ --------
      • -------- ------------------------------------------------------------------------------------------------------------------------------------ --------
      • -------- ------------------------------------------------------------------------------------------------------------------------------------ --------
      • -------- Sniper --------
      • Set Itt_Weapon[4] = |cffFFCC00Sniper Rifle (Enabled)
      • Set Itt_Weapon_Disabled[4] = |cff949596Sniper Rifle (Disabled)
      • Set Unt_Bullet[4] = Sniper Bullet
      • Set Int_Bulletsspawn[4] = 1
      • Set Rea_Bulletspread[4] = 0.00
      • Set Bol_Bulletbounce[4] = False
      • Set Rea_Reloadtime[4] = 3.00
      • Set Int_Clipzize[4] = 1
      • Set Int_Accrucy[4] = 99
      • Set Int_Weapontypes = (Int_Weapontypes + 1)
      • -------- Ak 47 --------
      • Set Itt_Weapon[5] = |cffFFCC00Ak 47 (Enabled)
      • Set Itt_Weapon_Disabled[5] = |cff949596Ak 47 (Disabled)
      • Set Unt_Bullet[5] = Ak 47 Bullet
      • Set Int_Bulletsspawn[5] = 1
      • Set Rea_Bulletspread[5] = 7.50
      • Set Bol_Bulletbounce[5] = False
      • Set Rea_Reloadtime[5] = 2.50
      • Set Int_Clipzize[5] = 6
      • Set Int_Accrucy[5] = 75
      • Set Int_Weapontypes = (Int_Weapontypes + 1)
      • -------- Rocket Launcher --------
      • Set Itt_Weapon[6] = |cffFFCC00Rocket Launcher (Enabled)
      • Set Itt_Weapon_Disabled[6] = |cff949596Rocket Launcher (Disabled)
      • Set Unt_Bullet[6] = Missile
      • Set Int_Bulletsspawn[6] = 1
      • Set Rea_Bulletspread[6] = 3.00
      • Set Bol_Bulletbounce[6] = False
      • Set Rea_Reloadtime[6] = 3.00
      • Set Int_Clipzize[6] = 1
      • Set Int_Accrucy[6] = 99
      • Set Int_Weapontypes = (Int_Weapontypes + 1)

So why isn't this trigger working?? Will +rep if helped

EDIT: you use the disabled item
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
The events 'Unit - A unit Uses an item' isn't right, the hero will use the item first then all your conditions and actions will be executed. I think this is best be done by adding a dummy ability to the item that when used trigger your weapon via triggers. I mean if the sniper rifle has an ability based on storm bolt and that item has been used it will shoot the bolt no matter of what conditions or actions you create. Best done (I think) that the ability be done with triggers that check if the weapon is enabled or disabled.
 
Status
Not open for further replies.
Top