Mirage Source
Spell Number - Printable Version

+- Mirage Source (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17)
+---- Thread: Spell Number (/showthread.php?tid=740)



Spell Number - Ramsey - 14-02-2007

how do i get the spell number of a spell?


- Obsidian - 14-02-2007

Need to be more descriptive. Are you trying to find a number of a spell based on its name? Or what?

If you already know the number you can just do... Spell(#)


- Ramsey - 15-02-2007

i need a line of code to do

Code:
If number_of_spell_casted = 1 then



- William - 15-02-2007

Not sure what you mean, but might be this?

Code:
Player(MyIndex).Spell(i)



- Obsidian - 15-02-2007

You'll have to do several checks leading up to it. For instance

Code:
for i = 1 to max_player_spells
        If Player(Index).Spell(i) = *INSERT SPELL NUM HERE* Then
            If Player(Index).CastedSpell = True Then  ' Not sure if CastedSpell is an assigned variable in the player UDT or not
                *DO WHATEVER*
            End If
        End If
    next i

Something similar to that. But you're going to need to do a few other things as well. It's actually probably best, to check if the casted the spell, BEFORE running the For Loop and what-not. It might be a good idea, and shortcut the entire process... is just add a new Byte to the PlayerSpellRec, like, CurrentlyCast and then just Update/Remove that... then the code that i wrote would be much more simplified down to... making sure that they've casted a spell, and then making sure that the Cast Spell is the Spell Number that you're looking for. Make sense?


- Obsidian - 15-02-2007

Yeah i actually didn't even think about that. The spell number that they used... is more than likely sent through the "cast" packet... just leech off of that.