Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: Changing Textures (SOLVED)  (Read 3189 times)

0 Members and 1 Guest are viewing this topic.

mylesblasonato

  • Developer
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 265
  • "Give up is to fail as sacrifice is to succeed"
    • View Profile
    • Royal Wins
Changing Textures (SOLVED)
« on: August 11, 2009, 05:11:43 AM »

Hi guys,
Ok so in our game we have low res and hi res textures. You switch between them in the options. I got the options working and i put this code onto my actor file:
Code: [Select]
#include "scripts\base.inc"
var lowSetting;
var hiSetting;

while ( true )
{
lowSetting = Game.RegReadNumber(profile+"low",0);
hiSetting = Game.RegReadNumber(profile+"hi",1);

if (lowSetting == 1)
{
this.SetTexture("lowResViolet","actors\Violet\Violet_texture2.png");
}
if (hiSetting == 1)
{
this.SetTexture("hiResViolet","actors\Violet\Violet_texture.png");
}

Sleep(100);
}

I stepped through it and found that it was going through perfect but when it got to the setting of the texture, the model in-game didn't change it's texture. Has it got something to do with refreshing?

Cheers  ::beer
Myles Blasonato.
« Last Edit: August 12, 2009, 02:29:13 AM by mylesb »
Logged
Lead Game Designer, Royal Wins.
@mylesblasonato
@royalwins
http://au.linkedin.com/pub/myles-blasonato/26/600/a38

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Changing Textures
« Reply #1 on: August 11, 2009, 07:09:12 AM »

What is "lowResViolet" and "hiResViolet"? It's supposed to be the mesh for which you're changing the texture. Shouldn't it be the same in both cases?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

mylesblasonato

  • Developer
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 265
  • "Give up is to fail as sacrifice is to succeed"
    • View Profile
    • Royal Wins
Re: Changing Textures
« Reply #2 on: August 11, 2009, 09:14:45 AM »

Oh really?
In the docs it says the name of the material. Would i put "my_model.x" then?

Cheers  ::beer
Myles Blasonato.

EDIT: I put the following in and it didn't work:
Code: [Select]
this.SetTexture("actors\violet\violet.x","actors\Violet\Violet_texture2.png");
« Last Edit: August 11, 2009, 09:16:50 AM by mylesb »
Logged
Lead Game Designer, Royal Wins.
@mylesblasonato
@royalwins
http://au.linkedin.com/pub/myles-blasonato/26/600/a38

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Changing Textures
« Reply #3 on: August 11, 2009, 09:51:22 AM »

Well I meant a submesh. Which is indeed defined by material name. I suppose your model doesn't have two materials, called  "lowResViolet" and "hiResViolet". That wouldn't make much sense.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Azrael

  • Regular poster
  • ***
  • Karma: 9
  • Offline Offline
  • Gender: Male
  • Posts: 155
    • View Profile
    • Mad Orange
Re: Changing Textures
« Reply #4 on: August 11, 2009, 01:45:57 PM »

If your .X model load by default a texture called "violet.PNG" you should put in the scripts:

Code: WME Script
  1. this.SetTexture("violet","actors\Violet\Violet_texture2.png");

The "violet.PNG" without the .PNG ;)
Logged

mylesblasonato

  • Developer
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 265
  • "Give up is to fail as sacrifice is to succeed"
    • View Profile
    • Royal Wins
Re: Changing Textures
« Reply #5 on: August 11, 2009, 11:44:16 PM »

Hey Azrael,
Thanks heaps man :)
It worked!

Cheers  ::beer
Myles Blasonato.
Logged
Lead Game Designer, Royal Wins.
@mylesblasonato
@royalwins
http://au.linkedin.com/pub/myles-blasonato/26/600/a38
 

Page created in 0.042 seconds with 25 queries.