Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (VoroneTZ), 1,234 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
material changing #264104
05/04/09 11:08
05/04/09 11:08
Joined: Apr 2009
Posts: 141
dakilla Offline OP
Member
dakilla  Offline OP
Member

Joined: Apr 2009
Posts: 141
i am currently making a entity material/light editor but i have hit a snag. when i assign a material to the entity and assign a variable to the different things inside the material (diffuse red, ambient green .e.g.) it produces a runtime error. any help?

Last edited by dakilla; 05/04/09 11:10.

One day there will be an unfixable bug,
That day is not today.
Re: material changing [Re: dakilla] #264114
05/04/09 11:49
05/04/09 11:49
Joined: Jan 2008
Posts: 1,580
Blade280891 Offline
Serious User
Blade280891  Offline
Serious User

Joined: Jan 2008
Posts: 1,580
random guess, assign the vars then the material to the entitiy?


My Avatar Randomness V2

"Someone get me to the doctor, and someone call the nurse
And someone buy me roses, and someone burned the church"
Re: material changing [Re: Blade280891] #264146
05/04/09 16:17
05/04/09 16:17
Joined: Apr 2009
Posts: 141
dakilla Offline OP
Member
dakilla  Offline OP
Member

Joined: Apr 2009
Posts: 141
no, still not working...


One day there will be an unfixable bug,
That day is not today.
Re: material changing [Re: dakilla] #264149
05/04/09 16:27
05/04/09 16:27
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Can you post your material script?

Re: material changing [Re: Widi] #264162
05/04/09 17:39
05/04/09 17:39
Joined: Apr 2009
Posts: 141
dakilla Offline OP
Member
dakilla  Offline OP
Member

Joined: Apr 2009
Posts: 141
kk


One day there will be an unfixable bug,
That day is not today.
Re: material changing [Re: dakilla] #264163
05/04/09 17:50
05/04/09 17:50
Joined: Apr 2009
Posts: 141
dakilla Offline OP
Member
dakilla  Offline OP
Member

Joined: Apr 2009
Posts: 141
///////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////////////////////////////////////
var amb = 0;
var lgt = 0;
var alph = 100;
var ambl = 0;

ENTITY* guard;
BMAP* bg = "but.bmp";

VIEW* camera1 =
{
layer=15;
arc=100;
flags=SHOW;
}

MATERIAL* mtl_smaragd =
{
ambient_blue = ambl;
ambient_green = 255;
ambient_red = 100;
diffuse_blue = 0;
diffuse_green = 100;
diffuse_red = 0;
specular_blue = 255;
specular_green = 255;
specular_red = 255;
power = 10;
}

TEXT* Explain = {
pos_x = 620; pos_y = 80;
layer=16;
font = "Croobie#20bi";
flags = SHADOW | SHOW;
string("Ambience");
}


TEXT* Explain2 = {
pos_x = 620; pos_y = 120;
layer=16;
font = "Croobie#20bi";
flags = SHADOW | SHOW;
string("Light");
}


TEXT* Explain3 = {
pos_x = 620; pos_y = 160;
layer=16;
font = "Croobie#20bi";
flags = SHADOW | SHOW;
string("Ghost");
}

PANEL* bgpan =
{
pos_x = 000;
pos_y = 000;
layer = 1;
bmap = bg;
flags = OVERLAY | SHOW;
}
PANEL* ambpan =
{
bmap = "slider2.bmp";
layer = 2;
pos_x = 500;
pos_y = 80;
hslider (0, 0, 200, "slider3.bmp", 0, 200, amb);
flags = OVERLAY | SHOW;

}

PANEL* amblpan =
{
bmap = "slider2.bmp";
layer = 2;
pos_x = 500;
pos_y = 200;
hslider (0, 0, 200, "slider3.bmp", 0, 200, ambl);
flags = OVERLAY | SHOW;

}

PANEL* alphpan =
{
bmap = "slider2.bmp";
layer = 2;
pos_x = 500;
pos_y = 160;
hslider (0, 0, 200, "slider3.bmp", 0, 200, alph);
flags = OVERLAY | SHOW;
}

PANEL* lgtpan =
{
bmap = "slider2.bmp";
layer = 2;
pos_x = 500;
pos_y = 120;
hslider (0, 0, 200, "slider3.bmp", 0, 1000, lgt);
flags = OVERLAY | SHOW;

}

function center_camera1()
{
camera1.pos_x=0;
camera1.pos_y=0;
camera1.size_x=screen_size.x;
camera1.size_y=screen_size.y;

while (1)
{
camera1.x = guard.x + 80;
camera1.y = guard.y + 50;
camera1.z = guard.z + 40;
camera1.tilt = -10;
camera1.pan = 180;
wait (1);
}
}
var run_percentage;
action stand()
{
guard = me;
while (1)
{
ent_animate(my,"idle",run_percentage, ANM_CYCLE);
run_percentage += 1 * time_step;
wait(1);

}
}

function main()
{
level_load("small.hmp");
ENTITY* sky = ent_createlayer("skycube+6.dds", SKY | CUBE | SHOW, 0);
mouse_map = NULL;
mouse_mode = 4;
video_mode = 8;
sky_color.blue = 0;
guard = ent_create ("armor knight.mdl", vector(0, 90, 35), stand);
set (guard, TRANSLUCENT);
center_camera1();
guard.material = mtl_smaragd;
while(1)
{
guard.ambient = amb;
guard.lightrange = lgt;
guard.alpha = alph;
wait (1);
}
}

here is the whole thing. the problem is changing the ambient blue to the variable 'ambl'.


One day there will be an unfixable bug,
That day is not today.
Re: material changing [Re: dakilla] #264311
05/05/09 14:56
05/05/09 14:56
Joined: Feb 2006
Posts: 385
Oldenburg,Germany
Ralph Offline
Senior Member
Ralph  Offline
Senior Member

Joined: Feb 2006
Posts: 385
Oldenburg,Germany
Set the ambient_blue to 0 in the material.
Then use this:"mtl_smaragd.ambient_blue = ambl;" in a function(like the main) and it works!

Re: material changing [Re: Ralph] #264343
05/05/09 18:10
05/05/09 18:10
Joined: Apr 2009
Posts: 141
dakilla Offline OP
Member
dakilla  Offline OP
Member

Joined: Apr 2009
Posts: 141
Ya, thanks!


One day there will be an unfixable bug,
That day is not today.

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1