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

Ally only visual effect

Status
Not open for further replies.
Level 10
Joined
Sep 3, 2009
Messages
458
It's an effect that you and your allies can only see.(Enemies cant see it.)

For example on the Hero Gyrocopter, when he launches his ultimate there would be a large marker on the ground that only you and your allies can see.

That' basically what I mean.
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
Try this:
JASS:
function onCast takes nothing returns nothing
    local string path=""
    local integer i=0
    loop
        exitwhen i==bj_MAX_PLAYERS
        if (IsPlayerAlly(GetOwningPlayer(GetTriggerUnit()),Player(i)) then
            set path="special\effect\path"
        endif
        set i=i+1
    endloop
    call AddSpecialEffect(path,0,0)
endfunction

You need Local Player. Do it like this:
JASS:
function onCast takes nothing returns nothing
    local string path=""
    if IsPlayerAlly(GetOwningPlayer(GetTriggerUnit()),GetLocalPlayer()) then
        set path="special\effect\path"
    endif
    call AddSpecialEffect(path,0,0)
endfunction

More about GetLocalPlayer() here: http://world-editor-tutorials.thehelper.net/cat_usersubmit.php?view=89207
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
The JASS script will desync every battle.net game you try to play. It needs this instead:

JASS:
function onCast takes nothing returns nothing
    local string path = "special\\effect\\path.mdl"
    if IsPlayerEnemy(GetTriggerPlayer(), GetLocalPlayer()) then
        set path = ""
    endif
    call AddSpecialEffect(path, 0, 0)
endfunction

The string needs to be initialized before entering the "local player" block.
 
Status
Not open for further replies.
Top