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

Making egg sacks spawn spiders

Status
Not open for further replies.
Level 7
Joined
Jul 1, 2008
Messages
1,025
You know in the human campaign, theres one dungeon map where a bunch of egg sacks spawn spiders if you don't kill them in time. I've been trying to do something like this myself and this is the best I can come up with, as you can see it's not realy very reliable and I'm sure it leaks or soemthing.

Imagine this times like however many egg sacks I have and its gunna be one hell of a trigger, is there a better way of doing this?

  • Events
    • Unit - A unit enters region <gen>
  • Conditions
    • ((Triggering unit) is A Hero) Equal to True
  • Actions
    • Wait 30.00 seconds
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Egg Sack 2660 <gen> is alive) Equal to True
      • Then - Actions
        • Destructible - Kill Egg Sack 2660 <gen>
        • Unit - Create 3 Spider for Player 4 (Purple) at (Center of Zul Egg spawn 1 <gen>) facing Default building facing degrees
      • Else - Actions
        • Do nothing
 
Level 10
Joined
Jun 1, 2008
Messages
485
Try This
  • Spawn Spiders
    • Events
      • Unit - A unit enters Region <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to (==) True
    • Actions
      • Wait 30.00 seconds
      • Destructible - Pick every destructible in <Region of Egg Sack> and do (Actions)
        • Loop - Actions
          • Multiple Functions If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Destructible-type of (Picked destructible)) Equal to (==) Egg Sack
              • ((Picked destructible) is alive) Equal to (==) True
            • Then - Actions
              • Unit - Create 3 Spider for Player 1 (Red) at (Position of (Picked unit)) facing Default building facing (270.0) degrees
            • Else - Actions
You just need to add region to you egg sack, and this trigger leak one position.
 
Level 18
Joined
Oct 18, 2007
Messages
930
  • Spawn Spiders
    • Events
      • Unit - A unit enters Region <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to (==) True
    • Actions
      • Wait 30.00 seconds
      • Destructible - Pick every Destructible in <Region of Egg Sack> and do (Actions)
      • Loop - Actions
        • Multiple Functions If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Destructible-type of (Picked destructible)) Equal to (==) Egg Sack
            • ((Picked destructible) is alive) Equal to (==) True
          • Then - Actions
            • Set MyLocation = (Position of (Picked unit))
            • Unit - Create 3 Spider for Player 1 (Red) at (MyLocation) facing Default building facing (270.0) degrees
            • Custom script: call DestroyLocation(udg_MyLocation)
          • Else - Actions
Fixed the leak
 
Level 7
Joined
Jul 1, 2008
Messages
1,025
Ok guys I don't know what I'm doing wrong, the editor won't accept my trigger for some reason, it comes up with a message "line201:expected "endif" the it highlights this costum script part " Call DestroyLocation(udg_MyLocation)".

Have I written the costum script wrong or is the variable wrong? I set it as a point and named it "mylocation". This is the first time I'm trying to use variables, heres mt trigger so far:

  • Spider Spawn
    • Events
      • Unit - A unit enters region <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Trigger - Turn off (This trigger)
      • Wait 30.00 seconds
      • Destructible - Pick every destructible in Zul Egg Spawn 2 <gen> and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked destructible) is alive) Equal to True
              • (Destructible-type of (Picked destructible)) Equal to Egg Sack
            • Then - Actions
              • Set Mylocation = (Position of (Picked unit))
              • Unit - Create 5 Spider for Player 4 (Purple) at Mylocation facing Default building facing degrees
              • Custom script: Call DestroyLocation(udg_MyLocation)
            • Else - Actions
 
Level 6
Joined
Mar 15, 2005
Messages
112
Looks like it doesn't like custom script inside a GUI loop. try putting the destroy action outside of the loop.
  • Destructible - Pick every destructible in Zul Egg Spawn 2 <gen> and do (Actions)
  • Loop - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • ((Picked destructible) is alive) Equal to True
  • (Destructible-type of (Picked destructible)) Equal to Egg Sack
  • Then - Actions
  • Set Mylocation = (Position of (Picked unit))
  • Unit - Create 5 Spider for Player 4 (Purple) at Mylocation facing Default building facing degrees
  • Else - Actions //Not here inside the else actions.
  • ....................................................................
  • Custom script: Call DestroyLocation(udg_MyLocation)
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
Ok guys I don't know what I'm doing wrong, the editor won't accept my trigger for some reason, it comes up with a message "line201:expected "endif" the it highlights this costum script part " Call DestroyLocation(udg_MyLocation)".

Have I written the costum script wrong or is the variable wrong? I set it as a point and named it "mylocation". This is the first time I'm trying to use variables, heres mt trigger so far:

  • Spider Spawn
    • Events
      • Unit - A unit enters region <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Trigger - Turn off (This trigger)
      • Wait 30.00 seconds
      • Destructible - Pick every destructible in Zul Egg Spawn 2 <gen> and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked destructible) is alive) Equal to True
              • (Destructible-type of (Picked destructible)) Equal to Egg Sack
            • Then - Actions
              • Set Mylocation = (Position of (Picked unit))
              • Unit - Create 5 Spider for Player 4 (Purple) at Mylocation facing Default building facing degrees
              • Custom script: Call DestroyLocation(udg_MyLocation)
            • Else - Actions

U made some mistakes:

1) Variable: MyLocation (In custom script.) does not equal Mylocation.
2) It's call not Call as far as I know.

EDIT:

IncubiProtocoL --> Fail =D You can use it in loops.
 
Level 7
Joined
Jul 1, 2008
Messages
1,025
Arg I'm sick of this trigger, I've tried it with casings fixed but it still won't work, the rest of the trigger works fine including the variable its just the "call DestroyLocation(ugd_Mylocation)" that the editer won't allow.

I guess it will just ahve to leak till I can work out whats wrong with it, thanks anyway though guys
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
i always thought it was: call RemoveLocation(udg_MyLocation) ??
Maybe that is it..
Dunno, ima noob at Jass and stuff..

True that, I forgot to notice.

EDIT: Your fixed trigger:
  • Spider Spawn
    • Events
      • Unit - A unit enters region <gen>
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Trigger - Turn off (This trigger)
      • Wait 30.00 seconds
      • Destructible - Pick every destructible in Zul Egg Spawn 2 <gen> and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked destructible) is alive) Equal to True
              • (Destructible-type of (Picked destructible)) Equal to Egg Sack
            • Then - Actions
              • Set Mylocation = (Position of (Picked unit))
              • Unit - Create 5 Spider for Player 4 (Purple) at Mylocation facing Default building facing degrees
              • Custom script: call RemoveLocation(udg_Mylocation)
            • Else - Actions
EDIT2: I think it still leaks a group, not sure with destructibles though.
 
Status
Not open for further replies.
Top