• 🏆 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!

item spawn with trigger

Status
Not open for further replies.
Level 19
Joined
Apr 21, 2013
Messages
1,194
i got a tirggered item spawning but whenever i test the map it spawns randomly sometimes 2 sometimes 3 or 1 here's the trigger;

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • missionRandom[loopInt] Equal to 2
    • Then - Actions
      • Game - Display to playerGroup[loopInt] the text: Your new quest is t...
      • Quest - Create a Required quest titled Bring the weapons. with the description Bring the newly bou..., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp
      • Set startQuests[loopInt] = (Last created quest)
      • Cinematic - Ping minimap for playerGroup[loopInt] at (Center of WeaponsZone <gen>) for 3.00 seconds, using a Flashy ping of color (100.00%, 100.00%, 100.00%)
      • For each (Integer itemSpawn2) from 1 to 5, do (Actions)
        • Loop - Actions
          • Set tempLoc[itemSpawn2] = (Random point in WeaponsZone <gen>)
          • Item - Create Weapon Crates at tempLoc[loopInt]
          • Custom script: call RemoveLocation(udg_tempLoc[udg_itemSpawn2])
      • Game - Display to playerGroup[loopInt] the text: Bring them to the c...
      • Cinematic - Ping minimap for playerGroup[loopInt] at (Position of Peasant 0110 <gen>) for 3.00 seconds, using a Flashy ping of color (100.00%, 100.00%, 100.00%)
    • Else - Actions
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
Try to post the whole trigger in the future and elaborate on what your problem is. Should this be spawning 5 items? If so you're using the wrong integer in the loop. You're also leaking locations, be sure to fix those.

i got a tirggered item spawning but whenever i test the map it spawns randomly sometimes 2 sometimes 3 or 1 here's the trigger;

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • missionRandom[loopInt] Equal to 2
    • Then - Actions
      • Game - Display to playerGroup[loopInt] the text: Your new quest is t...
      • Quest - Create a Required quest titled Bring the weapons. with the description Bring the newly bou..., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp
      • Set startQuests[loopInt] = (Last created quest)
      • Cinematic - Ping minimap for playerGroup[loopInt] at (Center of WeaponsZone <gen>) for 3.00 seconds, using a Flashy ping of color (100.00%, 100.00%, 100.00%)
      • For each (Integer itemSpawn2) from 1 to 5, do (Actions)
        • Loop - Actions
          • Set tempLoc[itemSpawn2] = (Random point in WeaponsZone <gen>)
          • Item - Create Weapon Crates at tempLoc[loopInt] // Wrong Integer Variable
          • Custom script: call RemoveLocation(udg_tempLoc[udg_itemSpawn2])
      • Game - Display to playerGroup[loopInt] the text: Bring them to the c...
      • Cinematic - Ping minimap for playerGroup[loopInt] at (Position of Peasant 0110 <gen>) for 3.00 seconds, using a Flashy ping of color (100.00%, 100.00%, 100.00%)
    • Else - Actions
 
Level 19
Joined
Apr 21, 2013
Messages
1,194
the whole trigger is this;
  • FirstQuests
    • Events
    • Conditions
    • Actions
      • For each (Integer loopInt) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • missionRandom[loopInt] Equal to 1
            • Then - Actions
              • Game - Display to playerGroup[loopInt] the text: Your new quest is t...
              • Quest - Create a Required quest titled Bring the grains with the description Bring the packed up..., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp
              • Set startQuests[loopInt] = (Last created quest)
              • Cinematic - Ping minimap for playerGroup[loopInt] at (Center of GrainsZone <gen>) for 3.00 seconds, using a Flashy ping of color (100.00%, 100.00%, 100.00%)
              • For each (Integer itemSpawn) from 1 to 6, do (Actions)
                • Loop - Actions
                  • Set tempLoc[itemSpawn] = (Random point in GrainSackSpawn <gen>)
                  • Item - Create Grain Barrel at tempLoc[loopInt]
                  • Custom script: call RemoveLocation(udg_tempLoc[udg_itemSpawn])
              • Game - Display to playerGroup[loopInt] the text: Bring them to the c...
              • Cinematic - Ping minimap for playerGroup[loopInt] at (Position of Peasant 0110 <gen>) for 3.00 seconds, using a Flashy ping of color (100.00%, 100.00%, 100.00%)
              • Custom script: Custom script: call PlaySoundForPlayer( gg_snd_YourSound, udg_snd_YourPlayer )
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • missionRandom[loopInt] Equal to 2
            • Then - Actions
              • Game - Display to playerGroup[loopInt] the text: Your new quest is t...
              • Quest - Create a Required quest titled Bring the weapons. with the description Bring the newly bou..., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp
              • Set startQuests[loopInt] = (Last created quest)
              • Cinematic - Ping minimap for playerGroup[loopInt] at (Center of WeaponsZone <gen>) for 3.00 seconds, using a Flashy ping of color (100.00%, 100.00%, 100.00%)
              • For each (Integer itemSpawn2) from 1 to 5, do (Actions)
                • Loop - Actions
                  • Set tempLoc[itemSpawn2] = (Random point in WeaponsZone <gen>)
                  • Item - Create Weapon Crates at tempLoc[loopInt]
                  • Custom script: call RemoveLocation(udg_tempLoc[udg_itemSpawn2])
              • Game - Display to playerGroup[loopInt] the text: Bring them to the c...
              • Cinematic - Ping minimap for playerGroup[loopInt] at (Position of Peasant 0110 <gen>) for 3.00 seconds, using a Flashy ping of color (100.00%, 100.00%, 100.00%)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • missionRandom[loopInt] Equal to 3
            • Then - Actions
              • Game - Display to playerGroup[loopInt] the text: Your new quest is t...
              • Quest - Create a Required quest titled Fish Job with the description Go fishing and load..., using icon path ReplaceableTextures\CommandButtons\BTNAmbush.blp
              • Set startQuests[loopInt] = (Last created quest)
              • Unit Group - Pick every unit in unitGroup[loopInt] and do (Hero - Create FishingRod and give it to (Picked unit))
              • Cinematic - Ping minimap for playerGroup[(Integer A)] at (Center of FishingZone1 <gen>) for 3.00 seconds, using a Flashy ping of color (100.00%, 100.00%, 100.00%)
              • Cinematic - Ping minimap for playerGroup[loopInt] at (Center of FishingZone2 <gen>) for 3.00 seconds, using a Flashy ping of color (100.00%, 100.00%, 100.00%)
              • Game - Display to playerGroup[loopInt] the text: Bring them to the c...
              • Cinematic - Ping minimap for playerGroup[loopInt] at (Random point in StartTalkWithBlackmore <gen>) for 3.00 seconds, using a Flashy ping of color (100.00%, 100.00%, 100.00%)
              • Unit Group - Pick every unit in unitGroup[loopInt] and do (Actions)
                • Loop - Actions
                  • Unit - Add Fish to (Picked unit)
            • Else - Actions
          • Sound - Play QuestNew <gen>
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Player 1 (Red) slot status) Equal to Is unused
            • Then - Actions
              • Quest - Mark startQuests[loopInt] as Completed
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Player 2 (Blue) slot status) Equal to Is unused
            • Then - Actions
              • Quest - Mark startQuests[loopInt] as Completed
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Player 3 (Teal) slot status) Equal to Is unused
            • Then - Actions
              • Quest - Mark startQuests[loopInt] as Completed
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Player 4 (Purple) slot status) Equal to Is unused
            • Then - Actions
              • Quest - Mark startQuests[loopInt] as Completed
            • Else - Actions
 
Level 19
Joined
Apr 21, 2013
Messages
1,194
Give us something to work with please...Tell us what it should do, what is happening instead, use debug messages. Did you try my suggestion?

yeap it should spawn 5 items in random points in region but it doesn't create 5. It places the items with random count sometimes 1 sometimes 2 or 3.

How can i get rid of those leaks of locations and what integer a should i use instead of the itemSpawn2

edit: okay the whole trigger is for this reason:
one of the player controlled heroes talks with computer hero and he gives our heroes different jobs to test our skills and use us. There are 3 jobs at all. Carrying grains to a location, carrying new bought weapons to the soldiers and fishing for the army feast. For that i created an Integer array with 4 indexes and gave them random values between 0 and 5, and i checked them with a loopInt variable and gave the corresponding quests for the heroes.

If randomInt == 1
give unitGroup[loopInt] grainMission
If randomInt == 2
give unitGroup[loopInt] weaponMission
If randomInt == 3
give unitGroup[loopInt] fishMission

my question is only for the weapon crate creations, thus, getting an answer to the grains also. If you explain me how to get rid of those leaks that would be awesome by the way :D
 
Last edited:
Status
Not open for further replies.
Top