1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Lead your forces to battle in the 15th Techtree Contest. The call is yours, commander!
    Dismiss Notice
  4. The reforging of the races is complete. Come see the 14th Techtree Contest Results.
    Dismiss Notice
  5. It's time to choose your horse in the race - the 32nd Modeling Contest Poll is up!
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Spell Question - Would appreciate fast reply

Discussion in 'Triggers & Scripts' started by Dragon_Lord, Apr 25, 2005.

  1. Dragon_Lord

    Dragon_Lord

    Joined:
    Jul 20, 2004
    Messages:
    156
    Resources:
    0
    Resources:
    0
    I have a fan of knives spell. I want it to ensnare a random 1-15 units near the caster. I have a dummy unit with the ensnare spell and everything else thats needed, but my trigger just doesn't seem to be working. Here it is:

    Assassin's Favorite Shot
    Events:
    Unit - A unit Starts the effect of an ability
    Conditions:
    (Ability being cast) Equal to Assassin's Favorite Shot
    Actions:
    Unit - Create one Assassin's Favorite Shot Dummy for (Owner of (Casting unit)) at (Target point of ability being cast) facing Default building degrees
    Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
    Unit - Order (Last created unit) to Orc Raider - Ensnare (Random unit from (Random (Random integer number between 1 and 15) units from (Units within 1000.00 of (Position of (Targeted unit)))))

    Can anyone correct this? Thanks.
     
  2. Chuckle Brother

    Chuckle Brother

    Joined:
    May 16, 2004
    Messages:
    392
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Well I can see several problems, now I may be wrong but I don't think that slam spells like FON has a target point, instead create them at position of casting unit. Next, since you only have one casting unit there is a slight delay between castings, meaning that it will only ensnare maybe one or two units(if you are lucky) so for the casting I suggest doing this:
    Code (Text):
    for loop integer A 1- (number of units within
    1000 of casting unit matching (belongs to an enemy of owner of casting unit)
        Loop Actions-
               Pick random 1 unit within 1000 of position
               of casting unit matching (belongs to an
               enemy of owner of casting unit) and
               (is alive equal to true) and (has buff
               (ensnare) equal to false)
           Create 1 Ensnarer for (owner of casting unit)  
           at position of picked units
           add generic expiration timer to last created
           unit
           Order last created unit to Orc- raider ensnare
           (picked unit)
    Its kinda messy and psuedo code but that is basically the way it should be done, if it doesnt work tell me and ill make a test for you to see
     
  3. Dragon_Lord

    Dragon_Lord

    Joined:
    Jul 20, 2004
    Messages:
    156
    Resources:
    0
    Resources:
    0
    Erm... could you write it like I did in mine? Thats... kind of confusing.
     
  4. Devran04

    Devran04

    Joined:
    Mar 10, 2005
    Messages:
    19
    Resources:
    0
    Resources:
    0
    well chuckle i think youre way is too complicated and confusing. there has been a specific nova target system in the spells section which explains how to solve this problem. maybe you should download it. well heres how it works.

    only do:
    actions
    PICK every unit within range <your range> and do
    create dummy unit at position of casting unit
    add a 1 sec expiration timer to last created unit
    order last created unit to ....effect.... PICKED unit
     
  5. Chuckle Brother

    Chuckle Brother

    Joined:
    May 16, 2004
    Messages:
    392
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Um well see that is what I said, just using a loop way, and sorry about how it was wierdly set, I had typed it and had to copy paste it and it went all wierd
     
  6. Daelin

    Daelin

    Joined:
    Jul 20, 2004
    Messages:
    3,111
    Resources:
    41
    Models:
    22
    Icons:
    3
    Tutorials:
    16
    Resources:
    41
    *mumbles something about incompetence

    Oh well, here is the solution. Use dummy units of course and yes, you need a variable (so it won't really be multiinstance unless you use JASS). Call it... g and make it an unit group. Also have an unit varaible called u. Now, have a look at this trigger:

    For Integer A from 1 to Random Integer between 1 and 15 do actions
    -> set u = Random Unit From Unit Group ((Units In 1000 range of (Triggering Unit))) Matching Condition (Picked Unit is an Enemy of (Owner of (Casting Unit))) equal to true
    -> Add u to g //Add Unit to group action
    -> Create 1 Dummy Unit for Owner of (Casting Unit) at (Position of u) facing 0.00 angle
    -> Add 1 second Expiration Timer to (Last Created Unit)
    -> Order (Last Created Unit) to Orc - Raider - Ensnare u

    set u = null
    set g = null

    That should avoid MOST of the leaks. To know more about leaks, look in the FAQ.

    ~Daelin
     
  7. Chuckle Brother

    Chuckle Brother

    Joined:
    May 16, 2004
    Messages:
    392
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Are you mumbling about my incompetence? if so then I am very deeply hurt, I have the right to be a noob whenever I want, thank you very much.
     
  8. Daelin

    Daelin

    Joined:
    Jul 20, 2004
    Messages:
    3,111
    Resources:
    41
    Models:
    22
    Icons:
    3
    Tutorials:
    16
    Resources:
    41
    Ehehe... actually no. I should've mentioned Devran. And why I made that masked comment? Ok, here we go:

    Devran: Your idea is just picking up all units, this guy needs only 1-15 random units within the AoE.

    ~Daelin
     
  9. Devran04

    Devran04

    Joined:
    Mar 10, 2005
    Messages:
    19
    Resources:
    0
    Resources:
    0
    ähm yes i didnt notice it was supposed to be for only 15 units. well i notice me doing this mistake very often. i only read the main things and forgot the details, sry for that. once i wrote an physics exam and i didnt read that at the end of the bottom has been clearly said: plz write all the varaibles before you use the value. the complete exam was correct. but the teacher didnt gave me an A he gave me a B- caus i didnt work with the variables..... LOL yesterday i wrote a maths exam and did nealry the same mistake. i know this is quite off topic but i only want to excuse me for doing such mistakes.
     
  10. Daelin

    Daelin

    Joined:
    Jul 20, 2004
    Messages:
    3,111
    Resources:
    41
    Models:
    22
    Icons:
    3
    Tutorials:
    16
    Resources:
    41
    There is no problem... I may have been a little harsh but these comments and controverses kinda caught me in too. Dragon_Lord, check what I told you, and if it works, I will close this thread (no more spamming :p).

    I know I'm a little bit strict about closing threads guys and I don't mean to be strict, but I just want to avoid spamming. I think the Offtopic section has enough spammers and gives enough opportunities (I hate it...). Oh well...

    ~Daelin
     
  11. Chuckle Brother

    Chuckle Brother

    Joined:
    May 16, 2004
    Messages:
    392
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Hmm, what was that you said about spamming mister double poster? ha look at me! Im spamming woohoo
     
  12. Daelin

    Daelin

    Joined:
    Jul 20, 2004
    Messages:
    3,111
    Resources:
    41
    Models:
    22
    Icons:
    3
    Tutorials:
    16
    Resources:
    41
    Whenever I double post, I think I delete my last post... And it happened well, perhaps twice because I had some problems with the connection. I wouldn't be so harsh CB if I were you. :evil:

    ~Daelin