Thread Tools Display Modes
11-07-16, 08:30 PM   #1
Sweetsour
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Dec 2014
Posts: 130
Help with models

Hey everyone!

I seem to having some strange issues with some models in my addon. The following picture shows the models being used. I should add that I don't have too much knowledge with models, seeing as there's little documentation online; at least that I've found.



The top three circular models appear when I use the Stormkeeper ability (Shaman spell with 3 charges). Also, when Maelstrom (Shaman resource type) reaches a certain threshold, the bar gets a lightning model applied it. Sometimes during combat, the models stop appearing until I reload the UI.

This is my code for the frames.

Maelstrom Bar
Lua Code:
  1. SSA.MaelstromBarEnh = CreateFrame("StatusBar","MaelstromBarEnh",AuraGroup);
  2. local MaelstromBar = SSA.MaelstromBarEnh;
  3.  
  4. MaelstromBar:SetStatusBarTexture("Interface\\addons\\ShamanAuras\\media\\statusbar\\fifths");
  5. MaelstromBar:GetStatusBarTexture():SetHorizTile(false);
  6. MaelstromBar:GetStatusBarTexture():SetVertTile(false);
  7. MaelstromBar:SetPoint("CENTER",AuraGroup,"CENTER",0,-139);
  8. MaelstromBar:SetWidth(260);
  9. MaelstromBar:SetHeight(21);
  10. MaelstromBar:SetFrameStrata("LOW");
  11. MaelstromBar:SetStatusBarColor(0,0.5,1);
  12. MaelstromBar:SetAlpha(0);
  13.  
  14. MaelstromBar.bg = MaelstromBar:CreateTexture(nil,"BACKGROUND");
  15. MaelstromBar.bg:SetTexture("Interface\\TargetingFrame\\UI-StatusBar");
  16. MaelstromBar.bg:SetAllPoints(true);
  17. MaelstromBar.bg:SetVertexColor(0,0,0);
  18. MaelstromBar.bg:SetAlpha(0.5);
  19.  
  20. MaelstromBar.text = MaelstromBar:CreateFontString(nil, "HIGH", "GameFontHighlightLarge");
  21. MaelstromBar.text:SetPoint("CENTER",MaelstromBar,"CENTER",0,0);
  22. MaelstromBar.text:SetFont("Fonts\\FRIZQT__.TTF", 12);
  23. MaelstromBar.text:SetTextColor(1,1,1,1);
  24.  
  25. MaelstromBar.Lightning = CreateFrame("PlayerModel","MaelstromBarEnhLightning",MaelstromBar);
  26. MaelstromBar.Lightning:SetModel("SPELLS/LIGHTNING_AREA_DISC_STATE.m2");
  27. MaelstromBar.Lightning:SetFrameStrata("MEDIUM");
  28. MaelstromBar.Lightning:SetPosition(0,0,-2);
  29. MaelstromBar.Lightning:SetAllPoints(MaelstromBar);
  30. MaelstromBar.Lightning:SetAlpha(0);


Stormkeeper Lightning Charges
Lua Code:
  1. local StormkeeperCharges = CreateFrame("Frame","StormkeeperChargeGrp",AuraGroup);
  2. StormkeeperCharges:SetFrameStrata(bg);
  3. StormkeeperCharges:SetWidth(260);
  4. StormkeeperCharges:SetHeight(50);
  5. StormkeeperCharges:SetPoint("CENTER",AuraGroup,"CENTER",0,-110);
  6. StormkeeperCharges:Show();
  7.  
  8. for i=1,3 do
  9.     StormkeeperCharges["Charge"..i] = CreateFrame("Frame","StormkeeperCharge"..i,StormkeeperCharges);
  10.     StormkeeperCharges["Charge"..i]:SetWidth(100);
  11.     StormkeeperCharges["Charge"..i]:SetHeight(100);
  12.     StormkeeperCharges["Charge"..i]:SetPoint("CENTER",StormkeeperCharges,"LEFT",30,-3);
  13.     StormkeeperCharges["Charge"..i]:SetAlpha(0);
  14.     StormkeeperCharges["Charge"..i]:Show();
  15.  
  16.     StormkeeperCharges["Charge"..i].Lightning = CreateFrame("PlayerModel","StormkeeperCharge"..i.."_Lightning",StormkeeperCharges["Charge"..i]);
  17.     StormkeeperCharges["Charge"..i].Lightning:SetModel("spells/Monk_chiblast_precast.m2");
  18.     StormkeeperCharges["Charge"..i].Lightning:SetPosition(0,0,0);
  19.     StormkeeperCharges["Charge"..i].Lightning:SetAllPoints(StormkeeperCharges["Charge"..i]);
  20.     StormkeeperCharges["Charge"..i].Lightning:SetAlpha(1);
  21.     StormkeeperCharges["Charge"..i].Lightning:SetSequence(37);
  22. end

Last edited by Sweetsour : 11-07-16 at 08:38 PM.
  Reply With Quote
11-13-16, 05:20 PM   #2
Sweetsour
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Dec 2014
Posts: 130
So I discovered that hiding then showing my UI (by pressing Alt+Z), will cause my World Scale values to nil. Then when I try to reload UI, the game crashes. Anyone have any idea why this could be happening?
  Reply With Quote
11-13-16, 07:31 PM   #3
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Spell icons gets perma hidden with alt+z sadly, this bug is in the game since ages the weird part any other model works just fine. I reported the issue years ago, yet we still waiting on a fix.
  Reply With Quote
11-13-16, 08:49 PM   #4
Sweetsour
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Dec 2014
Posts: 130
Wow, well that's next level unfortunate, lol. Thanks for the info!
  Reply With Quote
11-14-16, 12:09 PM   #5
d87
A Chromatic Dragonspawn
 
d87's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 163
Code:
local Redraw = function(self)
    if not self.model_path then return end

    if type(self.model_path) == "number" then
        self:SetDisplayInfo(self.model_path)
    else
        self:SetModel(self.model_path)
    end
    self:SetModelScale(self.model_scale)
    self:SetPosition(self.ox, self.oy, self.oz)
end

local ResetTransformations = function(self)
    self:SetModelScale(1)
    self:SetPosition(0,0,0)
end

f.playermodel:SetScript("OnHide", ResetTransformations)
f.playermodel:SetScript("OnShow", Redraw)
f.playermodel.Redraw = Redraw
f.playermodel.ResetTransformations = ResetTransformations
Here's a workaround for this bug
  Reply With Quote
11-14-16, 02:49 PM   #6
Sweetsour
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Dec 2014
Posts: 130
Thanks! I'm going to try and implement this as soon as I can. This will help immensely if I can get it to work!
  Reply With Quote
11-14-16, 04:21 PM   #7
Sweetsour
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Dec 2014
Posts: 130
It worked! Thanks again!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Help with models

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off