Jump to content
The Dark Mod Forums

Newbie DarkRadiant Questions


demagogue

Recommended Posts

@BienieIt seems it boils down to that you want any AI in that restricted location getting alerted to fail the mission. As your experiments showed it's problematic to implement this with conventional means, so I'd suggest making a script that loops through all AIs every 1s, checking what location they're in and checking their alert status. 

To help the script identify the restricted locations, I'd suggest setting a custom spawnarg "restricted" "1" on those info_locations.

The script should go roughly like this, assuming your no alerts objective is #8 and uses the AI_USE spawnarg for identifying human AIs (a bit clunky to write scripts on this device):

void restricted_loop()
{
	ai guard;
	entity loc;

	while(1)
	{
		do
		{

			guard = sys.getNextEntity("AI_USE", "AIUSE_PERSON", guard);
			loc = guard.getLocation();

			if( ( guard.AI_ALERTINDEX > 0 ) && ( loc.getFloatKey("restricted") ) )
			{
				$player1.setObjectiveState(8, OBJ_FAILED);
			}

		} while ( guard != $null_entity );

		sys.wait(1);
	}
}

You can read more about the scripting methods used in this script here and here.

  • Like 1
Link to comment
Share on other sites

29 minutes ago, Dragofer said:

@BienieIt seems it boils down to that you want any AI in that restricted location getting alerted to fail the mission. As your experiments showed it's problematic to implement this with conventional means, so I'd suggest making a script that loops through all AIs every 1s, checking what location they're in and checking their alert status. 

To help the script identify the restricted locations, I'd suggest setting a custom spawnarg "restricted" "1" on those info_locations.

The script should go roughly like this, assuming your no alerts objective is #8 and uses the AI_USE spawnarg for identifying human AIs (a bit clunky to write scripts on this device):

 

void restricted_loop()

{

ai guard;

entity loc;

while(1)

{

do {

guard = sys.getNextEntity("AI_USE", "AI_PERSON", guard);

loc = guard.getLocation();

if( ( guard.AI_ALERTINDEX > 0 ) && ( loc.getFloatKey("restricted") ) )

{

$player1.setObjectiveState(8, OBJ_FAILED);

}

} while ( guard != $null_entity )

sys.wait(1);

}

}

 

You can read more about the scripting methods used in this script here and here.

Thanks for the handy script. I'm having a bit of trouble with it though, since I'm a complete Luddite when it comes to scripting.

I managed to translate the alert part of the objective into the script (two separate ones since it's different on expert vs. normal/hard), which is no 3rd level alerts on expert and no 5th level alerts on normal/hard. I also added "restricted" "1" to the info_location.

Quote

//Dragofer's Script to check if alerted AI is inside the manor, on expert

    void restricted_loop_1()

    {

    ai guard;

    entity loc;

    while(1)

    {

    do {

    guard = sys.getNextEntity("AI_USE", "AI_PERSON", guard);

    loc = guard.getLocation();

    if( ( guard.AI_ALERTINDEX > 2 ) && ( loc.getFloatKey("restricted") ) )

    {

    $player1.setObjectiveState(3, OBJ_FAILED);

    }

    } while ( guard != $null_entity )

    sys.wait(1);

    }

    }

//Dragofer's Script to check if alerted AI is inside the manor, on normal+hard

    void restricted_loop_2()

    {

    ai guard;

    entity loc;

    while(1)

    {

    do {

    guard = sys.getNextEntity("AI_USE", "AI_PERSON", guard);

    loc = guard.getLocation();

    if( ( guard.AI_ALERTINDEX > 4 ) && ( loc.getFloatKey("restricted") ) )

    {

    $player1.setObjectiveState(2, OBJ_FAILED);

    }

    } while ( guard != $null_entity )

    sys.wait(1);

    }

    }

I didn't understand what you meant by "my objective using the AI_USE spawnarg for identifying human AIs", so I'm not sure if I needed to do something there.

But as it stands now the map fails to load because "AI_ALERTINDEX is not a member of ai", I looked in the tdm_ai.script file and it is listed there under the AI object section. What am I doing wrong?

My Fan Missions:

   Series:                                                                           Standalone:

Chronicles of Skulduggery 0: To Catch a Thief                     The Night of Reluctant Benefaction

Chronicles of Skulduggery 1: Pearls and Swine                    Langhorne Lodge

Chronicles of Skulduggery 2: A Precarious Position              

Chronicles of Skulduggery 3: Sacricide

 

 

 

Link to comment
Share on other sites

15 hours ago, Bienie said:

I didn't understand what you meant by "my objective using the AI_USE spawnarg for identifying human AIs", so I'm not sure if I needed to do something there.

But as it stands now the map fails to load because "AI_ALERTINDEX is not a member of ai", I looked in the tdm_ai.script file and it is listed there under the AI object section. What am I doing wrong?

It was 2 separate sentences:

- my assumption was your no-alerts objective is #8, you changed that to #3

- my method to identify that an entity is a human AI was to check if it had a spawnarg "AI_USE" with the value "AIUSE_PERSON".

The alertindex error is my fault, it's case sensitive and should've been AI_AlertIndex instead of all caps.

Link to comment
Share on other sites

By the way, this is a new version of the script:

  • added some proper indenting with the tab key so it's easier to see what goes together.
  • added input parameters to restricted_loop() so that you can call it from main() with different parameters (max allowed alert and objective id) depending on difficulty instead of cloning the whole script.
  • added "return;" so that the script stops processing once the objective has been failed
//Dragofer's script to check if alerted AI is inside the manor
void restricted_loop(float max_alert, float obj_id)
{
	while(1)	//loop forever, since 1 is always true and never changes
	{
		ai guard;
		entity loc;

		do
		{
			guard = sys.getNextEntity("AI_USE", "AIUSE_PERSON", guard);
			loc = guard.getLocation();

			if( ( guard.AI_AlertIndex > max_alert ) && loc.getFloatKey("restricted") )
			{
				$player1.setObjectiveState(obj_id, OBJ_FAILED);
				return;		//stop this script, obj has been  failed
			}

		} while ( guard != $null_entity );	//keep searching until no more valid entities are found

		sys.wait(1);	//wait 1s before repeating
	}
}

 

void main()
{
	sys.waitFrame();	//give time for all entities on the map to spawn

	if( sys.getDifficultyLevel() < 2 )	// difficulty 0 == normal, 1 == hard
	{
		thread restricted_loop(4, 2);	//parameters: max allowed alert, objective id
	}

	else
	{
		thread restricted_loop(2, 3);
	}
}

Edit: corrected spawnarg value from "AI_PERSON" to "AIUSE_PERSON"

  • Thanks 1
Link to comment
Share on other sites

Ok I got the map to load with the script now, but I'm running in to some odd behavior.

The script does not seem to do anything when it comes to alerting AI in the restricted zone. What it does do, from what I can tell, is delete two objectives at runtime. Since all of my hidden objectives are becoming visible in the wrong order now. If my atdm:target_setobjective_visibility is supposed to make objective (obj_id) 16 visible it is now making objective 18 from the list in DR visible.

Ideas of what might be happening?

 

Quote

//Dragofer's script to check if alerted AI is inside the manor
void restricted_loop(float max_alert, float obj_id)
{
    while(1)    //loop forever
    {
        ai guard;
        entity loc;

        do
        {
            guard = sys.getNextEntity("AI_USE", "AI_PERSON", guard);
            loc = guard.getLocation();

            if( ( guard.AI_AlertIndex > max_alert ) && loc.getFloatKey("restricted") )
            {
                $player1.setObjectiveState(obj_id, OBJ_FAILED);
            }

        } while ( guard != $null_entity );

        sys.wait(1);    //wait 1s before repeating
    }
}

//code that keeps track of secrets.

    float secrets_count;

    void trigger_secrets()
        {
            secrets_count = secrets_count + 1;
            string secret_num = "You have discovered " + (secrets_count - 1) + " of 10 secrets.";
            $Secret_Message.setKey("text", secret_num);
            $Secret_Message.activate($player1);
        }

//Void Main

    void main()
        {
          secrets_count = 1;  //sets the secrets counter at 1.
        $sidemispay1.hide(); //hides payment for side mission 1.
        $sidemispay2.hide(); //hides payment for side mission 2.
    sys.waitFrame();    //give time for all entities on the map to spawn

    if(sys.getDifficultyLevel() == 2)    // difficulty 2 == expert
    {
        thread restricted_loop(2, 3);    //parameters: max allowed alert, objective id
    }

    else
    {
        thread restricted_loop(4, 2);
    }
        }

 

Edited by Bienie
forgot to add script lol

My Fan Missions:

   Series:                                                                           Standalone:

Chronicles of Skulduggery 0: To Catch a Thief                     The Night of Reluctant Benefaction

Chronicles of Skulduggery 1: Pearls and Swine                    Langhorne Lodge

Chronicles of Skulduggery 2: A Precarious Position              

Chronicles of Skulduggery 3: Sacricide

 

 

 

Link to comment
Share on other sites

1 hour ago, Bienie said:

The script does not seem to do anything when it comes to alerting AI in the restricted zone.

Try replacing the loop script with the latest version, I edited in a few more changes. One of them was a correction for the spawnarg value of "AI_USE": the correct value is "AIUSE_PERSON", not "AI_PERSON" (wrote that script yesterday when I already had shut down my PC).

Regarding objectives, this script does nothing else than set the state of either objective 2 or 3 to failed, it doesn't modify visibility. And that line didn't even take effect in your map because of the abovementioned typo.

Link to comment
Share on other sites

52 minutes ago, Dragofer said:

Try replacing the loop script with the latest version, I edited in a few more changes. One of them was a correction for the spawnarg value of "AI_USE": the correct value is "AIUSE_PERSON", not "AI_PERSON" (wrote that script yesterday when I already had shut down my PC).

Regarding objectives, this script does nothing else than set the state of either objective 2 or 3 to failed, it doesn't modify visibility. And that line didn't even take effect in your map because of the abovementioned typo.

I still can't get it to work...

It seems TDM doesn't like identical objectives so they were both deleted instead.  Putting back the "do not alert above level X" into the objective brought them back into the game and now the hidden missions are being revealed correctly. But even with that updated script, the objective doesn't fail when they see the body. I'm using it exactly as is, except for the fact I have to put a semicolon after "$null_entity )" or the map won't load. I also changed AI_PERSON to AIUSE_PERSON.

My Fan Missions:

   Series:                                                                           Standalone:

Chronicles of Skulduggery 0: To Catch a Thief                     The Night of Reluctant Benefaction

Chronicles of Skulduggery 1: Pearls and Swine                    Langhorne Lodge

Chronicles of Skulduggery 2: A Precarious Position              

Chronicles of Skulduggery 3: Sacricide

 

 

 

Link to comment
Share on other sites

1 hour ago, Bienie said:

It seems TDM doesn't like identical objectives so they were both deleted instead.  Putting back the "do not alert above level X" into the objective brought them back into the game and now the hidden missions are being revealed correctly.

The fact that removing the "do not alert above x" component caused the objectives to get deleted suggests there's something going wrong there. My assumption is both of those objectives had no components at all and were therefore skipped.

Got to make sure your "no alert" objectives have the "Custom script" component type, which shows up as "Controlled by external script" in the component list.

1 hour ago, Bienie said:

But even with that updated script, the objective doesn't fail when they see the body.

Note that you're asking for an alert level of 5 for the objective to fail on normal or hard difficulty. This means that the AI is actively chasing an enemy - finding a dead body won't be enough to reach that level.

Link to comment
Share on other sites

2 hours ago, Dragofer said:

The fact that removing the "do not alert above x" component caused the objectives to get deleted suggests there's something going wrong there. My assumption is both of those objectives had no components at all and were therefore skipped.

Got to make sure your "no alert" objectives have the "Custom script" component type, which shows up as "Controlled by external script" in the component list.

Note that you're asking for an alert level of 5 for the objective to fail on normal or hard difficulty. This means that the AI is actively chasing an enemy - finding a dead body won't be enough to reach that level.

I have been testing on expert since I realize that finding a body is not a level 5 alert. I think I should ultimately have level 4 on normal/hard and 3 on expert. Finding a body is at least a level 3 alert no?

But even so, when the alerts are not built in to the objective, the script does not fail the mission even when the guards see me and attack me.

Right now my objective is built like this:

flagged [mandatory] [ongoing] [visible]

Components

#1 Do NOT alert 1 AI of team 1 1 times to a minimum alert level of 3.

#2 Do NOT kill 1 AI of team 1.

#3 Do NOT knock out 1 AI of team 1.

#4 Controlled by external script.

All components flagged [satisfied at start]

Removing component #1 from the objective makes it not appear in game. Having it in, with the script, doesn't fail the mission when the body is discovered. However, if I am seen the mission does fail, but would do so even if it was outside of the restricted zone.

Edited by Bienie

My Fan Missions:

   Series:                                                                           Standalone:

Chronicles of Skulduggery 0: To Catch a Thief                     The Night of Reluctant Benefaction

Chronicles of Skulduggery 1: Pearls and Swine                    Langhorne Lodge

Chronicles of Skulduggery 2: A Precarious Position              

Chronicles of Skulduggery 3: Sacricide

 

 

 

Link to comment
Share on other sites

16 hours ago, Bienie said:

Removing component #1 from the objective makes it not appear in game.

That very much sounds like a DR bug. If it happens on the latest version of DR - 2.13 or the 2.14 beta - I'd suggest opening a ticket on bugs.thedarkmod.com with a download link to your current version of the FM, or a test map with your main objectives entity.

16 hours ago, Bienie said:

Having it in, with the script, doesn't fail the mission when the body is discovered.

I've just made a test map to test the script and found that the AI_Use spawnarg for some reason doesn't work here (maybe because of case inconsistencies?). "team" "1" on the other hand does work.

Looking at what you're aiming to set up with those objectives (no kill, no KO, no alert), I've added support for all of that to the script so that your objectives need nothing else than the "Custom script" component with no flags, circumventing the abovementioned probable DR bug. At my end the setup now works as it should - in the attached test map, the sandy left half is non-restricted and the wooden right half is restricted.

Untitled.thumb.jpg.efbd45912c376442de241f166b024dac.jpg

Also threw in a check for whether the AI's health has decreased - though there's always the caveat that an AI might for some reason lose health, i.e. because it stepped on a loose physics-enabled spoon, so there's 10 points of tolerance in this. A sword/arrow/fire arrow splash do 30+ damage, so might want to raise tolerance further. If you have elevators in your mansion, which are notorious AI killers, you'd probably want to get rid of this check.

There's some inconsistency between your components: killing/KO of mansion residents is never allowed, but raising alerts (i.e. by being fully detected) is only a problem if it happens while they're inside the mansion. The attached new version of the script replicates this, but it can be adjusted if it's unintentional.

restricted.scriptrestricted.map

Spoiler
//Dragofer's script to check if alerted AI is inside the manor
void restricted_loop(float max_alert, float obj_id)
{
	ai guard;
	entity loc;

	while(1)		//loop forever, since 1 is always true and never changes
	{
		do
		{
			guard = sys.getNextEntity("team", "1", guard);
			loc = guard.getLocation();

			if( ( ( guard.AI_DEAD && guard.isPlayerResponsibleForDeath() ) || guard.AI_KNOCKEDOUT || guard.getHealth() < guard.getFloatKey("health") - 10 )
			||    ( loc.getFloatKey("restricted") && guard.AI_AlertIndex > max_alert ) )
			{
				$player1.setObjectiveState(obj_id, OBJ_FAILED);
				return;			//stop this script, obj has been  failed
			}

		} while ( guard != $null_entity );	//keep searching until no more valid entities are found

		sys.wait(0.5);				//wait 0.5s before repeating
	}
}

void main()
{
	sys.waitFrame();				//give time for all entities on the map to spawn

	if( sys.getDifficultyLevel() < 2 )		// difficulty 0 == normal, 1 == hard
	{
		thread restricted_loop(4, 2);		//parameters: max allowed alert, objective id
	}

	else
	{
		thread restricted_loop(2, 3);
	}
}

 

 

  • Thanks 1
Link to comment
Share on other sites

1 hour ago, Dragofer said:

I've just made a test map to test the script and found that the AI_Use spawnarg for some reason doesn't work here (maybe because of case inconsistencies?). "team" "1" on the other hand does work.

Thanks!

I just tested the map and it does indeed seem to work for being seen. The only thing is when I add an AI of team 2 to knockout and then hide before they discover the body the mission does not fail. It's as if finding a body does not raise the alert level at all, even though they always go in to search mode. It also does not matter if the body is found in the restricted zone or not. If finding a body in the restricted zone would fail the objective by the script I think all should be set. :)

Meanwhile I will try to add the script/objectives into my mission to see that the functionality hold there as well.

edit: BTW I'm running an old version of DR still: 2.8.0. Was going to update to the newest once I'm finished with this mission.

restricted.map restricted.script

Edited by Bienie

My Fan Missions:

   Series:                                                                           Standalone:

Chronicles of Skulduggery 0: To Catch a Thief                     The Night of Reluctant Benefaction

Chronicles of Skulduggery 1: Pearls and Swine                    Langhorne Lodge

Chronicles of Skulduggery 2: A Precarious Position              

Chronicles of Skulduggery 3: Sacricide

 

 

 

Link to comment
Share on other sites

1 hour ago, Bienie said:

It's as if finding a body does not raise the alert level at all, even though they always go in to search mode.

According to the script, if I add a debug line to print the AI's current alert level to the console, a body raises the alert level to 4. If I lower the max alert level to 3 on normal/hard and let a script KO a team 4 AI in front of a team 1 AI in the restricted zone, then the objective fails as expected.

Well, max alert level 3 might be a bit tough on normal/hard difficulty. Maybe bodies can be handled independently of alert level by the script.

  • Thanks 1
Link to comment
Share on other sites

51 minutes ago, Dragofer said:

According to the script, if I add a debug line to print the AI's current alert level to the console, a body raises the alert level to 4. If I lower the max alert level to 3 on normal/hard and let a script KO a team 4 AI in front of a team 1 AI in the restricted zone, then the objective fails as expected.

Well, max alert level 3 might be a bit tough on normal/hard difficulty. Maybe bodies can be handled independently of alert level by the script.

Actually I think it's good as is. I just migrated the new script to my map and it works as intended! I just changed the "max alert level" to 4 in the script on normal/hard, I think that is acceptable, and it still seems to fail the mission when the body is found in the restricted area. Additionally the mission fails if an AI of team 1 is knocked out even outside the restricted zone which is good.

The only minor issue with the setup is if the AI gets alerted outside the restricted zone and then starts searching and by chance enters the restricted zone while alerted, the mission fails, despite the event causing the alert happening outside the zone. But honestly that's nitpicking on an edge case and is an acceptable inconsistency.

Anyway I think I figured out what was causing the objective bug! I first removed all other components than "controlled by external script" and started the mission, objective gone on all difficulties. Went back into DR and saw that it was still listed as component #4 with no other components. So I deleted it and remade it as #1 and it worked! So I can't say whether or not this is still the case in the DR beta, but if it is it should probably be reported.

Thanks again for taking the time to help me with this!!

Edited by Bienie

My Fan Missions:

   Series:                                                                           Standalone:

Chronicles of Skulduggery 0: To Catch a Thief                     The Night of Reluctant Benefaction

Chronicles of Skulduggery 1: Pearls and Swine                    Langhorne Lodge

Chronicles of Skulduggery 2: A Precarious Position              

Chronicles of Skulduggery 3: Sacricide

 

 

 

Link to comment
Share on other sites

Now I only have one more game breaking bug that's plaguing my mission. And I do mean game breaking!

When the player has completed all the mandatory objectives and goes to finish the mission the objective to "return to where you started" ticks off as completed, but the mission does not end. This has happened to me before in a mission that I've yet to release, and I did get it working again, but I have no freaking idea what I did, it just suddenly worked I think.

I've combed through my objectives looking for anything that might make an optional objective unintentionally mandatory, but for the life of my I can't find anything. Even if this was the case I don't think that the end objective would tick off as complete in that case.

The mandatory objectives are built as follows:

1:  Knock out AI and bring him to a specified location. (all diff levels, mandatory, visible)

Component 1: Let the target entity X be in location entity Y

4: Get 1200 Loot (normal, mandatory, visible)

Component 1: Acquire 1200 entities

5: Get 1800 Loot (hard, mandatory, visible)

Component 1: Acquire 1800 entities

6: Get 2400 Loot (expertl, mandatory, visible)

Component 1: Acquire 2400 entities

17: Return to where you started (all diff levels, mandatory, visible)

enabling objectives: 1 AND (4 OR 5 OR 6)

Component 1: Let the target 0 entities of the spawnclass idPlayer be in location entity X

 

Could there be something wrong with my objective structure? If not what else could be the problem?

My Fan Missions:

   Series:                                                                           Standalone:

Chronicles of Skulduggery 0: To Catch a Thief                     The Night of Reluctant Benefaction

Chronicles of Skulduggery 1: Pearls and Swine                    Langhorne Lodge

Chronicles of Skulduggery 2: A Precarious Position              

Chronicles of Skulduggery 3: Sacricide

 

 

 

Link to comment
Share on other sites

You're welcome!

1 hour ago, Bienie said:

When the player has completed all the mandatory objectives and goes to finish the mission the objective to "return to where you started" ticks off as completed, but the mission does not end.

I'd make the same assumption as you that there's a problem with the "mandatory" setting on one of the objectives. But if that final objective already works fine, then you can just make a manual mission success logic that only checks whether that final objective is done.

image.thumb.png.e30fc3b9740be601fa80de9f79440cda.png

  • Thanks 1
Link to comment
Share on other sites

2 hours ago, Dragofer said:

You're welcome!

I'd make the same assumption as you that there's a problem with the "mandatory" setting on one of the objectives. But if that final objective already works fine, then you can just make a manual mission success logic that only checks whether that final objective is done.

image.thumb.png.e30fc3b9740be601fa80de9f79440cda.png

That worked a charm. Saved my ass again! Thanks :D

  • Like 1

My Fan Missions:

   Series:                                                                           Standalone:

Chronicles of Skulduggery 0: To Catch a Thief                     The Night of Reluctant Benefaction

Chronicles of Skulduggery 1: Pearls and Swine                    Langhorne Lodge

Chronicles of Skulduggery 2: A Precarious Position              

Chronicles of Skulduggery 3: Sacricide

 

 

 

Link to comment
Share on other sites

  • 2 weeks later...

Update: I solved my problem and it was mostly due to my own error. Another day often brings a clear head..

There's now another problem with the camera view, but I fiddle a bit first before asking.

Spoiler

I try to make a camera view described on wiki page https://wiki.thedarkmod.com/index.php?title=Security_Camera_(2.10%2B) bottom section. The idea is this:

The player looks at a screen which is a surface with texture camera gui applied and has cameratarget set to target-null-1 .

target-null-1 is a target-null entity which points to a wall from a distance. I'm supposed to look into another room where the target-null entity is placed. Whatever I do I always get this weird yellow texture, even if I put objects in front of the target-null entity:

camera-view.jpg.9530e7175d1df50f3f350ee9ad97470c.jpg

I think this is just how the tutorial tells you to do it. What am I doing wrong? I'm using 2.10

I tried in 2.09 and then the screen is just black instead.

I also tried the camerawiki2.pk4 testmap (to see if I could learn something fro it), but there the displays don't work either.

 

Edit1: I figured the screen should not be worldspawn.. So I made it into a function_static , now it shows a black screen..

Edit2: Maybe this issue is related:

https://bugs.thedarkmod.com/view.php?id=5676

I guess maybe I should not build and test on 2.10 (?)

 

 

Edited by datiswous
solved my own problem
Link to comment
Share on other sites

1. No lights -no fun

I have extinguished a torch in a script with

$name.extinguishLights();

...now I want to relight it with

$name.On();

...but nothing happens. What is my mistake? Is void ON() not the correct command?

 

2. Subtitles from hell

Is it possible to display a tdm_gui_message when a func_camera is active? I gave the entity the cinematic_1 property, but nothing happens (that means, the message vanishes as soon the camera gets triggered).

 

Edited by JackFarmer
Link to comment
Share on other sites

@JackFarmerI think you need to use a different script event to switch it back on. The torch is a model entity that spawns a light at map start, and I believe On is designed to be called directly on the light entity itself. It should be enough just to sys.trigger the torch, which would cause its tdm_light_holder scriptobject to switch the light on.

Might want to find another way though if theres a risk the player mightve relit that torch with a fire arrow or candle. IIRC there are also S/R events for switching extinguishable lights on, but they too might be designed to be used on the light entity directly.

For 2) the problem seems familiar, youre probably not the first to have it. Will have to think on it.

  • Thanks 1
Link to comment
Share on other sites

On 10/5/2021 at 12:18 PM, Dragofer said:

@Jedi_Wannabe
Easiest would be to let all the trigger brushes target a func_remove entity, which in turn targets all the trigger brushes. When the func_remove is triggered it deletes all targets.

 

Only took me two months to get around to it, but once I sat down at the PC it was 5 min of work and 5 min of testing and everything is perfect, as intended. Thank you SO much as always @Dragofer, Taffer-In-Chief, you've helped me tremendously thus far, it's impossible to overstate my gratitude.

  • Like 1

As my father used to say, "A grenade a day, keeps the enemy at bay!"

My one FM so far: Paying the Bills: 0 - Moving Day

Link to comment
Share on other sites

Is it possible to change the alert status of an AI manually?

If found this in the scripting reference:

void alertAI(string type, float amount, entity actor);

but I don't know whether this is correct let alone how to applicate it in a script and can't find a suitable hint in the scripting tutorial. :(

I just want to make sure that if the command gets triggered, the AI alert status returns to 0 (if the AI has been alerted by naughty players)

 

Link to comment
Share on other sites

  • 2 weeks later...

Would someone be able to help me create a new texture?  I had a look at this page, but a) it's very old and b) it seems to be written as if I am taking my own photographs, which I'm not doing.  Also I lost the plot when it said to use the texturize plugin and I couldn't figure out how to install it . I installed in the plugins directory and as far as I could tell it did nothing - and also the article didn't say how to use the plugin. Also I have no idea if that plugin still works with Gimp, and all other tutorials around creating textures seem to be about 15 years old.  I'm an ultra-n00b when it comes to this stuff.

What I want to be able to do is:

  • start with a royalty-free, no-strings-attached image downloaded from somewhere like Pixabay
  • make a texture out of it (e.g. a wallpaper)

That's it - nothing fancy.  But I need some very prescriptive instructions, as I don't understand about 95% of any of this stuff.  I plan to use Gimp (is this is the best option?  I don't want to buy Photoshop or anything).  So need to know about image sizes, pixels, plugins and whatever else that currently all seems like mumbo-jumbo to me at the moment.

I would be more than happy to write a new tutorial that covers this if someone can sum up how to do this in a few sentences, as long as they don't mind me asking lots of dumb questions.

Edited by Frost_Salamander
  • Like 1
Link to comment
Share on other sites

First off it is a small semantic distinction but there is typically no getting a way with just making a new texture, but you must make an entirely new material to get it in game. The easiest way to do this is to simply copy a material definition from the base game and redirect the map references to your new textures. Most materials will have a bump/normal map and/or a specular map.

DDS compression and mip map generation are now prepackaged with GIMP so no plugins needed there. I use it for compressing my finished textures. I would worry about that at the end - first you just need to get the .tga maps needed for your new material.

What is much more difficult when starting with a pre made image is then generating convincing specular and bump maps for it. With the advent of PBR and procedural generated materials there are not very many sources for materials authored in this way. You may find you are happier just generating maps from procedural tools like Quixel Mixer or Substance Painter - just make sure you don’t use any inputs that run afoul of their licensing agreements if you are then distributing them. You will still struggle at first to get correct looking specular/bump materials out of the software designed for PBR but it is possible.

If you indeed want to use an image there isn’t a way to sum this up in a few sentences, but you basically need to convert your image into a pair of grey scale images - one that roughly reflects the height information of the image and another which which represents the reflective properties - in each case white being the highest value and black the lowest.

I have done this in “too many” ways and it almost always depends on what works best with the source. You can apply greyscale and color curve filters in gimp/photoshop/affinity photo, etc. You can use programs like bitmap2material or quixel mixer which have tools designed to generate these maps semi automatically from 2d images. Or yes - you can hand draw them.

In the case of the height map, while I believe it will work as is I typically convert it into a bump/normal map. This is where I really like bitmap2material as it lets you import an authored height map and then blend it with the software’s own generated height map - the output being a combined bump map. This is a good approach if for example you have a “rough plank” image - you can quickly rough out the height information of the planks by hand in gimp and then blend it with the high frequency height information generated by the software.

This will often provide acceptable and perhaps even good looking results, but it will never be as physically correct as a normal map which was baked from a mesh or mixed procedurally. At this point you should ideally have a material test map to preview your material.

There are two console commands which are most helpful here as you can make changes to your material definition and maps without reloading the game:

-reloaddecls - this will load any revision to a material definition (or any other def for that matter)

-reloadsurface - this will load any revision to a texture map

At that point you basically spend countless hours tweaking your material, reexporting it, reloading it from the console, frowning, pacing the room in despair, until you reach the final stage and accept it is, like all things, imperfect.

Edited by Wellingtoncrab

-=  IRIS  =-    ♦    = SLL =

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

    • 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
    • nbohr1more

      Please vote in the 15th Anniversary Contest Theme Poll
       
      · 0 replies
    • Ansome

      Well then, it's been about a week since I released my first FM and I must say that I was very pleasantly surprised by its reception. I had expected half as much interest in my short little FM as I received and even less when it came to positive feedback, but I am glad that the aspects of my mission that I put the most heart into were often the most appreciated. It was also delightful to read plenty of honest criticism and helpful feedback, as I've already been given plenty of useful pointers on improving my brushwork, level design, and gameplay difficulty.
      I've gotten back into the groove of chipping away at my reading and game list, as well as the endless FM catalogue here, but I may very well try my hand at the 15th anniversary contest should it materialize. That is assuming my eyes are ready for a few more months of Dark Radiant's bright interface while burning the midnight oil, of course!
      · 4 replies
×
×
  • Create New...