• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

SFX just visible for one player?

Status
Not open for further replies.
Level 8
Joined
Aug 4, 2006
Messages
357
JASS:
  function AddSpecialEffectForPlayer takes string modelpath, real x, real y, player whichplayer returns effect      local string s = ""
      if GetLocalPlayer() == whichplayer then
         set s = modelpath
      endif
      return AddSpecialEffect(modelpath, x, y)
  endfunction
I'm not sure if you know jass, but this will do what you want without causing desyncs (a.k.a. server splits).

You can learn more about GetLocalPlayer() here: http://www.hiveworkshop.com/forums/jass-ai-scripts-tutorials-280/using-getlocalplayer-59368/
 
Level 11
Joined
Dec 31, 2007
Messages
780
no, i dont know jass :S

but i should do:

when it sais "whichplayer" i shoul write the player i want the sfx to be displayed for ?

when it says "modelpath" i should write the model path i want \\ instead of \ ?

and x and y : should i replace them for real values of the point in map i want the sfx to be created at ?

now, should i destroy the sfx? should i null any variable? x and y are locals, so they wont interfere in any other global type of variable existant with the same name?
 
Level 4
Joined
Mar 23, 2008
Messages
87
JASS:
//To use maskedpoptarts example you call the function in a trigger like so:
call AddSpecialEffectForPlayer("yourmodelhere", x_point_in_map, y_point, Player(playernumber))
//
 
Level 8
Joined
Aug 6, 2008
Messages
451
Dont try that.

This is how it should be done:

JASS:
function AddLocalEffect takes player p, string path, real x, real y returns effect
    if GetLocalPlayer() != p then
       set path=""
    endif
    return AddSpecialEffect(path, x, y)
endfunction


If you are a GUI user, learn to Jass at least that much that you can do local effects without ruining your map.
 
Level 8
Joined
Aug 6, 2008
Messages
451
Creating some handles locally indeed desyncs.

For example textags are expections, because their handle ids are preallocated or something. Dont know about other pseudo handles ( or non agents since 1.24 ? ) because I havent tested those.
 
Level 2
Joined
Jul 17, 2009
Messages
27
Text Tag id's don't use the same stack as other handles, they are integers from 0 - 99, as I recall.

(Non-Weather) Effect id's are on the same stack as Unit id's, Group id's, etc...
 
Status
Not open for further replies.
Top