WoW:API CastShapeshiftForm: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
m (Move page script moved page API CastShapeshiftForm to API CastShapeshiftForm without leaving a redirect)
 
(5 intermediate revisions by 5 users not shown)
Line 1: Line 1:
__NOTOC__
{{wowapi}}__NOTOC__
<center>'''Submitted by [[/User:Naliya|Naliya]]'''</center>
{{protectedapi|2.0.1|For alternatives, try [[API_SecureTemplates|Secure Template]] or the new [[Conditional slash commands#/cast|/cast]].}}
 
Casts Shapeshift on yourself. This is class dependent - not all classes have special abilities.
Casts Shapeshift on yourself. This is class dependant - not all classes have special abilites.


   CastShapeshiftForm(index);
   CastShapeshiftForm(index);
Line 55: Line 54:


== Example ==
== Example ==
This Example shows how to return to your human form our of any other form.
This Example shows how to return to your human form out of any other form.
 
  for i=1, GetNumShapeshiftForms() do
 
    _, name, active = GetShapeshiftFormInfo(i);
for i=1, GetNumShapeshiftForms() do
    if( active ~= nil ) then
  _, name, active = GetShapeshiftFormInfo(i);
        DEFAULT_CHAT_FRAME:AddMessage("SQS: leaving '"..name.."'");
  if( active ~= nil ) then
        CastShapeshiftForm(i)
      DEFAULT_CHAT_FRAME:AddMessage("SQS: leaving '"..name.."'");
        break;
      CastShapeshiftForm(i)
    end
      break;
  end
  end
end
 
 
 
----
{{WoW API}}

Latest revision as of 04:45, 15 August 2023

WoW API < CastShapeshiftForm

Casts Shapeshift on yourself. This is class dependent - not all classes have special abilities.

 CastShapeshiftForm(index);

Parameters[edit]

Arguments[edit]

index
relates to the different forms:
Druid
  • 1 = Bear/Dire Bear Form
  • 2 = Aquatic Form
  • 3 = Cat Form
  • 4 = Travel Form
  • 5 = Moonkin Form
Rogue
  • 1 = Stealth
Warrior
  • 1 = Battle Stance
  • 2 = Defensive Stance
  • 3 = Beserker Stance


Returns[edit]

nil


Example[edit]

 CastShapeshiftForm(1);

Result[edit]

Shapeshifts caster into Bear Form.


Note[edit]

Note, casting the spell again changes back to caster form. So, for instance;

 if (GetNumShapeshiftForms()==1) then CastShapeshiftForm(1);end;

In this case, the script checks if you're in Bear/Dire Bear form, and if so, casts the spell to change you back to Caster form. It has the same restrictions as other casting spells in that the trigger event needs to involve a keystroke or mouse click.


To use a particular shape in a macro and avoiding error messages, use:

 /script icon, name, active = GetShapeshiftFormInfo(index);if (active==1) then CastShapeshiftForm(index);end;

where index is the number of the shape as given above.


Example[edit]

This Example shows how to return to your human form out of any other form.

 for i=1, GetNumShapeshiftForms() do
    _, name, active = GetShapeshiftFormInfo(i);
    if( active ~= nil ) then
       DEFAULT_CHAT_FRAME:AddMessage("SQS: leaving '"..name.."'");
       CastShapeshiftForm(i)
       break;
    end
 end