News:

One Minute Game Review by The Happy Friar: https://ugetube.com/@OneMinteGameReviews
Also on Rumble: https://rumble.com/c/c-1115371

idTech 4 (aka Doom 3 tech) Discord Server! https://discord.gg/9wtCGHa

Main Menu

Another Material Question

Started by spamclark15, August 14, 2017, 11:27:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

spamclark15

I've been looking through all the material files looking for where these door lights are defined. I edited some for the longer red/green lights on other types of doors, but I haven't found where these are defined. Does anyone know either how to figure out what material is being used or know the material?

MrC

There's probably a better way, but I just opened the lwo in notepad and saw models/mapobjects/doors/doorlocklightg which may be what you're looking for, a find in files in notepad++ returned with materials\senetemp.mtr hope that helps.

spamclark15

Awesome. How did you know which mesh to look at?

MrC

Quote from: spamclark15 on August 15, 2017, 07:46:33 PM
Awesome. How did you know which mesh to look at?

Just browsed for it in the editor.

spamclark15

What part of the editor should I use?

argoon

Quote from: spamclark15 on August 15, 2017, 11:03:42 PM
What part of the editor should I use?

open the game console and type:

r_showSurfaceInfo

This console command will show the material name of the surface directly under the crosshair, unfortunately it will also detect invisible materials, so you need to move around until it shows a material name that makes sense.

spamclark15


spamclark15

I'm replacing the wheels on the tablecart but trying to use deform sprite to get the 2D image of the wheels I'm not understanding. If I write it like this:

models/mapobjects/tablecart1ball
{
deform sprite
bumpmap addnormals(models/mapobjects/lab/labcart_wheel/poppawheely_local.tga, heightmap(models/mapobjects/lab/labcart_wheel/poppawheely_h.tga, 4 ) )
specularmap models/mapobjects/lab/labcart_wheel/poppawheely_s.tga
{
map models/mapobjects/lab/labcart_wheel/poppawheely_d.tga
blend diffusemap
alphatest .9
}
}


The result is wheels that show up totally black in-game. If there's some limitation to deform sprite, I rewrote it to just:

models/mapobjects/tablecart1ball
{
deform sprite
{
blend blend
map models/mapobjects/lab/labcart_wheel/poppawheely_d.tga
}
}


With this, it appears the same brightness no matter what. Does anyone know what is wrong with the first material that causes it to draw black or why the second ignores the light in the room?

argoon

#8
I don't work with materials for a very long time now, focusing on coding, so my memory is a little rusty about it but i seam to remember when i was playing with grass that deform sprite automatically uses translucency even if you don't write it explicitly, because of that it doesn't support normal maps or specular maps, there the black material error, afaik deform sprite was written by id for lights glow and the gun muzzleflash's, because of this i ended writing my own "always look to the player" script, is not very hard will see if i still have it somewhere.

ok here it is:


void player::lookAtPlayer( entity ent )
{
vector plAngles = self.getViewAngles();

plAngles_x = 0;
plAngles_y = plAngles_y + 90;
plAngles_z = 0;
ent.setAngles(plAngles);
}

   

spamclark15


argoon

#10
For this particular function you need to put it on the player script.

Like this.

on the player script inside the player object write:

void lookAtPlayer( entity ent );

then outside the player object, below the Init() function write the function i posted, btw put the code inside the lookAtPlayer function, the one inside the {},
inside the following code:

eachFrame { past the code here }

then inside the player Init() function write this:

thread lookAtPlayer($entityName);    // entityname is the name of the object you want to always look at the player;

and that's it.

There's a serious problem with this code tho, because it runs from the player script side, unfortunately makes it very complex for multiple objects, this way you need to write "thread lookAtPlayer($entityName);" for every single object you want to always look at the player! Not pretty.

But if you make it run from the object script instead (if it has one), then you just need to pass in the player ($player1) to a single look at function and multiple objects (of that type) will then look at the player just fine.

I recommend that you learn how to script is very important if you want to make more complex modifications to the game.
But for now, here is a small tutorial in how to create a new BASIC game object script, hope this make you want to learn more:

1 - inside the scripts folder create a new txt file

2 - rename it to lookAt and change the .txt extension to .script

3 - inside the script file past the following code:


#ifndef _LOOK_AT_
#define _LOOK_AT_

object lookAT {


vector plAngles;

entity player;


void init();
void lookAtPlayer();
};

void lookAT::init()
{
player = $player1;

        thread lookAtPlayer();
}


void lookAT::lookAtPlayer()
{
      eachFrame
      {
           plAngles = player.getViewAngles();

   plAngles_x = 0;
   plAngles_y = plAngles_y + 90;
   plAngles_z = 0;
   self.setAngles(plAngles);
      }
}
#endif



5 - open the doom_main.script

and past the following code after the ai_base script


#include "script/lookAt.script"


6 - open the editor, select the entity you want the script to run on

8 - write the following key value par:

key - scriptobject
value - lookAT

9 - Run the map
 

spamclark15

models/mapobjects/tablecart1ball

This is the object that I want it to apply to. When you say player script, you mean doom_main.script? There's no player.script. Is this all 1 set of instructions or 2 ways of doing it?

argoon

#12
There is a player script, look carefully, is not called player.script but has player written on its file name. ;)

Imo what i wrote is very explicit, but maybe is because i wrote it, and others maybe have problems reading it, i don't know, ok what i posted was two ways for doing this, one (bad way) from the player script side and one where you make a new script.

bitterman

#13
argoon thanks for your posts.

Сan I ask a few questions about example above?

1. What is the expression '#ifndef' (it's not about general purpose, it's about D3 scripting)?

2. If entity on the map have a scriptobject and init() as described above then it (init) will be start at start of level? IMO this is not typical behavior for level script wich must be placed in /maps, not in /script.

spamclark15

You mention the entity and the map, but it's not a single entity but rather all instances of a material I need it to work on, and that's on any map.