Aller au contenu

Photo

No-magic fight - detect when magic is cast?


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
wyvern14

wyvern14
  • Members
  • 107 messages
I want a pure physical fight for a contest, and while characters might be able to use magical abilities, I want to "catch" them doing it and cancel it, or void their magic. It could be done in different ways but I'm not sure where to even begin to script this, or what event to "intercept" and where.

I was thinking of autocast failure with floaty text about no right to use magic while certain plots are set true and removed afterward once another plot goes through (or once team is destroyed).

Anyone has any idea?

#2
Mengtzu

Mengtzu
  • Members
  • 258 messages
There should be an event way to do it (there's an EVENT_TYPE_ABILITY_CAST_START for example, you could probably test for given abilities and invalidate them). That might work if you had a specific arena and captured the event in the area's script? Not sure.



It depends on what you define as magical though. I don't think rogues and warriors have any technically magical abilities, and mages can't do much without them. You could easily enough test for mages and not allow them to enter, or auto-fail them.

#3
anakin5

anakin5
  • Members
  • 258 messages
With the Ability ID beeing cast, you have got the function

Ability_GetAbilityType(nAbilityID) which return

ABILITY_TYPE_SPELL
ABILITY_TYPE_TALENT
ABILITY_TYPE_ITEM

Spell are for mages while talent are for rogue and warrior.

Modifié par anakin5, 31 décembre 2009 - 12:27 .


#4
wyvern14

wyvern14
  • Members
  • 107 messages
Not sure if it could work in my area core like this, I'm getting compile errors and the event isn't documented anywhere ><





case EVENT_TYPE_SPELLSCRIPT_CAST:

{

object oCaster = GetEventObject(ev,0);

object oTarget = GetEventObject(ev,1);

int nAbility = GetEventInteger(ev,0);

int nAbilityType = GetEventInteger(ev,1);



string sMessage = "This is a physical contest, no magic allowed!"



if (WR_GetPlotFlag(PLT_WH_FEST_BRAWL, ROUND_1_ENGAGED) && GetAbilityType(nAbilityType) == ABILITY_TYPE_SPELL)

{

Rules_InterrupSpell(oCaster);

DisplayFloatyMessage(oCaster, sMessage);

}

break;

}

#5
wyvern14

wyvern14
  • Members
  • 107 messages
I have this in my area script but it ain't doing anything, not sure why. Should it even be in the area script?


        case EVENT_TYPE_SPELLSCRIPT_CAST:
        {
            object oCaster      = GetEventObject(ev,0);
            object oTarget      = GetEventObject(ev,1);
            int nAbility        = GetEventInteger(ev,0);
            int nAbilityType    = GetEventInteger(ev,1);
            string sMessage     = "This is a physical contest, no magic allowed!";
            if(WR_GetPlotFlag(PLT_WH_FEST_BRAWL,ROUND_1_ENGAGED) &&
              !WR_GetPlotFlag(PLT_WH_FEST_BRAWL,ROUND_1_WON) &&
              GetAbilityType(2))
              {
                Rules_InterrupSpell(oCaster);
                DisplayFloatyMessage(oCaster, sMessage);
              }
            if(WR_GetPlotFlag(PLT_WH_FEST_BRAWL,MOSSFELD_FIGHT) &&
              !WR_GetPlotFlag(PLT_WH_FEST_BRAWL,BEAT_THE_MOSSFELDS) &&
              GetAbilityType(2))
              {
                Rules_InterrupSpell(oCaster);
                DisplayFloatyMessage(oCaster, sMessage);
              }
              break;
        }