Jump to content

Need help with a Game Script


Recommended Posts

I'm having some trouble figuring this one out. Basically I want this script to cast one spell, or hit one button, while another is on cooldown. I know how to do the script itself, it's only this one part of waiting for something, while doing something else.

I don't want to have to use a hardcoded "sequence".

So far, my general code relating to this is as follows

Func SpellOne()
(Casts Spell 1)

Func SpellTwo()
(Casts Spell 2)
$Sleeping = True
(Sleeps for Cooldown)
$Sleeping = False

Func Loop()
If $Sleeping = False Then
SpellTwo()
Else
SpellOne()

I know the problem with this is that it runs the SpellTwo Function until the cooldown is over, rather then heading back to the Loop and hitting SpellOne until the SpellTwo cooldown ends. I can't figure out how else to do this. I'd love it if someone could help!

Edited by tsincaat
Link to comment
Share on other sites

here is a crude example.

Global $spellone,$spelltwo

$spellone=0
$spelltwo=0
AdlibEnable("timer",500)


while 1
if $spellone=12000 then ; when $spellone has reached 12 secs, CAST &reset timer
    ConsoleWrite("casting 1"&@Lf)
    $spellone=0;reset casting timer
ElseIf $spelltwo =15000 Then ; when $spelltwo has reached 15 secs, CAST &reset timer
    ConsoleWrite("casting 2"&@Lf)
    $spelltwo=0;reset casting timer
EndIf
WEnd

func timer()
    $spellone+=500
    $spelltwo+=500
EndFunc
Link to comment
Share on other sites

here is a crude example.

Global $spellone,$spelltwo

$spellone=0
$spelltwo=0
AdlibEnable("timer",500)


while 1
if $spellone=12000 then ; when $spellone has reached 12 secs, CAST &reset timer
    ConsoleWrite("casting 1"&@Lf)
    $spellone=0;reset casting timer
ElseIf $spelltwo =15000 Then ; when $spelltwo has reached 15 secs, CAST &reset timer
    ConsoleWrite("casting 2"&@Lf)
    $spelltwo=0;reset casting timer
EndIf
WEnd

func timer()
    $spellone+=500
    $spelltwo+=500
EndFunc
PERFECT Aceguy! Thank you SO much for your help :P
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...