Jump to content


Photo

How can I spawn a team at another team?

spawn team

  • Please log in to reply
4 replies to this topic

#1 Jokuc

Jokuc

    Hardcore Procrastinator

  • Members
  • 187 posts
  • Location:Sweden
  •  Mapper

Posted 08 March 2020 - 05:37 PM

Yo. I want to spawn Team_X at the current location of Team_Y

 

How can this be done?

 

 

Spoiler

 

Edit: I kind of found a workaround by doing the "find object of type X closest to team Y and reference as unit X" then spawning on unit X. Would still like to know if there is another way. I'm also having this second issue now where I need to trigger a specific script multiple times at once, but since this script is looping every few seconds I can't just enable it.


Edited by Jokuc, 09 March 2020 - 06:53 PM.


#2 jurgy

jurgy
  • New Members
  • 4 posts

Posted 10 March 2020 - 06:34 PM

I'm kinda new to the world builder myself but I think I can help you with your second question:

 

You can set it as a subroutine and then have a trigger script that just executes the subroutine multiple times.

 

If you want to run it a variable amount of times you can do something like this:

 

Trigger script:

IF [Trigger condition]:
    Set Counter 'n' randomly between 0 and 10.
    Run Subroutine 'Repeatable Subroutine'

And the repeatable subroutine:

IF Counter 'n' IS Greater Than 0:
    [Do whatever]
    Subtract 1 from counter 'n'
    Run Subroutine 'Repeatable Subroutine'

Edited by jurgy, 10 March 2020 - 08:19 PM.


#3 Jokuc

Jokuc

    Hardcore Procrastinator

  • Members
  • 187 posts
  • Location:Sweden
  •  Mapper

Posted 12 March 2020 - 09:44 AM

 

You can set it as a subroutine and then have a trigger script that just executes the subroutine multiple times.

 

I've been using wb for years but still there are ideas I have every once in a while which I cannot find a way to do haha

 

Anyway, just running a subroutine X amount of times is not quite what I'm looking for. I guess I'll just make another topic in case I can't find a solution myself after a while, usually I ask questions here then end up solving them myself after a couple days.. I was just briefly mentioning the issue but to be more specific: 

  • I need Script A to loop and execute itself every 2nd second. After activated, Script A will loop indefinitely. Script A should be inactive by default.
  • Script B will call for Script A, but B will fire very frequently meaning that the amount of looping As will increase by the second. This is the reason I can't just use a subroutine, they don't loop themselves and a script can run multiple instances of itself afaik.
  • I thought of having multiple Script A enabling the next one in line then have Script B set a flag instead of directly enabling/running A, but it is not really a true solution as that is really messy. Do of course prefer the most elegant solutions so was thinking if there is a way to run instances of a script rather than just copy-paste it a hundred times.

Edited by Jokuc, 12 March 2020 - 09:46 AM.


#4 jurgy

jurgy
  • New Members
  • 4 posts

Posted 13 March 2020 - 04:58 PM

I don't really follow you.

 

What do you mean with "Script B will call for Script A"? 

Can't script B just enable A? Enabling a script multiple times doesn't reset or retrigger a script right? (Not sure, haven't tested it)

 

And why can't script A just loop (after being enabled)?



#5 Jokuc

Jokuc

    Hardcore Procrastinator

  • Members
  • 187 posts
  • Location:Sweden
  •  Mapper

Posted 15 March 2020 - 04:03 AM

I don't really follow you.

 

What do you mean with "Script B will call for Script A"? 

Can't script B just enable A? Enabling a script multiple times doesn't reset or retrigger a script right? (Not sure, haven't tested it)

 

And why can't script A just loop (after being enabled)?

 

Once an instance of team y meets a condition I want to loop this script (let's call it LoopScript) every few seconds:

 

Spawn an instance of Team X at the location of Team Y instance.

Team X instance executes script whatever sequentially.

 

Yes I can just enable this script and it will loop just fine spawning my team every 10 seconds or whatever. But the problem here is that since this particular script now will be looping, the next time another instance of Team Y meets the condition, it will run the LoopScript but the loop occurring from the previous instance will stop. Instead of restarting, I want another loop of constantly spawning units. This is what I meant with making multiple of the same script. I can solve the issue by enabling an identical script that will run in its place when a new instance needs it, but I can only do this so many times and it's a really ugly solution. Basically what I am asking is if it is possible to run instances of a script just like you can have instances of a team.


Edited by Jokuc, 17 March 2020 - 10:57 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users