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

[General] Specialeffect only show for one Team

Status
Not open for further replies.
Level 14
Joined
Jan 24, 2017
Messages
246
I have spells on which I want to put a special effect on for each team. It should be green to show that the spell is from your team and red to show that it is from your opponent team. How can I display it for only one team? Do I need localplayer for that?

Thanks Zia
 
Level 7
Joined
Feb 10, 2016
Messages
59
Yes, you'll need localplayer. The key to making this work is that Warcraft will desync if a special effect exists for only some of the players... but that special effect is actually rendered based on its filepath, and that can be different for different players without causing a desync.

So, first step: get the string for the green effect's filepath, and the string for the red effect's filepath. Save them as separate variables, then make a third variable for the effect's filepath.

Next step: When the trigger that goes with the spell is fired, use localplayer to figure out if an ally or an enemy is casting. If it's an ally, set that third variable equal to the first one (for the green effect,) otherwise set the third variable to the second one (for the red effect.)

Last step: When you get to the part of the trigger where you actually create the special effect, use that third variable for the effect's filepath.
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
  • Something
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Awesome Spell
    • Actions
      • Set SFX_Model = <Empty String>
      • Custom script: if IsPlayerAlly(GetLocalPlayer(), Player(0)) then
      • Set SFX_Model = Abilities\Spells\Undead\AntiMagicShell\AntiMagicShell.mdl
      • Custom script: else
      • Set SFX_Model = Abilities\Spells\Undead\Curse\CurseTarget.mdl
      • Custom script: endif
      • Set Point = (Center of (Playable map area))
      • Special Effect - Create a special effect at Point using SFX_Model
      • Custom script: call RemoveLocation(udg_Point)
Should look something like this
 
Status
Not open for further replies.
Top