special effects

Lmfaocj

Active Member
Reaction score
1
I was wondering if its possible to make only one person not see a special effect
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Yes, through careful use of [ljass]GetLocalPlayer()[/ljass].

In GUI:

Trigger:
  • Actions
    • Set ModelString = Path\To\Model.mdl
    • Custom script: if GetLocalPlayer() == thePlayerYouWantToNotSeeTheEffect then
    • Set ModelString = <Empty String>
    • Custom script: endif
    • Special Effect - Create a special effect at (Center of (Playable map area)) using ModelString


You need to do it this way to avoid a desync; if you were to simply not make the effect for a particular player, instead of making an effect with a null model, then there'd be a different number of handles for each player and that would be a problem. ;)
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
If I may be rude for a moment - why do you need it in JASS if you don't know enough JASS to figure out on your own how it would be written based on the GUI example?

That said,
JASS:
function AddSpecialEffectExceptForOnePlayer takes string model, player whichPlayerShouldNotSeeIt, real X, real Y returns effect
    local string modelPath = model
    if GetLocalPlayer() == whichPlayerShouldNotSeeIt then
        set modelPath = ""
    endif
    return AddSpecialEffect(modelPath, X, Y)
endfunction
 

Lmfaocj

Active Member
Reaction score
1
Oh, I am really lazy and I didn't really want to write anything down today sorry.
 

jig7c

Stop reading me...-statement
Reaction score
123
Showing Special Effects For Player

JASS:
function CreateSpecialEffectForPlayer takes real x, real y, player p, string s returns effect
       if GetLocalPlayer() != p then // Check if the local player is not the passed player
          set s = "" // Set s to nothing
       endif
       return AddSpecialEffect(s, x, y) // Add the special effect. The effect will only have a visible model on the passed player's 
                                        // computer, because it was changed locally.
endfunction


Keep in mind that this method does in fact create the special effect for all computers, it simply changes the model string locally. This does not result in a different handle stack for each player, so it does not desync.

It should be noted that when a string is first used, it is added to WC3's string table. If a string is first used locally, the string table could be different for each player, and therefore could cause a desync.

The empty string ("") is always in the string table, so there are no worries about changing the string table with "".
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top