• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Trigger isnt working(but works in a "new" Map)

Status
Not open for further replies.
Level 4
Joined
Apr 25, 2009
Messages
74
hey, i have a problem, this:
  • For each (Integer LoopInt1) from 1 to 4, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Player(LoopInt1)) slot status) Equal to Is playing
        • Then - Actions
          • Unit - Create 1 Peasant for (Player(LoopInt1)) at ((Player(LoopInt1)) start location) facing 270.00 degrees
          • Set PlayerHero[LoopInt1] = (Last created unit)
          • Game - Display to (All players) the text: You did it!
        • Else - Actions
          • Game - Display to (All players) the text: You pfail!
Isnt working, but in a new map it works, idk why...the Texts were just for testing reasons(and they appaered)
Anyway, heres the full trigger:
  • Map Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer LoopInt1) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player(LoopInt1)) slot status) Equal to Is playing
            • Then - Actions
              • Unit - Create 1 Peasant for (Player(LoopInt1)) at ((Player(LoopInt1)) start location) facing 270.00 degrees
              • Set PlayerHero[LoopInt1] = (Last created unit)
              • Game - Display to (All players) the text: You did it!
            • Else - Actions
              • Game - Display to (All players) the text: You pfail!
      • -------- Shopdach durchsichtig machen --------
      • Animation - Play Spell Breaker 0036 <gen>'s death animation
      • Unit Group - Add Marketplace Roof 0007 <gen> to MarketPlaceRoof
      • Unit Group - Add Marketplace Roof 0008 <gen> to MarketPlaceRoof
      • Unit Group - Add Marketplace Roof 0009 <gen> to MarketPlaceRoof
      • Unit Group - Add Marketplace Main Roof 0010 <gen> to MarketPlaceRoof
      • Unit Group - Pick every unit in MarketPlaceRoof and do (Actions)
        • Loop - Actions
          • Animation - Change (Picked unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
      • -------- Startitems verteilen --------
      • Set PlayerRegion[1] = (Center of Reds Item Start <gen>)
      • Set PlayerRegion[2] = (Center of Blues Item Start <gen>)
      • Set PlayerRegion[3] = (Center of Teals Item Start <gen>)
      • Set PlayerRegion[4] = (Center of Purples Item Start <gen>)
      • For each (Integer LoopInt1) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player(LoopInt1)) slot status) Equal to Is playing
            • Then - Actions
              • Set TempLoc = PlayerRegion[LoopInt1]
              • For each (Integer LoopInt2) from 1 to 4, do (Item - Create Lettuce at TempLoc)
              • For each (Integer LoopInt2) from 1 to 2, do (Item - Create Warm Potato Soup at TempLoc)
              • Custom script: call RemoveLocation(udg_TempLoc)
            • Else - Actions
      • -------- Monster respawn system --------
      • Set Respawn_Time = 60.00
      • Set TempGroup = (Units in (Playable map area) owned by Neutral Hostile)
      • Set TempGroup2 = (Units in (Playable map area) owned by Player 6 (Orange))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Set Temp_Integer = (Temp_Integer + 1)
          • Unit - Set the custom value of (Picked unit) to Temp_Integer
          • Set Creep_Point[Temp_Integer] = (Position of (Picked unit))
          • Unit Group - Pick every unit in TempGroup2 and do (Actions)
            • Loop - Actions
              • Set Temp_Integer = (Temp_Integer + 1)
              • Unit - Set the custom value of (Picked unit) to Temp_Integer
              • Set Creep_Point[Temp_Integer] = (Position of (Picked unit))
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Custom script: call DestroyGroup(udg_TempGroup2)
      • -------- CropSystemset --------
      • Set CropCount = (CropCount + 1)
      • Set CropType[CropCount] = Lettuce
      • Set CropDuration[CropCount] = 5
      • Set Cropdie[CropCount] = 4
      • Hashtable - Create a hashtable
      • Set Watercheck = (Last created hashtable)
      • Hashtable - Create a hashtable
      • Set numberofdays = (Last created hashtable)
      • Hashtable - Create a hashtable
      • Set rottendays = (Last created hashtable)
I thougt maybe another trigger of mine is going to instantkill the unit, but dont seems so(cuz of a revive trigger with a message that says something like "You died!*blabla*"
Anyway, i attached the Map, so feel free to look over it, maybe i oversaw something.

and of course i give +rep for the fastest solution
 

Attachments

  • Farmers Life, On The Farm!.w3x
    382.2 KB · Views: 51
Last edited:
1. Well open map that has trigger you want to copy!
2. Open triggers
3. Click on map icon
4. Find -> Enter map-specific custom script code below. This text will be included in the map script after variables are declared and before any trigger code.
5. If you find any code there probably you need to copy it to your map also
6. It should work :thumbs_up:
 
Maybe another trigger is auto-removing them? That wouldn't trigger a "unit dies" event.

Try to make a trigger that tells you whenever a unit enters region -- playable map, and print out the name of that unit. If it is a "peasant" or "custom_h000" etc (assuming you create no other units like that at map init), you know the trigger is working, but something else is interfering.
 
Level 4
Joined
Apr 25, 2009
Messages
74
Ok, the text appaered, after that i disabled every "broken" trigger(Because im actualy reworking mostly of the Map i got some "broken" Triggers.) (i thought the whole time over that every "broken" trigger is automaticly disabled xD) and now it works, i taked a closer look (before that i just looked at every trigger that has to do with "Peasant") and i think it was the following trigger:
  • Lettuce
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • Set TempPoint = (Position of (Triggering unit))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Value
          • (Terrain type at TempPoint) Not equal to Village - Crops
        • Then - Actions
          • Item - Create Item at TempPoint
          • Unit - Remove (Triggering unit) from the game
        • Else - Actions
      • Custom script: call RemoveLocation(udg_TempPoint)
anyway, +rep for Element of Water&Pharaoh.
Thread can be closed/whatever you do with "solved" problems.
 
Status
Not open for further replies.
Top