PQR: cast spell when target is near. [question] menu

User Tag List

Results 1 to 11 of 11
  1. #1
    Fantersam123's Avatar Private
    Reputation
    1
    Join Date
    May 2013
    Posts
    9
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PQR: cast spell when target is near. [question]

    Currently trying to build my very first rotation with pqr. It consists of frost bolt and frost nova so far . lol
    I have thought of something like this:

    Frost Bolt (SpellID 116)

    Code:
     
    while IsSpellInRange("Frostbolt", "target") == 1 do
    return true
    
    end
    
     if CheckInteractDistance("target", 3) == 1 then return false
    
     end
    Frost Nova (SpellID 122)

    Code:
    if CheckInteractDistance("target",2) == 1 then
    return true
    
    end
    I want to spam frostbolt until the enemy is standing next to me, after that I want to cast frost nova.

    Well to keep it short: it doesn't work. If I have a return false sentence in my frost bolt script: no frostbolt is casted. If i remove the return false sentence, at least the casting of a frost bolt works. But without a return false sentence I won't be able to cast frost nova when the target is near.

    PQR: cast spell when target is near. [question]
  2. #2
    CodeMyLife's Avatar Contributor
    Reputation
    272
    Join Date
    Mar 2013
    Posts
    707
    Thanks G/R
    24/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey hello there!

    Firstly i would say try using only "if" "then" statements. "While" is for some other uses you do not need that.

    Place your nova atop the list. If in range them cast nova.

    After that place frosbolt with no checks at all. Just a return true.

    Additionally return true is only valid if your ability is well set to the left. Otherwise you could use CastSpellByName instead or return true.

    Hope this helps
    Soapbox Rotations Developer

  3. #3
    crystal_tech's Avatar Elite User
    Reputation
    468
    Join Date
    Feb 2008
    Posts
    1,033
    Thanks G/R
    1/6
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mk, i don't understand the while do loop you have as it will loop until its false and never move down in the code.

    try this:

    PHP Code:
    if UnitExists("target"then
    if CheckInteractDistance("target"2) and PQR_SpellAvailable(GetSpellInfo(122)) then CastSpellByName(GetSpellInfo(122)) end

    if IsSpellInRange(GetSpellInfo(116), "target") == and not CheckInteractDistance("target"2then CastSpellByName(GetSpellInfo(116), "target"end
    end 
    just add it to one ability and to test it target a dummy and walk towards it once your close it should stop casting bolt and only do nova until you move back.

    Please if someone helped you donate rep to them.

  4. #4
    Fantersam123's Avatar Private
    Reputation
    1
    Join Date
    May 2013
    Posts
    9
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay thanks very much guys. I made it more complicated than it is.
    Another question: My chat always gets spammed that frost bolt returned true.
    can i disable that?

  5. #5
    CodeMyLife's Avatar Contributor
    Reputation
    272
    Join Date
    Mar 2013
    Posts
    707
    Thanks G/R
    24/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    By they way here's some crucial information for you mate.

    -- Worprogramming is very complete but have less explanations and some functions are undocummented.
    docs/api - World of Warcraft Programming: A Guide and Reference for Creating WoW Addons

    -- Wowpedia has less functions but are better documented most of time.
    http://www.*************/World_of_Warcraft_API

    This is where most of us learn. You should give it a look

    Happy Coding!!

    About chat, maybe in pqr settings you will find your answer, sadly no clues your code(if you used crystals code) is not printing messages to chat normally.

  6. #6
    crystal_tech's Avatar Elite User
    Reputation
    468
    Join Date
    Feb 2008
    Posts
    1,033
    Thanks G/R
    1/6
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    prob have debug level set too high in settings menu.

    Please if someone helped you donate rep to them.

  7. #7
    Fantersam123's Avatar Private
    Reputation
    1
    Join Date
    May 2013
    Posts
    9
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay thanks. works now.
    As you may notice im completly new to coding

    Is this the right approach to add a simple fireblast every time it is available and the target is in range?

    Code:
    if UnitExists("target") then
    
    if CheckInteractDistance("target", 2) and PQR_SpellAvailable(GetSpellInfo(122)) then CastSpellByName(GetSpellInfo(122)) end
    
    if IsSpellInRange(GetSpellInfo(2136), "target") and PQR_SpellAvailable(GetSpellInfo(2136)) then CastSpellByName(GetSpellInfo(2136), "target") end
    
    if IsSpellInRange(GetSpellInfo(116), "target") == 1 and PQR_SpellAvailable(GetSpellInfo(2136)) == nil and not CheckInteractDistance("target", 2) then CastSpellByName(GetSpellInfo(116), "target") end
    
    end
    I'm kind off confused with the PQR refernce.
    It says that SpellAvailable returns true when its available and false when its not available

    available is " == 1 "
    false is " == nil "

    right?

  8. #8
    CodeMyLife's Avatar Contributor
    Reputation
    272
    Join Date
    Mar 2013
    Posts
    707
    Thanks G/R
    24/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay I forgot to tell there is also a lua sheet in your ability editor you can click Lua File Editor to the left and go to the data sheet named Reference. Your answer is there mate

    Well I will draw you an exemple.

    Here's My judgement out of melee range code:

    if PQR_SpellAvailable(20271)
    and IsSpellInRange(GetSpellInfo(35395), "Target") == 0 then
    return true
    end

    PQR_SpellAvailable(ID) will return true or false itself, you dont need any other things around it. It's a PQR function itself and can be used in every profiles as is. The way to test if it is not ready is simply : "not".

    You do not need the double check if the spell is not ready as if it was, the roation would have thrown it first. However as I read your script you have no "return true" at all so the script is read from the beginning to the end everytime. It is of common use to return true so the script is ran again everytime you find a match and cast an ability unless you really want the things next to it to be read too exemple if you throw a spell wich is out of GCD as damage cooldowns you dont need to return true you can call them all at ouce easily. Coding all abilities in a single file requires your ability to the left to be set to 0 so that after the cast you return true "0"so that the script is ran again without throwing abilities.

    if UnitExists("target") then

    if CheckInteractDistance("target", 2) and PQR_SpellAvailable(122) then CastSpellByName(GetSpellInfo(122)) return true end

    if IsSpellInRange(GetSpellInfo(2136), "target") == 1 and PQR_SpellAvailable(2136) then CastSpellByName(GetSpellInfo(2136), "target") return true end

    if IsSpellInRange(GetSpellInfo(116), "target") == 1 and PQR_SpellAvailable(116) then CastSpellByName(GetSpellInfo(116), "target") return true end

    end

    the 116 will be thrown only if you are out of checkdistance2, why is it? is there a minimum range on fireblast? dont think so so i removed it . Basically you need target validation, like you have at the beginning then range checks for abilities its great and then you get the spellavailable for each ability. If it's thrown then reload script with return true!

    Test this out bro, good luck!

    PS im no mage at all maybe the ids i used are not the good ones in the good order, the syntax however should be correct.
    Last edited by CodeMyLife; 06-10-2013 at 05:24 PM.

  9. #9
    Fantersam123's Avatar Private
    Reputation
    1
    Join Date
    May 2013
    Posts
    9
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the comprehensive adjustment.
    I'll check it tomorrow. I go to sleep now.

    The whole thing about return true confuses me. I don't seem to understand the flow of a script.

  10. #10
    CodeMyLife's Avatar Contributor
    Reputation
    272
    Join Date
    Mar 2013
    Posts
    707
    Thanks G/R
    24/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    in fact its the return itself that calls a re-run script. if you dont wanna cast anything you can return false and script will restart.

  11. #11
    crystal_tech's Avatar Elite User
    Reputation
    468
    Join Date
    Feb 2008
    Posts
    1,033
    Thanks G/R
    1/6
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    heres a simple guide of sorts for LUA: Lua for Beginners

    Please if someone helped you donate rep to them.

Similar Threads

  1. [Lua] Mobs always cast spells on themselves. Not the target
    By Wheeze201 in forum WoW EMU Questions & Requests
    Replies: 10
    Last Post: 08-17-2009, 09:12 AM
  2. VCN server, cast spells when in animal form
    By danielsha in forum WoW EMU Exploits & Bugs
    Replies: 3
    Last Post: 04-17-2009, 03:49 PM
  3. [Question] Make a Mob Cast a Spell When Critted?
    By kevinno in forum World of Warcraft Emulator Servers
    Replies: 17
    Last Post: 05-27-2008, 07:10 PM
  4. [question] how to make an custom npc cast spells?
    By INS4N3K1LL in forum World of Warcraft Emulator Servers
    Replies: 5
    Last Post: 05-18-2008, 07:45 AM
  5. [Question] hmm, how do i make a mob rapidly cast spells?
    By Creepfold in forum World of Warcraft Emulator Servers
    Replies: 9
    Last Post: 12-27-2007, 10:38 AM
All times are GMT -5. The time now is 03:26 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search