• 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.

[Trigger] Drain Mana Target Point?

Status
Not open for further replies.
Level 2
Joined
Jan 28, 2009
Messages
15
Need Help on a Fishing Trigger (and how to make Random Integer?)

Solved: Everything works perfectly^.^
check out my 3rd post if you want to download the map.






~ORIGINAL POST~

I have a dummy spell, and I want to trigger it so that it shows the drain mana effect(the blue line thing) between the caster and the target point...

And I also want the target to not be able to move while casting/channeling it (like 5-10sec)
*could use casting time on dummy spell for this though

(if you are curious, its for fishing...)

Thanks, -Seref
 
Last edited:
Level 2
Joined
Jan 28, 2009
Messages
15
Aerial Shackles didn't allow me to target the ground(water), but I found a way to do it with my skill... But I have some problems:

1) I want to make it so the caster doesn't move while its happening(but if i make cast time, the effects dont happen till after casttime). So I tryed pausing the unit, but when i unpaused it continues the skill thus having an infinite loop... I corrected it by removing the skill after unpausing and adding it again after .5sec, but there must be a more efficient way to do that.

2) I want to make it so I can only target water, but all I could do was limit the caster to have to be in water... Any ideas?

3) How do I make a random integer? aka probability...

Heres what I have so far:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Fishing fosjomg
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Land <gen> contains (Triggering unit)) Equal to False
        • Then - Actions
          • Special Effect - Create a special effect at (Target point of ability being cast) using Abilities\Spells\Other\Drain\ManaDrainCaster.mdl
          • Lightning - Create a Drain Mana lightning effect from source (Position of (Triggering unit)) to target (Target point of ability being cast)
          • Countdown Timer - Start fTimer[(Player number of (Triggering player))] as a One-shot timer that will expire in 5.00 seconds
          • Unit - Remove Fishing fosjomg from (Triggering unit)
          • Unit - Pause all units . . . . . . . . test map only has 1 unit, didn't wanna bother making a variable
        • Else - Actions
          • Game - Display to (All allies of (Owner of (Triggering unit))) the text: You cannot fish on ...
  • Untitled Trigger 002
    • Events
      • Time - fTimer[1] expires
    • Conditions
    • Actions
      • Lightning - Destroy (Last created lightning effect)
      • Special Effect - Destroy (Last created special effect)
      • Unit - Unpause all units
      • Wait 0.50 seconds
      • Unit - Add Fishing fosjomg to Peasant 0001 <gen>
Any ideas/corrections that can make this more efficent/do what I want are appreciated.

Thanks, -Seref
 
Level 6
Joined
Sep 5, 2007
Messages
264
You can use "begins casting an ability" to do your water check, if the destination isn't water, then just order casting unit to "stop". Use "starts effect of ability" to do the actual triggering.

As for the movement issue:
clone Neutral Passive>Slow Aura, set "movement speed factor" to -10 (just to be sure, incase of bonuses). If you can't set the value to a negative, then hold shift while you double-click it. You can change the buff to say something like: "This unit is fishing". Make sure the "targets allowed" is set to self.
In your "starts effect" trigger, give this cloned ability to your caster.
For this to work, you need to goto Advanced>Gameplay Constants, set "Movement - Unit Speed Minimum" to zero.

For a random value (real or integer) just scoll down the action list to "maths - random value".

To check if your unit has changed orders, just do a periodic check, to see if its "current order" is the order string of your fishing ability, if not then remove the cloned ability (allowing the unit to move).
 
Level 2
Joined
Jan 28, 2009
Messages
15
[edit]

Everything works perfectly now^.^
Thanks for all the help, +rep

ps. heres the map if anyone wants to check it out...
the only area that counts as "land" is the starting island(cuz i'm too lazy)
 

Attachments

  • fishing.w3x
    27 KB · Views: 60
Last edited:
Level 6
Joined
Sep 5, 2007
Messages
264
Use "target point of ability being cast". Use an "if/then/else" check to see if it's on land.
  • WaterCheck
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Fishing (fosjomg)
    • Actions
      • if
        • (Land <gen> contains (Target point of ability being cast)) Equal to True
      • then
        • Unit - Order (Casting unit) to Stop
        • Game - Display to (All allies of (Owner of (Casting unit))) the text: You cannot fish on ...
      • else
        • <do the actual fishing>
As for your triggers... do a search for "memory leaks".

Memory leaks are, mostly, temporary variables that hold information, if a leak isn't cleaned up then the memory that the variable was using isn't freed up... there are many kinds of leaks, and many ways to clean them up. GUI doesn't have access to these ways, however, you have to use what's called "custom scipt" to do it. Just remember that any variable used in custom script need to have "udg_" in front of them, and "_" where any spaces are.

Basicly, a "memory leak" is like a locker, you need the combination(variable) to open the locker(memory location), if you go into something else(different trigger/function), you forget that combination, and have to get a whole new locker... then, another & another, etc. Over time, the locker room runs out of space, and Wc3 starts lag.

These are the leaks in the above trigger:
  • (Land <gen> contains *leak*(Target point of ability being cast)) Equal to True
  • Unit - Order *leak*(Casting unit) to Stop
  • Game - Display to *leak*(All allies of (Owner of (Casting unit))) the text: You cannot fish on ...
To fix these leaks you need to assign them to variables to be able to clean them afterwards.
  • set <location variable> to (Target point of ability being cast)
  • (Land <gen> contains <location variable>) Equal to True
  • custom scipt: call DestroyLocation(<location variable>)
  • custom scipt: set udg_<location variable> = null
To do your text and "unit stop", you're better off just using only custom scipt:
  • set <unit variable> to (casting unit)
  • set <player variable> to (owner of <unit variable>)
  • custom scipt: call DisplayTextToPlayer(udg_<player variable>, 0, 0, <text>)
  • custom scipt: set udg_<player variable> = null
  • custom scipt: set udg_<unit variable> = null
This may not seem straight forward at first, but just work on it one line at a time. :thumbs_up:
 
Level 13
Joined
Mar 16, 2008
Messages
941
Sry BoNes, but the stuff you wrote about leaks isn't completly true :p

  • Unit - Order *leak*(Casting unit) to Stop
Doesn't leak, "casting unit" returns a unit, but without assigning it to a variable there is no leak. In addition, only locals need to be nulled because you use globals again and again, so even if you store "casting unit" in a variable
  • custom scipt: set udg_<unit variable> = null
it's not needed to null it. Also you NEVER need to null players, neither in GUI nor in Jass.

The rest is ok :p
 
Status
Not open for further replies.
Top