• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Spell problems - assistance requested

Status
Not open for further replies.
Level 3
Joined
Jan 16, 2010
Messages
24
I am trying to create a spell for my tag map.
What the spell basically does is summon a wolf and order it to attack a random
builder of a certain type from the map from the map .

Untitled.jpg

to be specific: i create a wolf and i order him to attack a Random Unit from (Units owned by (Random player from ( All allies of Player 1 (Red))) of type Female Peasant))

what it actually does is to attack a random unit of that type of Player 1, regardless if i specify ally of player 1 or an enemy of player 12
There are 2 forces:
Force 1: Player 1 to Player 9
Force 2: Player 10 -> Player 12
allied, shared vision, allied victory...
i really can't comprehend why this is not working

my second problem is: when i summon the wolf and it gets its order to attack, if i click it i can stop it i can move him or give him another order.
How can i make him so that either he cannot be clickable or that when he is clicked he won't accept any other order and the icons for move, patrol, attack, stand ground, etc, don't show (just like the units in Casle Fight)
 
Level 3
Joined
Jan 16, 2010
Messages
24
netrual hostile does not have anything to do with my script...

and what is the use of the locust spell? i've seen it adden in several spells but could never figure out its use...
 
Level 4
Joined
Jan 27, 2010
Messages
133
I think "Starts Effect of Spell" is generally better to use. It always triggers the moment that mana drains and cooldown starts.

You should use [trigger]-tags. Right click on your trigger, chose copy as text. On the forum, write: [trigger]YOUR COPIED TEXT[/trigger]

Problem 1:

I think DarkAngelAzazel might be onto something. Blizzard's random values sometimes come out not so random.

If you think Blizzard's playing you a trick, try to do something which should theoretically be equivalent... (and add debug output!) Like:
  • Set TempInt = (Random Integer from 1 to 9)
  • Game - Display Text Message ( Convert Integer to String ( TempInt ) )
  • Unit - Random Unit from (Units owned by Player( TempInt ))
Problem 2:

In the object editor, add the Classification "Ward". This will remove all orders but right-click (called "smart" by the editor).

Now you need to do a trigger that checks for this order, and re-orders your unit to go where you want to. This is tricky to do in pure GUI, since it involves the creation of timers (because you cannot issue a new order in a trigger caused by an order-event).
 
Last edited:
Level 3
Joined
Jan 16, 2010
Messages
24
ahaam.

ok, first of all i fixed the random thingy. I figured that the last 3 players would be actually stupid of me to add them runner builders so i reset the trigger to:
  • Unit - Order (Last created unit) to Attack (Random unit from (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Female Peasent)))
and it works just fine...

p.s. can't i disable the selection of an unit? i know that in many GUI-based spells, effects are created using units, units that cannot be selected. How would i do that?
 
Level 4
Joined
Jan 27, 2010
Messages
133
If you add the Locust-ability to a unit it will be unselectable and the player cannot give it orders (you can give it orders via triggers though).
 
Level 9
Joined
Nov 4, 2007
Messages
931
If your asking how to make a unit unselectable add Locust to its abilities in the object editor or triggers, Locust makes the unit unable to be selected.
Edit: What he said ^
 
Level 3
Joined
Jan 16, 2010
Messages
24
really? wow, that's perfect...
i just made a trigger to do the deselection, but i guess it is infinite less laggy just adding that ability instead of this trigger :))
  • Events
    • Time - Every 0.03 seconds of game time
  • Conditions
  • Actions
    • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Horny Hound)) and do (Actions)
      • Loop - Actions
        • Selection - Remove (Picked unit) from selection for Player 1 (Red)
        • Selection - Remove (Picked unit) from selection for Player 10 (Light Blue)
        • Selection - Remove (Picked unit) from selection for Player 11 (Dark Green)
        • Selection - Remove (Picked unit) from selection for Player 12 (Brown)
Thanks!
 
Level 3
Joined
Jan 16, 2010
Messages
24
i thought not to open another thread for a similar problem and use this to post another big question about the world of W3 GUI:

  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Megawave
  • Actions
    • Set Spell_Megawave_lvl = (Level of (Ability being cast) for (Triggering unit))
    • For each (Integer A) from 1 to (3 + (2 x Spell_Megawave_lvl)), do (Actions)
      • Loop - Actions
        • Unit - Create 1 Dummy (Megawave) for (Triggering player) at (Position of (Triggering unit)) facing (Facing of (Triggering unit)) degrees
        • Unit - Add Megawave (Dummy) to (Last created unit)
        • Unit - Set level of Megawave (Dummy) for (Last created unit) to Spell_Megawave_lvl
        • Unit - Order (Last created unit) to Orc Tauren Chieftain - Shockwave (Target point of ability being cast)
        • Unit - Remove (Last created unit) from the game
        • Wait 0.50 seconds
this script, at lvl 1 for Megawave should cast 5 waves of "shockwave"... instead it only casts 1 regardless of what "wait" or game time wait i give it , etc...
why? and how can i make it to cast it at every .5 seconds?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Save a real, 0.5 for triggering unit. Save (3 + (2 x Spell_Megawave_lvl)) as an integer for the triggering unit. Add triggering unit to unit group. Create a trigger that pick all units in that unit group every 0.03 seconds. Load the real value. Check if the real is equal to 0.5, if it is create the dummy unit and order it to cast. Reduce the real by 0.03 and save it. When the real hits zero, load the integer, reduce it by 1 and save it. If the integer is greater than 0, save the real as 0.5 again. If the integer is 0, remove the unit from the unit group.
 
Level 3
Joined
Jan 16, 2010
Messages
24
there are moments like these when I wish i had started learning JASS...
all that fuss to do an action every .5 second properly? SHIT!
 
Level 3
Joined
Jan 16, 2010
Messages
24
yes i know, that is what i am attepting... just that... look at it: it should be so simple with just a few lines of "code" in 1 trigger... not with many more lines of "code" in 2 triggers:|
 
Status
Not open for further replies.
Top