What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

A Public void to cast 2 spells ??

hi1674

New Member
Joined
Jan 15, 2010
Messages
1,637
Reaction score
5
How could i make something like this to cast 2 spells ?

Code:
   public void fingers(string bla bla)
        {
            SpellManager.Cast("frostbolt");
            Thread.Sleep("1250")   //Sleep to cast Ice Lance at correct window       
            SpellManager.Cast("Ice Lance");
        }

this has all kinds of errors but trying to explain here ;)
 
i'm sure it is....but i know nothing about it ;(

how would it look in BT ?

Code:
new Decorator(ret => SpellManager.CanCast("Frostbolt") && Spellmanager.CanCast("Ice Lance"),
                    new PrioritySelector(
                        CreateSpellCheckAndCast("Frostbolt")
                        CreateSpellCheckAndCast("Ice Lance")
                        )),
 
);
 
Last edited:
How could i make something like this to cast 2 spells ?

Code:
   public void fingers(string bla bla)
        {
            SpellManager.Cast("frostbolt");
            Thread.Sleep("1250")   //Sleep to cast Ice Lance at correct window       
            SpellManager.Cast("Ice Lance");
        }

this has all kinds of errors but trying to explain here ;)

You could with that code, if you just fixed it with common c# knowledge. there is 2 things wrong:
1. a void function can't take a parameter.
2. you can't pass a string to an int parameter (it's thread.sleep(int time))
 
in BT will look like
public Composite fingers(){
return (
new priorityselector(
new decorator(ret=>WHATEWERYOUNEEDTOCHECK,
new action(delegate{
spellmanager.cast("Frostbolt");
return runstatus.failure;
}),
new Wait(2,ret=>!Me.iscasting && !spellmanager.globalcooldown,
new decorator(ret=>WHATEWERYOUNEEDTOCHECK,
new action((delegate{
spellmanager.cast("Ice Lance");
return runstatus.succes;
})
))
);
 
Code:
public void mySpellSequence() {
    // avoid eternal loops as you can't cast one of the two spells
    if(!SpellManager.CanCast("Spell1") || !SpellManager.CanCast("Spell2")) return;

    while(!SpellManager.CanCast("Spell1"));
    SpellManager.Cast("Spell1");
    while(!SpellManager.CanCast("Spell2"));
    SpellManager.Cast("Spell2");

    return;
}

is this just wrong?
 
hi1674, my function works, it just hangs the combat thread waiting for the GCD (?!?). In few words:

1. check if you can cast both the spells
2. wait untill you can cast the 1st
3. cast the 1st
4. wait untill you can cast the 2nd
5. cast the 2nd
 
that's a complete different story :P
AFAIK or you build a CC all around composite or you do not.
you cannot call a composite from a standard CC
in a normal cc your code would work like
public bool fingers()
{
if(WHATEVERYOUNEEDTOCHECK)
{
spellmanager.cast("Frostbolt");
while(me.iscasting || spellmanager.gloobalcooldown)
{
thread.sleep(250);
objectmanage.update();
}
if(WHATEVERYOUNEEDTOCHECK)
{
spellmanager.cast("Ice Lance");
return true;
}
}
return false;
}
Now, calling objectmanager.update is EVIL and should never be done if is possible not to do it..
EDIT: jim87 the problem with your function is that if he is not able to cast the first spell (for example he is moving) then the CC hangup forever until a frostbolt is possible. if he get counterspelled or stunned the CC just hungup.
 
Last edited:
1. a void function can't take a parameter.

come again?...what language is THAT?
void is the return, not the input.... it means you can't do something like :

string strReturn = VoidReturnFunction(inputParameter);

public void VoidReturnFunction(string inputParameter)
{
//do some really cool stuff here but return NOTHING
}

not that you can't pass a parameter into it.
 
Last edited:
felmaster is a behaviourtree custom class.. that shuold make thing easiers should not?
that's means you can just call composite code from the main priority selector with no problem at all
 
Last edited:
bad bad people, NEVER use Sleeps when programming, your locking up the thread.

frostbolt should your main spell, you shouldn't have to include it after the icelance, since it will just default back to that afterword.
 
Last edited:
Back
Top