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

Multi Player Instancebility

Status
Not open for further replies.
Hello guys, Im wondering if my trigger below is MPI.
  • CRoom Port 6 TOP
    • Events
      • Unit - A unit enters CloneRoomPort6TOP <gen>
    • Conditions
      • CRoomWarping[(Player number of (Owner of (Triggering unit)))] Equal to False
    • Actions
      • Set CRoomWarping[(Player number of (Owner of (Triggering unit)))] = True
      • Set CRoomPoint[(Player number of (Owner of (Triggering unit)))] = (Center of CloneRoomPort1BTM <gen>)
      • Set CRoomPoint2[(Player number of (Owner of (Triggering unit)))] = (Center of CRoom1EntBtm <gen>)
      • Set CRoomPoint3[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
      • Set CRoomPoint4[(Player number of (Owner of (Triggering unit)))] = (CRoomPoint3[(Player number of (Owner of (Triggering unit)))] offset by 600.00 towards 90.00 degrees)
      • Unit - Make (Triggering unit) Invulnerable
      • Unit - Turn collision for (Triggering unit) Off
      • Unit - Order (Triggering unit) to Move To CRoomPoint4[(Player number of (Owner of (Triggering unit)))]
      • Unit - Set (Triggering unit) movement speed to 300.00
      • Set CRoomFilter = 0.00
      • Custom script: if GetLocalPlayer() != GetOwningPlayer(GetTriggerUnit()) then
      • Set CRoomFilter = 100.00
      • Custom script: endif
      • Cinematic - Fade out over 0.70 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with CRoomFilter% transparency
      • Wait 1.00 seconds
      • Unit - Set (Triggering unit) movement speed to (Default movement speed of (Triggering unit))
      • Camera - Set the camera bounds for (Owner of (Triggering unit)) to CRoom1 <gen>
      • Unit - Move (Triggering unit) instantly to CRoomPoint[(Player number of (Owner of (Triggering unit)))]
      • Unit - Order (Triggering unit) to Move To CRoomPoint2[(Player number of (Owner of (Triggering unit)))]
      • Camera - Pan camera for (Owner of (Triggering unit)) to CRoomPoint[(Player number of (Owner of (Triggering unit)))] over 0.00 seconds
      • Set CRoomFilter = 0.00
      • Custom script: if GetLocalPlayer() != GetOwningPlayer(GetTriggerUnit()) then
      • Set CRoomFilter = 100.00
      • Custom script: endif
      • Cinematic - Fade in over 0.70 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with CRoomFilter% transparency
      • Camera - Lock camera target for (Owner of (Triggering unit)) to (Triggering unit), offset by (0.00, 0.00) using Default rotation
      • Wait 0.30 seconds
      • Set CRoomWarping[(Player number of (Owner of (Triggering unit)))] = False
      • Unit - Turn collision for (Triggering unit) On
      • Unit - Make (Triggering unit) Vulnerable
      • Selection - Select (Triggering unit) for (Owner of (Triggering unit))
      • Custom script: call RemoveLocation(udg_CRoomPoint[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
      • Custom script: call RemoveLocation(udg_CRoomPoint2[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
      • Custom script: call RemoveLocation(udg_CRoomPoint3[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
      • Custom script: call RemoveLocation(udg_CRoomPoint4[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
Now there's only 1 unit per player; so I just have to make sure it works for everyone, not every unit.

Basically, Im trying to create a warp system. You know, the ones you see in old games, where when you switch places, you can still see the character moving while the screen is fading out.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
Improve the efficiency of your script with variables usage. You use multiple references to:
- (Player number of (Owner of (Triggering unit)))
- (Owner of (Triggering unit))
- (Triggering unit)

I suggest setting additional variables in following order:
  • Set unit = (Triggering unit)
  • Set player = (Owner of unit)
  • Set index = (Player number of player)
Lets look at this fragment for example:
  • Wait 1.00 seconds
  • Unit - Set (Triggering unit) movement speed to (Default movement speed of (Triggering unit))
Since your event speaks of unit entering region, if another unit triggers this event during the 1.00 period the reference to (Triggering unit) will now point at newest unit and data about previous one will be lost. You need to fix those issues for trigger to be MUI.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
Triggering unit is a local variable and it is still mui or mpi w waits.

He also only wants it to be mpi. Setting the variables would be nice but u would lose mpi that way unless u make those variables local in the trigger but then u need to do more work. Although if this event happens a lot the efficiency gain might be worth the extra work.
 
Status
Not open for further replies.
Top