Jump to content
The Dark Mod Forums

Dragofer's Scripting


Dragofer

Recommended Posts

Loving that presence lamp setup! That could be very useful to mappers. I've wanted to make a lost city style map for a long time, and that is one piece that I wouldn't have to worry about, should I pursue that idea!

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...

When I tried to make Lost City lamps with trigger_inactivity, I found it worked for the player but the trigger_multiple would repeatedly trigger its target with an AI inside it only if the AI was pathing, not if it was standing still. Have you found differently?

  • Like 1

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Link to comment
Share on other sites

@VanishedOneThat's indeed the case. Note that Dragofer doesn't directly triggers the light via the trigger_multiple, but instead uses it to reset a timer that turns the light off once it ran out.

  • Like 1

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

Right: that's basically what I did as well. If the AI stood still for long enough the timer would run out and the AI would be plunged into darkness. If memory serves, the last time I mentioned this you suggested using a different set-up with a modified AI scriptobject.

  • Like 1

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Link to comment
Share on other sites

I can confirm that trigger_multiple brushes stop firing triggers if an AI stands still within them. So I see 3 options:

  1. Report this for 2.09 so it hopefully gets fixed, or keep both mechanisms so we have both motion sensors and presence sensors.
  2. Develop a different presence mechanism that doesn't (wholly) rely on trigger brushes
  3. Turn this into a feature and rename to  "motion lamp" instead of "presence lamp". Change the script so the lamp only responds to player movements that exceed a certain velocity.
  • Like 1
Link to comment
Share on other sites

You could check whether ai emit a visual stim, they player should. The lamps could than do a proximity test. Otherwise a custom stim applied to the ai could serve the purpose. It would probably good to allow both versions, either by using a trigger to control the lamp or the stim variant.

19 hours ago, Dragofer said:

Turn this into a feature and rename to  "motion lamp" instead of "presence lamp". Change the script so the lamp only responds to player movements that exceed a certain velocity.

You could basically have both. If the minimum velocity needed for the lamp to turn on is controlled via a spawnarg, mappers would have the choice to set it to zero if the want a "presence lamp". A "motion lamp" could be interesting in respect to gameplay. Besides the magical lamp type of Lost City style one could also think of such lamps in manor missions or similar, whereas those are something by the inventors guild. Sneaking by lamps that go on if you are to fast while there is ai around could create quiet some tensive moments.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

A motion lamp should be quite feasible if I can get trigger_multiple brushes to inform the script who activated it. Trigger_touch has such a function (pass_activator and pass_self spawnargs) but I don't see that for trigger_multiple. Surely that possibility exists?

For making stim-triggered presence lamps, a problem will be that the radius of the stim is defined on the humanoid and not on the lamp, and any existing stims might be too short-ranged for general use. Would likely need to put custom stims with a large radius on all AIs and the player and only let the lamp react if the humanoid is within a certain spawnarg-specified radius. Alternatively each lamp lamp could check every second whether it can see someone, though then it'd frequently switch on/off when the player or AI moves around objects that provide cover.

Another potential problem is that the AI might be very close but on a different floor/in an adjacent room. Visibility checks can't be used to identify this because the humanoid might be hidden behind cover, so it'll have to be location-based: each room should be its own location. Looks like this is a more involved route than the trigger brush method.

Link to comment
Share on other sites

Even if a stim is used to initiate the lamp behaviour, you can specifically define on how you want to do the detection. So to mimic the trigger behaviour (assuming you are using cuboid shaped triggers) you could do a coordinate check (via mins/maxs as done by some entities for example).

To apply the custom stim you only have to modify the ai_base and player_base definitions. So you don't have to add the stim to all affected entities manually.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

  • 1 month later...

Here's a .pk4 containing @Sotha's great automaton guards from Ulysses: Genesis as well as an alternative design for the charging station that I had already made on another occasion, as requested by @JackFarmer. The reason I'm posting this in my scripting thread is that I've made a straightforward scriptobject for the charging station, allowing an automaton to switch it on and off as part of its patrol, thereby saving a lot of money on the lord's electricity bill and preventing the station from getting out of sync. It also switches off after a specified time (time_max), in case the automaton is destroyed while it was charging.

Mapping wise, it works by having path_anim nodes activating callobjectfunctions, calling either station_on or station_off on the station. The station toggles its targets, unless it's already in the desired state. Prefabs can be found under prefabs/mechanical/automaton_station.

Here's the simple scriptobject:

Spoiler


object automaton_station
{
	void	init();
	void	station_on();
	void	station_off();

	//INTERNAL
	float	m_station_state;

	//SPAWNARGS
	float	m_time_max;		//station automatically switches off after this time if bot fails to switch it off (i.e. because it's been killed at the station). 0 = infinite.
};


void automaton_station::init()
{
	m_time_max		= getFloatKey("time_max");
}

void automaton_station::station_on()
{
	if(!m_station_state)
	{
		activateTargets(self);
		m_station_state = 1;
	}

	if(m_time_max)
	{
		sys.wait(m_time_max);
		thread station_off();	
	}
}

void automaton_station::station_off()
{
	if (m_station_state)
	{
		activateTargets(self);
		m_station_state = 0;
	}
}

 

Under the hood, I've taken the opportunity to clean up the assets a fair amount, trimming unused components and ensuring it follows TDM's conventions, which is a necessary step towards an inclusion in the core assets.

The download can be found in section D of the original post.

  • Like 1
  • Thanks 2
Link to comment
Share on other sites

  • 2 months later...
On 10/3/2020 at 1:30 PM, Dragofer said:

Here's a .pk4 containing @Sotha's great automaton guards from Ulysses: Genesis as well as an alternative design for the charging station that I had already made on another occasion, as requested by @JackFarmer. The reason I'm posting this in my scripting thread is that I've made a straightforward scriptobject for the charging station, allowing an automaton to switch it on and off as part of its patrol, thereby saving a lot of money on the lord's electricity bill and preventing the station from getting out of sync. It also switches off after a specified time (time_max), in case the automaton is destroyed while it was charging.

Mapping wise, it works by having path_anim nodes activating callobjectfunctions, calling either station_on or station_off on the station. The station toggles its targets, unless it's already in the desired state. Prefabs can be found under prefabs/mechanical/automaton_station.

Here's the simple scriptobject:

  Reveal hidden contents


object automaton_station
{
	void	init();
	void	station_on();
	void	station_off();

	//INTERNAL
	float	m_station_state;

	//SPAWNARGS
	float	m_time_max;		//station automatically switches off after this time if bot fails to switch it off (i.e. because it's been killed at the station). 0 = infinite.
};


void automaton_station::init()
{
	m_time_max		= getFloatKey("time_max");
}

void automaton_station::station_on()
{
	if(!m_station_state)
	{
		activateTargets(self);
		m_station_state = 1;
	}

	if(m_time_max)
	{
		sys.wait(m_time_max);
		thread station_off();	
	}
}

void automaton_station::station_off()
{
	if (m_station_state)
	{
		activateTargets(self);
		m_station_state = 0;
	}
}

 

Under the hood, I've taken the opportunity to clean up the assets a fair amount, trimming unused components and ensuring it follows TDM's conventions, which is a necessary step towards an inclusion in the core assets.

The download can be found in section D of the original post.

That's really cool Dragofer and Sotha, man I really need to play TDM more, I didn't even knew such characters existed in TDM.

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

So I've looked into #5319 and was able to solve the issue. By default, ai only activate triggers if they have changed their position in the last frame. I don't know whether it was setup like this for optimization purposes or whether  there is another reason.

The Bugtracker list a couple of missions that use those triggers in combination with ai, so someone who knows the mission or the mission creators themselves might investigate whether the current behaviour is required for those setups to work.

I haven't commited anything yet due to this but imho it is rather inconsistent if a trigger reacts differently to the ai as it does to the player. At least I suspect most mappers wouldn't expect that, as both represent humans.

 

UPDATE: After looking at most of the missions myself (except winter harvest, that isn't listed in the downloader), there seem to be no case were trigger_multiples or other multiple firing triggers are used with ai. So I commited the change as it shouldn't influence existing missions.

  • Thanks 1

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

  • 3 weeks later...

Here's the camgoyle sentient turret that I originally made for the FM Written in Stone. It's based on the new security camera entity and augmented with scripting to allow it to fire magical projectiles at the enemies it detects. People are more than welcome to use it and to convert it into something else, such as a mechanical turret.

Features

  • Predicts the target's position based on its current velocity to fire more accurately. This can be disabled, i.e. on certain difficulties. Also traces towards the target before shooting to ensure the projectile has an unobstructed flight path.
  • Uses a custom, purplish magical projectile with new sfx as a new alternative to fireballs.
  • Comes with a scripted power source pedestal that can be placed anywhere in the map and be disabled by a special inventoryable staff, "atdm:mage_hand_staff". See prefabs/ai/machines for a prefab.
  • Can be destroyed by fire arrows, causing it to break apart into pieces that fly about the room. Smoke will billow forth from the husk that still remains in place.
  • The spotlight is set to be volumetric. You can use your own spotlight with the "spotlight_custom" spawnarg (see also: Security Camera wiki for other common functionality).
  • By default the camgoyle is on the undead team, #8, so it'll only shoot at living targets such as the player.

Google Drive

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

  • 4 months later...
1 hour ago, Baal said:

If you're looking for ideas: What about a working furnace for a crematory, for example? That could be useful for someone. *wink wink*

I feel like this is something that can be done in DR's Stim/Repsonse editor. Body goes in, ashes come out...

But we'll wait for Dragofer to explain why we need a script :D

Link to comment
Share on other sites

Updated the download link with an update for the audiograph:

  • Added custom sounds for switching on/off, loading/unloading and generic background noise for when a recording is playing, provided by Goldwell.
  • More control over when playing a recording will trigger targets. The trigger_max spawnarg allows to limit how often targets can be triggered, while the trigger_from spawnarg(s) allows to restrict triggering to only when the spindle is played from a specific audiograph(s).
  • More flexible support for scripting. Scripts can load any spindle regardless of whether the player has it in his inventory. Spindles can be returned either to the player's inventory or to the place they were loaded or picked up from. This allows the audiograph to be fully operated from scripts.
On 11/11/2022 at 2:01 PM, Baal said:

A lot of cool new stuff in this thread.

If you're looking for ideas: What about a working furnace for a crematory, for example? That could be useful for someone. *wink wink*

Thanks! I actually needed an audiograph for my map, but figured I'd do it "properly" so that we have an easily reusable audiograph entity for the core mod. If you need help with implementing a crematory I can advise.

On 11/11/2022 at 3:10 PM, Amadeus said:

I feel like this is something that can be done in DR's Stim/Repsonse editor. Body goes in, ashes come out...

But we'll wait for Dragofer to explain why we need a script :D

S/R is fine for making stuff happen by bringing 2 entities close to each other (i.e. furnace and body), but it gets messy if you want a sequence of events to happen and more detailed stuff like placing particle emitters at specific joints.

On 11/11/2022 at 11:21 AM, datiswous said:

From how it looks I would expect a projection beam come from the left side, which plays a video recording on the side wall..

Using volumetric light and a video texture on the wall... Just an idea.

That can be done as a custom addon, just need to add a frob response to the audiograph that calls up a script which makes a video patch and a light appear until the sound is no longer playing (is_playing is 0).

 

  • Like 3
Link to comment
Share on other sites

Your stuff is most excellent, Dragofer.

Have you ever thought about creating small maps/missions showcasing your tools in action along with the different options / configurations? And I really mean a bare bones map.

I personally find it more intuitive seeing something and replicating what others did than trying to figure something out from docs/wiki/boards.

  • Like 1

TDM Modpack 4.0

Link to comment
Share on other sites

47 minutes ago, snatcher said:

Have you ever thought about creating small maps/missions showcasing your tools in action along with the different options / configurations? And I really mean a bare bones map.

I do usually make test FM archives for each asset, as it helps make sure that all custom assets are in place. When I release an asset it's basically that archive minus the maps folder. I could try to dig the maps up again.

The assets are usually made for missions, so you can also find the assets in there (presence lamp in Painter's Wife, camgoyles in Written in Stone, automaton station in The Anomaly, the audiograph and teledoors feature in WIPs).

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

    • 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
    • The Black Arrow

      Any of you heard Age of Wonders 4's OST?
      https://www.youtube.com/watch?v=Q0TcoMGq4iA
      I love how after all these years, Michiel van den Bos still conserves his "Melodic" spirit.
      · 0 replies
    • nbohr1more

      Moddb article is up:  https://www.moddb.com/mods/the-dark-mod/news/the-dark-mod-212-is-here
      · 3 replies
    • Petike the Taffer

      I've been gone for a while, but now I'm back, have a new desktop and I want to get back to making missions and playing missions. And doing other contributions. Waiting for my reset password for the wiki, but I'll take a look at it soon. Hello, all.
      · 4 replies
    • snatcher

      TDM Modpack 4.0 for The Dark Mod 2.12 released!
      · 1 reply
×
×
  • Create New...