Jump to content


Photo

Lua help for multiple ranged weapons


  • Please log in to reply
8 replies to this topic

#1 Gukai

Gukai

    Advanced Member

  • Members
  • PipPipPip
  • 94 posts

Posted 12 July 2017 - 06:31 PM

Hello

So given the store tp returns on weapons based on delays and such, a single set wont work when dealing with ranged weapons.  The Aeonics have delays of 600, while relics have different delays (I think bow is 524), the arrows and bullets have different delays, and etc.

 

So I need to make a ranged set for TPing in specific to the ranged weapon I'm using.  In my head, I think this should be easy, but when I try to write the rules for it I come to a road block.

 

https://pastebin.com/TVgBBmcK

 

The one set I have created so far is on line 101.  I still need to create other sets but thats no biggie.  They will eventually be called something like

sets.midcast.Ranged.TPnormal.Yoichi

sets.midcast.Ranged.TPnormal.Fail

sets.midcast.Ranged.TPnormal.Fomal

... and then an acc version, so TPAcc.Yoichi etc etc

 

The rules are killing me, I think that it's around line 337 (might need to reference line 141)

 

Thank anyone in advance for your help.  I couldnt find any examples to try to cheat from, as most people use mote-stuff and I dont use/like them

 

 



#2 Kenshi

Kenshi

    Advanced Member

  • Members
  • PipPipPip
  • 332 posts

Posted 12 July 2017 - 11:40 PM

what you can do is to change the way you toggle the tp sets to this

on the get_sets function:

TP_Index = 1

TP_Array = {'TPnormal', 'TPacc'}

create 4 sets:

sets.midcast.Ranged.TPnormal.default (this one is in the case you are using a bow or gun that you don't have a specified set)

sets.midcast.Ranged.TPnormal.Yoichinoyumi (notice the names have to be the exact name)

sets.midcast.Ranged.TPnormal.Fail

sets.midcast.Ranged.TPnormal.Fomal

 

then in the addon command function

if command == 'toggle TP set' then
        TP_Index = (TP_Index % #TP_Array) + 1
        sets.aftercast.TP = sets.engaged[TP_Array[TP_Index]]
        if sets.midcast.Ranged[TP_Array[TP_Index]][player.equipment.range] then
                sets.aftercast.Ranged = sets.midcast.Ranged[TP_Array[TP_Index]][player.equipment.range]
        else
                sets.aftercast.Ranged = sets.midcast.Ranged[TP_Array[TP_Index]].default
        end
        send_command('@input /echo '..[TP_Array[TP_Index]]..' SET')
end

then in the midcast function

--this has to be at the top of the midcast function, thats to make sure the correct aftercast
ranged is set if you have changed weapon
if sets.midcast.Ranged[TP_Array[TP_Index]][player.equipment.range] then
        sets.aftercast.Ranged = sets.midcast.Ranged[TP_Array[TP_Index]][player.equipment.range]
else
        sets.aftercast.Ranged = sets.midcast.Ranged[TP_Array[TP_Index]].default
end
if spell.name == "Ranged" then
        equip(sets.aftercast.Ranged)
end


#3 Gukai

Gukai

    Advanced Member

  • Members
  • PipPipPip
  • 94 posts

Posted 13 July 2017 - 08:30 AM

Hi again, and thank you for looking at this.

 

Small updates:

  • I implemented the changes you suggested.  
  • I also created the TP sets specific to the Fail-Not bow and Yoichinoyumi that I hadnt done in the original lua above.  
  • The Fomalhaut gun I am making as the 'default' set - it gives me a 4-hit build as-is while the 2 bows I potentially use need more Store TP, so it's a good base to build from and when making the other 2 sets I just added more and more TP gear.

Just an FYI, the tp set for the Fail set i called sets.midcast.Ranged.TPnormal["Fail-Not"] = blah blah

... I believe this is how we deal with a name that has a dash in it (trying to jump-start my memory from much earlier coding).  I was getting an error trying to do '...TPnormal.Fail-Not = blahblah' and the error was pointing to the dash, so hopefully I am correct in changing it to ["Fail-Not"]

 

 

Anyways I got an error in the command area, in the echo row... saying unexpected symbol near '['

I put some dashes in front of it, just because it wasnt vital to get a working lua

 

Next, I got an error message on my default set, row 117, saying attempt to index field 'TPnormal' (a nil value)

I didnt know how I should correct this

 

Here is the current version

https://pastebin.com/T7j1WvbU

 

Thank you again, hope to hear from you soon!



#4 Kenshi

Kenshi

    Advanced Member

  • Members
  • PipPipPip
  • 332 posts

Posted 13 July 2017 - 12:19 PM

you gotta add the TPnormal table sets.midcast.Ranged.TPnormal = {}



#5 Gukai

Gukai

    Advanced Member

  • Members
  • PipPipPip
  • 94 posts

Posted 13 July 2017 - 03:42 PM

Good morning

So back to the first problem with the echo...

I changed 

end_command('@input /echo '..[TP_Array[TP_Index]]..' SET')

to

send_command('@input /echo '[TP_Array[TP_Index]]' SET') 

This didnt give me an error message when I tried to load the lua but when I tried switching modes from TPnormal to TPacc I got a message pointing to this line saying

"TPacc" is not defined for strings

and pressing it again

"TPnormal is not defined for stings

 

 

Next, the ranged sets are not changing at all.  It goes straight from precast to aftercast

 

https://pastebin.com/eMjFEZyQ



#6 Kenshi

Kenshi

    Advanced Member

  • Members
  • PipPipPip
  • 332 posts

Posted 13 July 2017 - 08:00 PM

My bad its

send_command('@input /echo '..TP_Array[TP_Index]..' SET') 

for the midcast can you try changing spell.name == "Ranged" to spell.action_type == 'Ranged Attack' ?

 

Also on line 153 change sets.aftercast.Ranged = sets.midcast.Ranged.TPnormal to sets.aftercast.Ranged = sets.midcast.Ranged[TP_Array[TP_Index]].default



#7 Gukai

Gukai

    Advanced Member

  • Members
  • PipPipPip
  • 94 posts

Posted 13 July 2017 - 08:19 PM

Awesome, the echo worked and midcast worked and properly updated itself whenever I changed weapons.

 

The TPacc wasnt working though.  When I changed modes to the TPacc, a midcast set never equipped.



#8 Kenshi

Kenshi

    Advanced Member

  • Members
  • PipPipPip
  • 332 posts

Posted 13 July 2017 - 08:28 PM

Yes, for acc I though you were goin to add a set for each weapon, if you are not goin to do it just change the name to sets.midcast.Ranged.TPacc.default and remember to create the table sets.midcast.Ranged.TPacc = {}

 

Also you are using sets.midcast.Ranged.TPnormal.Fomalhaut, which doesn't exist, to combine the specified weapons sets so they should be only equipping the rings, change it to the correct one.



#9 Gukai

Gukai

    Advanced Member

  • Members
  • PipPipPip
  • 94 posts

Posted 13 July 2017 - 08:45 PM

Oh sweet, the acc set works!!  I also caught the fomalhaut issue in using it as the default set and already corrected it.

 

Everything works awesome!!!!  

 

Thank you so so much for all your help these last 2 days!!!  I'm stoked!!!!!!!  I cant wait to show off my rng at events, I was already doing great damage and thats with it not working correctly, I am excited to see what happens now.

 

Thank you thank you!!!  This is also going to help me when I revise my other luas.  I cant wait to update and improve their luas!






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users