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

Player Disconnect Locals

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
So I have a system which makes 1 shop for each player at the same spot. Only 1 shop can be seen per player (each player has their own shop). Each shop stacks on top of each other so they are all at the same location (the buildings are stacked on top of each other).

Trigger:

  • Create Armories
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set TempPoint = (Center of Armory <gen>)
      • Player Group - Pick every player in ThePlayers and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Armory for Player 9 (Gray) at TempPoint facing Default building facing degrees
          • Unit - Change color of (Last created unit) to (Color of (Picked player))
          • Neutral Building - Add Hero Upgrade to (Last created unit) with 1 in stock and a max stock of 1
          • Neutral Building - Add Marine Training to (Last created unit) with 1 in stock and a max stock of 1
          • Neutral Building - Add Reinforced Plating to (Last created unit) with 1 in stock and a max stock of 1
          • Neutral Building - Add Armored Unit Plating to (Last created unit) with 1 in stock and a max stock of 1
          • Neutral Building - Add Firearms to (Last created unit) with 1 in stock and a max stock of 1
          • Neutral Building - Add Energy Cells to (Last created unit) with 1 in stock and a max stock of 1
          • Neutral Building - Add Supply to (Last created unit) with 1 in stock and a max stock of 1
          • Unit - Hide (Last created unit)
          • Custom script: if GetLocalPlayer() == GetEnumPlayer() then
          • Unit - Unhide (Last created unit)
          • Custom script: endif
      • Custom script: call RemoveLocation (udg_TempPoint)
When a player selects the shop, they are immediately disconnected from the game. Why is this and how do I fix it? Btw, I know next to nothing about locals and jass, so please baby me through it.
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
try to save the Picked Player in a variable

if GetLocalPlayer() == TempPlayer then

As I said, I don't know much about jass or locals. Not sure how to do what your asking.

After some research it seems you cannot locally use the "Hide Unit" action. The only thread I could find regarding locally hiding units is here: http://www.wc3c.net/showthread.php?p=1100333

Is this true, some work-around perhaps?
 
Using local player for this is risky. Instead of do that. Try this way:

Step one: Create a fake shop unit
Step two: Place all shop units to a secret location that nobody can't see.
Step three: Try playing with some trick code.
Step four: You're done!.

Below is the demo map, which used for ONE hero per player with a safer method.
 

Attachments

  • Demo.w3x
    18.4 KB · Views: 54
Level 17
Joined
Nov 13, 2006
Messages
1,814
So I have a system which makes 1 shop for each player at the same spot. Only 1 shop can be seen per player (each player has their own shop). Each shop stacks on top of each other so they are all at the same location (the buildings are stacked on top of each other).

Trigger:

  • Create Armories
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set TempPoint = (Center of Armory <gen>)
      • Player Group - Pick every player in ThePlayers and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Armory for Player 9 (Gray) at TempPoint facing Default building facing degrees
          • Unit - Change color of (Last created unit) to (Color of (Picked player))
          • Neutral Building - Add Hero Upgrade to (Last created unit) with 1 in stock and a max stock of 1
          • Neutral Building - Add Marine Training to (Last created unit) with 1 in stock and a max stock of 1
          • Neutral Building - Add Reinforced Plating to (Last created unit) with 1 in stock and a max stock of 1
          • Neutral Building - Add Armored Unit Plating to (Last created unit) with 1 in stock and a max stock of 1
          • Neutral Building - Add Firearms to (Last created unit) with 1 in stock and a max stock of 1
          • Neutral Building - Add Energy Cells to (Last created unit) with 1 in stock and a max stock of 1
          • Neutral Building - Add Supply to (Last created unit) with 1 in stock and a max stock of 1
          • Unit - Hide (Last created unit)
          • Custom script: if GetLocalPlayer() == GetEnumPlayer() then
          • Unit - Unhide (Last created unit)
          • Custom script: endif
      • Custom script: call RemoveLocation (udg_TempPoint)
When a player selects the shop, they are immediately disconnected from the game. Why is this and how do I fix it? Btw, I know next to nothing about locals and jass, so please baby me through it.

only jass what do u need is the
if GetLocalPlayer() == udg_PlayerVar then
normal trigger
endif

and u dont need hide the unit, if isnt building then just use animation vertex color opacity and make transparent, something like this:

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set PlayerVar = (Player((Integer A)))
          • Set PointVar = (Center of (Playable map area))
          • Set RealVar = 100.00
          • Unit - Create 1 Footman for PlayerVar at PointVar facing Default building facing degrees
          • Custom script: if GetLocalPlayer() == udg_PlayerVar then
          • Set RealVar = 0.00
          • Custom script: endif
          • Animation - Change (Last created unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with RealVar% transparency
          • Custom script: call RemoveLocation (udg_PointVar)
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
I'm so sorry, I forgot to reply to this thread to say I solved the problem using nhocklanhox6's method. I slightly altered your method to adapt it to my map, but it worked. In the end I decided against using a shop and switching to an upgrade building (player owned). Couldn't of figured this out without you. + rep.

Why are you hiding them locally anyways? :eek:

Mind giving us the idea?

I'll explain my current system. I wanted to create a shared upgrade building for all players. Of course you can't do that so I thought I'd create 1 building for each player stacked on top of each other and hide all of them, allowing each player to only see their own and walla; seemingly there's only 1 upgrade shop. The idea was to save map space and improve visuals.

I figured out locally hiding units causes desyncs so I used nhocklanhox6's method. I ended up giving each player their own upgrade center without a model (so it cant be seen) and hid the minimap display. A dummy research center was placed to give the appearance of 1 building. When a player selects the dummy center, they are automatically transferred selection to their own center.

I implemented it into my map already and it appears to be working. Feel free to take a look:

http://www.hiveworkshop.com/forums/maps-564/terran-base-defence-v37-224459/
 
Status
Not open for further replies.
Top