Player Spawn?

laxperson808

New Member
Reaction score
9
map int
if player X is playing
then spawn unit Y for player X
else do nothing
(ive tried using pick every player and is picked is plaything then do but it never seems to work)
 

NeuroToxin

New Member
Reaction score
46
Do this
Trigger:
  • Map Init
    • Events
    • Map Initialization
    • Conditions
    • Actions
    • For each integer from 1 to (Your max amount of players playing) do actions
      • Loop Actions -
    • If/Then/Else multiple functions
    • if -
    • Player (Integer A) is playing == to true
    • then -
    • Unit - Create 1 (Unit) for Player(Integer A) at (Position) facing default building degrees (270)
    • else -

The Player(integer a) is under convert players to index - or something like that, cant remember exactly
 

iTzShiny

New Member
Reaction score
0
Trigger:
  • If/Then/Else multiple functions
    • if -
    • Player (Integer A) is playing == to true
    • then -
    • Unit - Create 1 (Unit) for Player(Integer A) at (Position) facing default building degrees (270)
    • else -


^ "If" Comes out as Condition? Is this right?
 

NeuroToxin

New Member
Reaction score
46
Correct, btw, (unit) is whatever unit you want, and (position) is the spot you want them spawned, but yes, thats how it works, in order for it to not come out as a condition, you gotta copy it straight from WE
 

iTzShiny

New Member
Reaction score
0
Correct, btw, (unit) is whatever unit you want, and (position) is the spot you want them spawned, but yes, thats how it works, in order for it to not come out as a condition, you gotta copy it straight from WE

Excatly , how do you do that?
 

NeuroToxin

New Member
Reaction score
46
oh, right click the top of the trigger (The trigger name) then hit convert to text, then hit paste on here
 

Ashlebede

New Member
Reaction score
43
In the trigger editor, click your trigger's name.

Trigger:
  • >>> Trigger Name <<<
    • Events
    • Conditions
    • Actions


And choose "Copy as text". You can then paste it between [ wc3][/wc3] tags (without a space, obviously) and post it here.
 

iTzShiny

New Member
Reaction score
0
In the trigger editor, click your trigger's name.

Trigger:
  • >>> Trigger Name <<<
    • Events
    • Conditions
    • Actions


And choose "Copy as text". You can then paste it between [ wc3][/wc3] tags (without a space, obviously) and post it here.

Im not actually asking for that im just asking how to Spawn a unit for Players that only in the game.
 

Ashlebede

New Member
Reaction score
43
Trigger:
  • //Hand-Written trigger. Beware!
    • Events
      • {Whatever}
    • Conditions
      • {Whatever}
    • Actions
      • If (Condition) then do (Actions) Else do (Else actions)
        • Conditions
          • ({Player} is playing) Equal to True
      • Then
        • Unit - Create 10 {Unit-Type} at {Point} Facing 270 degrees
      • Else


Or maybe it's "Player slot state equal to Is Playing". Something along those lines. Use this with a loop. Not really bringing anything new to what was previously mentioned.
 

iTzShiny

New Member
Reaction score
0
Thanks it works. but
Trigger:
  • SpawnHero
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
            • (Player 1 (Red) slot status) Equal to Is playing
            • Then - Actions
              • Unit - Create 1 Hunter for (Picked player) at (Center of Start <gen>) facing Default building facing degrees
              • Else - Actions
                • Do nothing


Why does this Spawn 6 units Instead of one?

Edit: Pretty sure its (Player 1 (Red) slot status) Equal to Is playing
 

Ashlebede

New Member
Reaction score
43
You're always checking the slot status of Player 1, instead of checking the slot status of Player A. I think that should be Player - Convert Integer to Player or Convert Player index to player, For loop integer A being the index.

By the way, this leaks. You might want to edit this later on, but this :

Trigger:
  • //
    • Unit - Create 1 Hunter for (Picked player) at (Center of Start <gen>) facing Default building facing degrees


Leaks. A new location is created every time and remains in your computer's memory, although it is unretrievable. You'd have to change this to :

Trigger:
  • //
    • Set MyPointVariable = (Center of Start <gen>)
    • Unit - Create 1 Hunter for (Picked player) at MyPointVariable facing Default building facing degrees
    • Custom Script : call RemoveLocation(udg_MyPointVariable)


Anyways, that's more advanced stuff. Ideally, you'd set the value of that point-type variable before the loop and remove the location after the loop.

Edit : Realized Picked Player cannot work, for there is no For each player in player group thing. You'd have to use Convert Player index to Player here, as well.
 

NeuroToxin

New Member
Reaction score
46
Use the Create 1 Hunter for (Player(Integer A)) at MyPointVariable facing Default Building Degrees
 

iTzShiny

New Member
Reaction score
0
Trigger:
  • <b>Convert Player index to player</b>, <b>For loop integer A</b>
This i tested and it didn't work But i have no idea how to do this
Trigger:
  • <b>Player - Convert Integer to Player</b>

^ I have no idea how to test this

And fixing the leak , i don't think it'll be possible because its in a If/Then/Else Format.
 

Ashlebede

New Member
Reaction score
43
I don't have the World Editor right now, so I can't really help you...

However, you can still fix the leak. Always.

Trigger:
  • //Hand-Written
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player(Integer A)) slot status) Equal to Is playing
            • Then - Actions
              • Set MyPointVariable = (Center of Start &lt;gen&gt;)
              • Unit - Create 1 Hunter for (Player(Integer A)) at MyPointVariable facing Default building facing degrees
              • Custom Script : call RemoveLocation(udg_MyPointVariable)
            • Else - Actions


And please remove the Do Nothing, since using that actually calls a function, which means the computer has to search your map script for that function amongst over 15,000 lines of code. Although that is only a split second you save, every little bit helps.

Edit : An alternative, if you really cannot find the Player index to player or whatever, then you can do a For each player in player group, instead.

Trigger:
  • //Hand-written
    • Events
    • Conditions
    • Actions
      • Set MyPointVariable = (Center of Start &lt;gen&gt;)
      • Player Group - Pick every player in (All Players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked Player) slot status) Equal to Is playing
            • Then - Actions
              • Unit - Create 1 Hunter for (Picked Player) at MyPointVariable facing Default building facing degrees
            • Else - Actions
      • Custom Script : call RemoveLocation(udg_MyPointVariable)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top