Jump to content
The Dark Mod Forums

Kalwins Questions


KalwinSidpen

Recommended Posts

Evening,

 

would be a great Idea to post questions I came along, within a single topic, instead of spamming the board with new ones.

By the way, I would like to thank everyone on the forums for thier kind support so far. With your help I might even be able to realise my little mapping dream.

 

So here I go:

 

target_setinfluence ?

This very interesting doom3 function refuses to show its animated material overlay effect ("mtrVision" "textures/decals/bloodyfilmred").

Eventhough it works just fine with vanilla doom.

 

// entity 6
{
"classname" "target_setinfluence"
"name" "target_setinfluence_3"
"effect_all" "1"
"effect_vision" "1"
"fade_time" "1"
"flashIn" ".05"
"influenceLevel" "0"
"mtrVision" "textures/decals/bloodyfilmred"
"origin" "233 184 99"
"radius" "1024"
"time" "10"

 

Alternatively I would settle for the overlay effect only.That is, if it's not exclusively bound to the idTarget_setInfluence class.

 

Edited by KalwinSidpen
Link to comment
Share on other sites

Not studied your script but immediately see while (dip=1). Change that to a double == thus while (dip==1)

 

There is a neverdormant spawnarg but I don't know if changing it from script will be effective.

 

I forget the exact name but there is a camera entity which freezes the player. I've not used it for a long time so experiment and post again if no luck.

 

[EDIT] Might be func_cameraview I'm thinking of.

 

Never tried path_attack. Will be interested to hear how it is used myself. Must be a rare situation as it sounds unfair to attack a stealthy player in the dark.

Link to comment
Share on other sites

while (dip=1). Change that to a double == thus while (dip==1)

 

I see what you mean and I already tried both versions. However with while (dip==1) it won't even enter the loop.

Strange enough while (dip=1) seems to work just fine for entering.

Doom scripting seems to be quite quirky... or maybe it's just me.

Edited by KalwinSidpen
Link to comment
Share on other sites

Just a note, the modwiki and doom3world have a lot of detail about scripting etc :)

 

http://www.modwiki.net/wiki/Scripting_basics

Covers a lot of the 'need to know' from what it seems

 

http://www.modwiki.net/wiki/Level_scripting

http://www.modwiki.net/wiki/Tutorial_list#Level_scripting

http://www.modwiki.net/wiki/SCRIPT_(file_format)

Link to comment
Share on other sites

It seems the loop doesn't respond to globaly declared variables? Oh well... i declared within the procedure. It finally works!

Thanks Fidcal

 

No, what I was saying was that you declared one variable name (dip1) but you were using a different variable name in your while loop (dip) so presumably a typo.

Link to comment
Share on other sites

[/i]Setting Cvars

In a special sequence I would like the running speed to be the same as the walking speed.

However, my code doesn't accomplish anything.

 

sys.setcvar("pm_walkspeed","65");
sys.setcvar("pm_runspeed","65");

 

We don't actually use the pm_runspeed cvar anymore, plus the walkspeed cvar doesn't always update right away when you change it. Rather than doing this, I would recommend using some custom scriptfunctions we added, like setEncumbrance. I'm at work so I can't verify the name for sure, but if you look through /script/tdm_main, there is a big list of all our added script functions and documentation on each one.

 

setEncumbrance sets a max movement speed you can move at, as a fraction of the full sprint speed. So if you set it to where it's below the walk speed (currently 70), run and walk will be the same speed. It also stores a text label for what set this encumbrance (which is whatever you want in your script), then you can clear it later using the same text label.

Link to comment
Share on other sites

How do I let an AI (team 0) succesfully attack the player per "path_attack" ?

here a map excerpt of my try:

 

// entity 57
{
"classname" "path_attack"
"name" "path_attack_1"
"enemy" "player1"
"origin" "-1587 221 220"
}

 

If there is a better way per script please tell me.

Alternativly a command to temporaly stop an AI from "thinking" would also work.

 

Team 0 is friendly to the player by default. If you want them to attack, you'll have to change this. Either by switching them to a different team (setTeam?) or changing their individual relation to the player to enemey. We have script events for these, but again I don't have access to search for them now. Check /script/tdm_main.script :)

Link to comment
Share on other sites

As for texture fading etc :

textures/darkmod/doornz/fadedoor
{
  metal
  diffusemap  textures/doornz/bluedoor
  bumpmap   textures/doornz/altdoor_local
  specularmap textures/doornz/altdoor_s
   {
       if ( parm11 > 0 )
       blend filter
       map    _white
       rgb       sinTable[ (time * 0.1) ]
   }
       {
           blend add
           map textures/doornz/bluedoor
           red global2
           green global3
           blue global4
       }
}

 

Will result in a texture that fades to black when frob-highlighted, and back again. If the transition is not smooth enough you will need to create a table in your material file somewhat like :

 

table dclFade {{ 0.1, 0.2, 0.3, 0.5 } }

at the top of your material file.

 

I messed around a bit with trying to get alpha to work, but I think that the texture needs an alpha channel before you can tell it to increase/decrease it, making one with the 'translucent' keyword got some results, but it wasnt too happy being told to start off opaque and then change... you'll have to tinker around

Link to comment
Share on other sites

We don't actually use the pm_runspeed cvar anymore, plus the walkspeed cvar doesn't always update right away when you change it. Rather than doing this, I would recommend using some custom scriptfunctions we added, like setEncumbrance. I'm at work so I can't verify the name for sure, but if you look through /script/tdm_main, there is a big list of all our added script functions and documentation on each one.

 

setEncumbrance sets a max movement speed you can move at, as a fraction of the full sprint speed. So if you set it to where it's below the walk speed (currently 70), run and walk will be the same speed. It also stores a text label for what set this encumbrance (which is whatever you want in your script), then you can clear it later using the same text label.

 

Sounds great! Unfortunetly there is no such function. Checked all over tdm_events and doom_events but no sign of an encumbrance setter. Tried searching for keywords like "walk", "enc" or "move" but no reults.

 

In case you remember the name or have a hint, please tell me.

 

For the fading texture:

 

table solidFadeOut {{ 4, 3, 2, 1, 0 } }

textures/i/black_fader_test
{
translucent

//diffusemap textures/special/black

{
if ( parm7 == 0 ) //fade in
blend blend
map textures/special/black
alpha sinTable[ (time * 0.25) ]
}

{
if ( parm7 == 1 ) //visible
blend blend
map textures/special/black
alpha 1
}

{
if ( parm7 == 3 ) //fade out
blend blend
map textures/special/black
alpha solidFadeOut[ (time * 0.25) ]
}

{
if ( parm7 == 4 ) // invisible
blend blend
map textures/special/black
alpha 0
}

}

 

Works..kind of. The only problem beeing, once it starts fading in, it does so in a loop.

For example if parm7 is 0, the material will endlesly fade in over and over.

However, I need the material to stay visible/invisible after it has been faded in/out.

 

I tried various quick and dirty ways to accomplish this. Like, catching the material per sys.wait() once its faded out and setting its alpha channel to 0 ( parm7 == 4). But this is more than inaqurate and works only from time to time.

 

Am I missing something ?

Edited by KalwinSidpen
Link to comment
Share on other sites

Sounds great! Unfortunetly there is no such function. Checked all over tdm_events and doom_events but no sign of an encumbrance setter. Tried searching for keywords like "walk", "enc" or "move" but no reults.

 

In case you remember the name or have a hint, please tell me.

Ah, sorry, it is setHinderance, not setEncumberance.

Link to comment
Share on other sites

table solidFadeOut {{ 4, 3, 2, 1, 0 } }

textures/i/black_fader_test
{
translucent

//diffusemap textures/special/black

{
if ( parm7 == 0 ) //fade in
blend blend
map textures/special/black
alpha sinTable[ (time * 0.25) ]

 

a sinTable has a sin function, which goes up and down. The time goes always up, so your function fades in and out. What you want is to define a sawtooth table that lists all the values from 255...down to 0, then refer to this table with "time * 0.001something", and then clamp the index to that table. See for reference:

 

http://www.iddevnet.com/doom3/materials.php

 

table fadeOut { [clamp] { 255,254,253,252,251,..0 } }

 

Technically, you would only need two values, 255 and 0, and let D3 do the fading, but that might be harder to control with the "time" factor.

 

One problem is tho, that "time * 0.25" starts with an ever increasing value, so you'd want to have some other sort of index. I am a bit short on ideas, tho. But maybe this helps.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Considering this all requires that the script change material state, would it not be possible to do the final transition as another state change?

 

The reason I used a sin table is I found that it gave the smoothest changes, doing 1...0 resulted in a lot of easily noticable stepping, I dont know if that would change using a more detailed table however.

 

Anyway, just some thoughts. Try with a clamped table tho, should be the easiest way :)

Link to comment
Share on other sites

Thanks for the table hints but as it turns out, I stumblet upon a way to fade the texture using shader parms and some code.

I found that once the condition of an if statement is met, doom iterates the stage endlessly (sort of like a while loop?).

So I thought about, only changing one value in small steps over script. Once it reaches 1 the fade wont repeat and the material remains solid.

The result might be akward but works unlike my initial aproach with tables.

 

textures/i/black_fader_test
{
translucent

//diffusemap textures/special/black

{
if ( parm7 == 0 ) //fade in
blend blend
map textures/special/black
alpha Parm8 
}


{
if ( parm7 == 1 ) //fade out
blend blend
map textures/special/black
alpha Parm8
}

{
if ( parm7 == 2 ) // visible
blend blend
map textures/special/black
alpha 1
}

}

 

void fade_loop(entity obj, float dip)
{
float i;

if (dip == 0)
{
// fade in
for(i=0; i <= 2; i=i+0.02)
{
sys.waitFrame();
obj.setShaderParm(8, i );
}
}
else
{
// fade out
for(i=1; i >= 0; i=i-0.02)
{
sys.waitFrame();
obj.setShaderParm(8, i );
}
}
}

void fade(entity obj, float dip)
{
//thread fade_in_loop(obj);
thread fade_loop(obj, dip);
obj.setShaderParm(7, dip );
}

 

i wrote it into some functions, just in case someone might want to use it.

 

Regards,

 

Kalwin

Edited by KalwinSidpen
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
    • OrbWeaver

      I like the new frob highlight but it would nice if it was less "flickery" while moving over objects (especially barred metal doors).
      · 4 replies
×
×
  • Create New...