Author Topic: Another Material Question  (Read 2156 times)

0 Members and 1 Guest are viewing this topic.

spamclark15

  • id Enthusiast
  • Jr. Member
  • **
  • Posts: 97
  • Karma: +10/-3
  • A missile-launching skyscraper with goat legs.
    • View Profile
Another Material Question
« on: August 14, 2017, 11:27:15 PM »
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

  • Jr. Member
  • **
  • Posts: 65
  • Karma: +8/-25
  • Doom Newbie
    • View Profile
Re: Another Material Question
« Reply #1 on: August 15, 2017, 05:53:10 PM »
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

  • id Enthusiast
  • Jr. Member
  • **
  • Posts: 97
  • Karma: +10/-3
  • A missile-launching skyscraper with goat legs.
    • View Profile
Re: Another Material Question
« Reply #2 on: August 15, 2017, 07:46:33 PM »
Awesome. How did you know which mesh to look at?

MrC

  • Jr. Member
  • **
  • Posts: 65
  • Karma: +8/-25
  • Doom Newbie
    • View Profile
Re: Another Material Question
« Reply #3 on: August 15, 2017, 07:58:14 PM »
Awesome. How did you know which mesh to look at?

Just browsed for it in the editor.

spamclark15

  • id Enthusiast
  • Jr. Member
  • **
  • Posts: 97
  • Karma: +10/-3
  • A missile-launching skyscraper with goat legs.
    • View Profile
Re: Another Material Question
« Reply #4 on: August 15, 2017, 11:03:42 PM »
What part of the editor should I use?

argoon

  • Sr. Member
  • ****
  • Posts: 275
  • Karma: +21/-81
  • Doom Newbie
    • View Profile
Re: Another Material Question
« Reply #5 on: August 15, 2017, 11:24:18 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

  • id Enthusiast
  • Jr. Member
  • **
  • Posts: 97
  • Karma: +10/-3
  • A missile-launching skyscraper with goat legs.
    • View Profile
Re: Another Material Question
« Reply #6 on: August 15, 2017, 11:39:39 PM »
Thanks, that is very useful.

spamclark15

  • id Enthusiast
  • Jr. Member
  • **
  • Posts: 97
  • Karma: +10/-3
  • A missile-launching skyscraper with goat legs.
    • View Profile
Re: Another Material Question
« Reply #7 on: August 30, 2017, 08:48:00 AM »
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:

Code: [Select]
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:

Code: [Select]
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

  • Sr. Member
  • ****
  • Posts: 275
  • Karma: +21/-81
  • Doom Newbie
    • View Profile
Re: Another Material Question
« Reply #8 on: August 30, 2017, 01:13:24 PM »
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:

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

plAngles_x = 0;
plAngles_y = plAngles_y + 90;
plAngles_z = 0;
ent.setAngles(plAngles);
}
   
« Last Edit: August 30, 2017, 02:01:30 PM by argoon »

spamclark15

  • id Enthusiast
  • Jr. Member
  • **
  • Posts: 97
  • Karma: +10/-3
  • A missile-launching skyscraper with goat legs.
    • View Profile
Re: Another Material Question
« Reply #9 on: August 30, 2017, 04:28:15 PM »
Thanks. How do I use it?

argoon

  • Sr. Member
  • ****
  • Posts: 275
  • Karma: +21/-81
  • Doom Newbie
    • View Profile
Re: Another Material Question
« Reply #10 on: August 30, 2017, 05:34:37 PM »
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:

Code: [Select]
#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

Code: [Select]
#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
 
« Last Edit: August 30, 2017, 05:38:23 PM by argoon »

spamclark15

  • id Enthusiast
  • Jr. Member
  • **
  • Posts: 97
  • Karma: +10/-3
  • A missile-launching skyscraper with goat legs.
    • View Profile
Re: Another Material Question
« Reply #11 on: August 31, 2017, 04:35:12 AM »
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

  • Sr. Member
  • ****
  • Posts: 275
  • Karma: +21/-81
  • Doom Newbie
    • View Profile
Re: Another Material Question
« Reply #12 on: August 31, 2017, 08:21:21 AM »
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.
« Last Edit: August 31, 2017, 08:26:00 AM by argoon »

bitterman

  • Sr. Member
  • ****
  • Posts: 309
  • Karma: +8/-5
  • Doom Newbie
    • View Profile
Re: Another Material Question
« Reply #13 on: August 31, 2017, 11:44:12 AM »
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.
« Last Edit: August 31, 2017, 11:55:26 AM by bitterman »

spamclark15

  • id Enthusiast
  • Jr. Member
  • **
  • Posts: 97
  • Karma: +10/-3
  • A missile-launching skyscraper with goat legs.
    • View Profile
Re: Another Material Question
« Reply #14 on: August 31, 2017, 05:31:28 PM »
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.