Jump to content
The Dark Mod Forums
demagogue

Newbie DarkRadiant Questions

Recommended Posts

15 minutes ago, STRUNK said:

@JackFarmer

Ok, I'm working on a very simple script now and only have to know how many object jou want to have bobbing, and if I know how much they should translate, and in what direction, I can put that in the script already.

Sorry, I think we have a misunderstanding here, your scripts work perfectly. I have found out that a different item causes the problem:

Once the player carried out several steps (that includes activating the bobbing entity), an in-game map (entity name: map_of) can be grabbed by the player. As soon as the player grabs this particular map, the game crashes to desktop.

Even more strange, I have two of these maps in my mission, but only the second one causes the problem.

Thus I have copied the relevant entity into a test map, and there everything works fine. Conclusion: there must be something wrong in my WIP map.

Share this post


Link to post
Share on other sites

@JackFarmer

Ok, but does it crash also without the new bobbing mechanism? Dragofer mentioned he had crashes when using more of these at the same time .. so maybe that might cause the overload, and not your maps ...

Share this post


Link to post
Share on other sites

@STRUNK

You are right, I have just tried two arrangements:

1. If the player grabs the map BEFORE activating the bobbing, then everything works fine and the grabbed map causes no problems

2. If the player grabs the map AFTER activating the bobbing, then DM crashes to desktop.

In total, I have two of the func_mover_dragofer entities in my map.

 

 

Share this post


Link to post
Share on other sites

Ok, I just finished a script and map for 8 of them : )

You can simply copy stuff to your map and bind to bob1, bob2 etc. Be shure to read the script file and adjust if needed.

So if this works you can get rid of the former .script and .def files

The script file goes in the maps folder and should be renamed tot the same name as your own map.

Bob.map Bob.script

Edited by STRUNK
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

@STRUNK

That worked! That worked!

Activation of both func_movers and subsequent frobbing of the map does not cause crashes anymore!

I removed the def file but kept the reusable_script as removal of the latter prevented DM from starting in the first place.

Thank you very much for your help!

In my potential mission "The Inventors Guild", you will not only get a mention, you will get your own statue - in the "Hall of Inventors"! :)

  • Like 2

Share this post


Link to post
Share on other sites

@JackFarmer

Nice!! Glad I could help also : )

The two scripts in the folder should both be deleted, for the tdm_custom_scripts.script is telling the game to include the tdm_reusable_script.script:

#include "script/tdm_reusable_script.script"

If you have no other scripts in the script folder just throw it away completely : )

Edited by STRUNK

Share this post


Link to post
Share on other sites

@STRUNK

Ah, yes, of course, the usage is defined there, thus DM does not like its removal before editing of the custom_script accordingly.

Will do!

Share this post


Link to post
Share on other sites

RE bobbing... Just playing around writing a scriptobject attached to a func_mover. I'd like to trigger the entity from its scriptobject, but can't figure out how to do that.

Tried so far:
 

    string m_bob_entity_name;
    entity m_bob_entity;

  ...

  // In Init:

    m_bob_entity_name = getKey ("name");
    m_bob_entity = $m_bob_entity_name;

  ...

  // In function loop, variations like:

            sys.trigger(self); // probably doesn't work because "self" is referring to scriptobject, not entity
            $m_bob_entity.trigger();

            m_bob_entity.trigger();
            sys.trigger(m_bob_entity);

 

Share this post


Link to post
Share on other sites

I once tried to make an entity trigger itself via S/R and got an error message saying entities aren't supposed to trigger themselves; so I had it trigger another entity, which had a Response to trigger it right back.

Edited by VanishedOne

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Share this post


Link to post
Share on other sites

@Geep instead of triggering the whole entity, you could maybe get by just by re-calling the objectfunction if condition x (m_bobbing) is true.

void scriptobjectname::bob()
{
	move up
	wait
	move down
	wait
	if(m_bobbing){thread bob();}
}

Or use a while(condition_x) to only repeat movement for as long as condition x is true.

void scriptobjectname::bob()
{
	while(m_bobbing)
	{
		move up
		wait
		move down
		wait
	}

}

 

And condition x could be toggled like this. This should get called when the func_bobbing is triggered(/frobbed).

void scriptobjectname::toggle_bob()
{
	if(m_bobbing)				//if m_bobbing == 1
		{m_bobbing = 0;}
	else
		{m_bobbing = 1;}
}

 

  • Like 1

Share this post


Link to post
Share on other sites

@STRUNK, it may be a scriptobject approach using func_mover is not going to work, because self-triggering can't happen, as @VanishedOne found in a perhaps-different context.

The whole reason for self-triggering is to reload the changed spawnargs and start the func_mover in action again. So what @Dragofer suggests would still require triggering within moveup/movedown, if you wanted to use the func_mover mechanism. BTW, my experiments did have conditional treatment within a loop. Also, I was getting syntax errors in using thread calls within a scriptobject.

I could try just moving a func_static (instead of func_mover) with a scriptobject, and relying entirely on the scripting to micro-move (not ideal for performance). in that case, there would be function call(s) to turn bobbing on/off. May not work if there are re-entrancy issues that prevent more than one entity-related function from running at time.

Or give up on scriptobject, just use external code/triggering with the func_mover, closer to STRUNK's example. No doubt the safe route.

Share this post


Link to post
Share on other sites

@Geep

I wanted the script to be as stupid/simple as I could (not hard for I'm not a scriptkid), to have it "safe". : )

But somehow the func_mover_dragofer triggers itself via S/R, where a frob action is the stim and the response is triggering the script, if I remember correctly. But maybe just that is where it goes wrong with more then one in a map ...

Edited by STRUNK

Share this post


Link to post
Share on other sites

The fog of memory having cleared a bit, I think what specifically got me an error was making an entity target itself, before anything could get as far as actually triggering anything.


Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Share this post


Link to post
Share on other sites
1 hour ago, Geep said:

The whole reason for self-triggering is to reload the changed spawnargs and start the func_mover in action again.

If you only want to reload spawnargs you can use getKey at the start of every movement. So:

while(m_bobbing)
{
	m_time		= getFloatKey("time");
	m_translate 	= getFloatKey("translate");

	time(m_time);			//how long the movement should take
	move(m_translate);

	sys.wait(m_time);		//wait for the movement to finish before repeating this block of script. sys.waitFor(self) doesn't work in scriptobjects
}

 

1 hour ago, Geep said:

I could try just moving a func_static (instead of func_mover) with a scriptobject, and relying entirely on the scripting to micro-move (not ideal for performance).

I wouldn't advise that, func_mover comes with plenty of inbuilt features like being interruptable, pushing/damaging things etc.

Share this post


Link to post
Share on other sites

Something to really watch out for here is that sys.waitFor() or sys.waitFor(self) don't work in scriptobjects. So if you just use sys.wait(x) it won't care if the mover gets delayed because it was blocked and it can get thrown off course.

The way I solved it was to compare current position with target position every 0.1s in a looping script. If both are identical, the mover has arrived and can start moving back. I also compared current position : previous position to detect when the mover was blocked in order to pause movement sound.

  • Thanks 1

Share this post


Link to post
Share on other sites

Were signals of no use? That looks to be how you're 'expected' to find out whether a mover has arrived or been blocked.

  • Like 1
  • Thanks 1

Some things I'm repeatedly thinking about...

 

- louder scream when you're dying

Share this post


Link to post
Share on other sites
3 minutes ago, VanishedOne said:

Were signals of no use? That looks to be how you're 'expected' to find out whether a mover has arrived or been blocked.

Thanks, that sounds very useful. I wasn't aware of them because they weren't listed under "func_mover" in the TDM Script Reference. That should make life much easier if SIG_MOVER_POS1 etc. work for non-binary movers too.

Share this post


Link to post
Share on other sites

@Dragofer, I'm confused about these functions

	time(m_time);			//how long the movement should take
	move(m_translate);

 Are those standard func_mover functions? Or if they're hand-built functions somewhere else in the scriptobject, I'm back to pondering how to make move() work unless you can self-trigger the func_mover.

As for signals and scriptobjects playing nice together in a func_mover context... maybe, but I'd like to see a working example of that. Particularly of multiple func_mover entities not interfering with each other.

Share this post


Link to post
Share on other sites

I have, with the wiki of @Geep, made a video playing in game ... but I can't find a way to get the video to loop ...

Does anyone know how to do that?

Here is my setup:

https://easyupload.io/7g1ci6

//

Never mind, I found it .. just add "loop" in the material file:

videoMap loop video/video.mp4

 

Edited by STRUNK
  • Like 1

Share this post


Link to post
Share on other sites

Thanks for trying it out and giving me feedback. I'm glad it's working.

A concern about "videoMap loop" is that, with the audio file separate, the soundtrack wouldn't loop by itself. You could maybe give the sound file a recurring trigger in a script loop... but probably would get noticeably out of sync with the vid if looped at lot.

The RoQ example shows looping of audio and video within the GUI using onTime. It essential runs forever, so may have performance impact unless further modified.

The "videoMap" command also can take "withAudio", to use the embedded audio. That's used in the briefing videos, but the system to do that reportedly got some special buffer coding in TDM 2.06, so I didn't think it would work for non-briefing cutscenes. I didn't experiment with that, but you may want to.

  • Like 1

Share this post


Link to post
Share on other sites

I'm looking for a pure white self lit material to act as background for recording silhouettes.

There is a material already that should be just that, but ingame for me it's pure black.

white_pure:

textures/darkmod/sfx/white_pure
{

	description "A pure white unreflective material that's solid but doesn't interact with light."
    // qer_editorimage not needed, it'll show up white in DR anyway
    forceOpaque
    solid
    sort 1          // Draw just after light interactions
    
    {
        blend add
        map _white
    }


}

Is this material black ingame for everyone, or, if not, how to make such a material?

Share this post


Link to post
Share on other sites

 

Following up on the bobbing topic from 10 days ago.

Here is a a demo of bobr.script, a method I just developed, specifically designed for water bobbing. it shows multiple objects, whose bobbing can be turned on & off (unlike "func_bobbing"), either individually or in groups. It is visually similar to the STRUNK+Dragofer's "bob" demo, but differs from it in that -

  • when a "stop" is requested, it eventually concludes with a return of the bobber back to its origin, the mid-point of its vertical traversal
  • it features more physically-persuasive slow startup and wind-downs of bobbing
  • besides bob range and time, the number of startup/wind-down cycles are set by spawnargs
  • spawnargs are set on the triggering device (lever arms in the demo)
  • the method is script-centric, and provides code functions that can be shared by multiple bobbers

Some of these behavioral features are more easily implemented through scripting than through map trigger objects that the "bob" demo deploys.

The demo specifically shows 10 positions with lever switches. From left to right, these demonstrate the following.

1) This position has no lever arm. Instead, frob the lever base to toggle bobbing. It -
- uses a frob_action_script call (unlike other positions).     
- moves a raw func_mover (unlike other positions that show a func_mover converted from a func_static "package" model).
- shows a higher vertical range than the other bobbers. These last 2 attributes are more similar to the "bob" demo.       

2-8) From left to right, imagine the floating packages progressively heavier & less bouyant, so placed lower in the water, with shorter bob ranges, longer bob times, & shorter start/stop cycle counts.

9) Controls a group of 3 bobbers with same parameters, in synchrony.
10) Controls 3 bobbers with differing parameters.

For more, see the install description, "Notes", & comments in script/bobr.script.

bobr_demo_2020-04-06.jpg

  • Like 1

Share this post


Link to post
Share on other sites

Anyone got experience with the path_talk entity? I'd like to use this instead of a conversation to get an AI to say a line, but neither the entity description nor the inherited properties suggest how to use the entity.

@Geep looks impressive, sure went all the way with that bobbing entity. Maybe you'd like to open an own thread for it?

Share this post


Link to post
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.


×
×
  • Create New...