Jump to content
The Dark Mod Forums

Creating a Robust Tram Script


Epifire

Recommended Posts

OH, derp. Yeah that makes a lot more sense than what I was initially thinking. So it accepts the script but I'm getting the feeling this mover doesn't behave like normal movers. I say that because both in the spawnargs as well as these direct script functions, it hasn't actually played the sounds when the tram accelerates, moves, etc. It's strange because I assign timing values for all those modes of movement but the sounds don't seem to play in those occurrences.

 

This does make me wonder if it's a sound shader problem, like not having it play globally or something. If it was something like localization that would make perfect sense as to why I can't hear it. I'll have to have a look at that, or just see how I can trigger these sounds manually based on mover events. Yeah I just tried setting global on the sounds but still no luck, I just don't think the mover is triggering them for whatever reason.

 

EDIT: Well I did a little bit of finagling in the script and just manually kicked the loop sound in. So if for some reason we can't figure out a way of making the base functions for accel, decel and move sounds work; then I can do this other weird means of getting the sounds in. Only thing that's really off is the, "tram_stop" decel sound because I don't have a value that I can use to kick that in. However I don't know the syntax for it but I made the assumption it could be kicked in via a speed check. I'd have something that would check mover speed and it would be delayed in the script to check after the initial acceleration time is over. Again I don't know the syntax for it but I'd have the stop sound trigger if the speed dips below the max run speed. Great part about this method is the max run speed can change depending on what the mapper uses but it wont change what the speed check does as it only uses a value less then whatever it's currently running at. A decent theory at the very least.

Edited by Epifire

Modeler galore & co-authors literally everything

 

 

Link to comment
Share on other sites

  • 4 weeks later...

It sounds over-complicated.

For trains or carriages, stashing an ai in the driver's seat (hidden compartment) who is deaf and blind - they can bark the sounds you need, as if having a conversation with the vehicle's properties.
Cut small holes for "tannoy".

The tram can't talk, but ai can.

Link to comment
Share on other sites

It sounds over-complicated.

 

For trains or carriages, stashing an ai in the driver's seat (hidden compartment) who is deaf and blind - they can bark the sounds you need, as if having a conversation with the vehicle's properties.

Cut small holes for "tannoy".

 

The tram can't talk, but ai can.

 

 

 

So far I actually have it all working now. The difference being that the decel sound has to be fed a manually added delay (minus six seconds of whatever the actual move time is). If I ever get around to compacting this more I'd like to get a script that finds the move time and does the subtraction automatically. Thus I'd be able to remove some DR entities and clean that end of things up a bit more.

Modeler galore & co-authors literally everything

 

 

Link to comment
Share on other sites

http://wiki.thedarkmod.com/index.php?title=TDM_Script_Reference/2.03#idMover

 

You can read out all important information about movers.

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

I'd tried getting a math function setup based off that same page actually. Don't think I had the right syntax though.

 

EDIT: Oh now that I think about it, there is something that's on topic I had been meaning to ask. I have one thing left for the tram and it's a mtr bound effect. Problem I'd been having is I don't can't seem to be able to have a scroll function working on both the U and V axis. I actually just can't get horizontal scrolling to work at all and it's been a bit frustrating.

 

I was told scroll and translate specified the two different axis of movement but no such luck...

tram_arcbolt_001
{
	noshadows
	nonsolid
	twosided


	{
		blend diffusemap
		map      	models/darkmod/props/textures/arcBolt_card
		alphatest 	0.5
		scroll 		1 * 0, (time * 4)
		translate 	0 * 1, (time * 1)
		VertexColor
	}
	{
		blend		add
		map     	models/darkmod/props/textures/arcBolt_card
		rgb     	1
		scroll 		1 * 0, (time * 4)
		translate 	0 * 1, (time * 1)
		VertexColor
	}
	
	{
		blend diffusemap
		map       models/darkmod/props/textures/_transparent
		alphatest 0.5
		inverseVertexColor
	}
}

I tried swapping out the 1 * 0 values after the translate and scroll commands but that didn't seem to have any change when tested. Also, this specific material fades the arc bolt out to transparency (via vertex blends). Mentioning that now to avoid confusion about the VertexColor lines.

Modeler galore & co-authors literally everything

 

 

Link to comment
Share on other sites

  1. What do you expect the 1*0 to do? 1*0=0, so you could just write 0 ;) Same goes for time*1, that's time. And don't use brackets where not needed.
  2. I'm not sure whether it is a good idea to use scroll and translate together. Decide for one to use

If I'm not mistaken scroll moves the texture every frame by the given amount, maybe depending on the time that has passed during said frame. Translate offsets the texture by the given amount. You would only use time in combination with translate, unless you want the texture translation to accelerate. :)

 

Try this:

tram_arcbolt_001
{
    noshadows
    nonsolid
    twosided


    {
        blend diffusemap
        map     models/darkmod/props/textures/arcBolt_card
        alphatest     0.5
        translate     0 , time 
        VertexColor
    }
    {
        blend        add
        map     models/darkmod/props/textures/arcBolt_card
        rgb     1
        translate     0 , time
        VertexColor
    }
    
    {
        blend diffusemap
        map models/darkmod/props/textures/_transparent
        alphatest 0.5
        inverseVertexColor
    }
}

Why are you blend adding the texture you are using as a diffuse map btw? Seems odd, especially with rgb set to 1 (the color values range from 0 to 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

All the time, and 1 * 0 garbage is left over from the references I pulled these off of originally. They ended up working for my original uses so they stayed, as they weren't breaking anything.

 

The blend add stage is just for the arc card to glow, as it's pretty drab by itself. This setup you posted works but only along one axis of movement. It's still missing vertical and horizontal motion in this instance. Time is needed as the control of the movement is required to be rapid (along vertical movement) and much slower horizontally. Done right this should allow me to stage arc bolts that move/slide across two rails.

Modeler galore & co-authors literally everything

 

 

Link to comment
Share on other sites

If you want the texture to translate on both axis you have to specify the translation for both axis. For example

 

translate time*2, time*4

The first parameter defines the translation on the u-axis, the second one on the v-axis.

  • 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

Man, something that simple was all it took. Thank you! I knew it was something in my setup as I had tried practically everything else. I honestly wish I was more knowledgeable about what the different operators performed, but it's still gonna be a while before figuring all that out. Documentation is pretty vague, and to non-coders like myself it really just comes down to seeing select examples of what the different functions achieve.

 

Now here's an interesting one (kinda looping back to what I asked before) is about a simple math function. How to make the script check the move time, subtract six seconds off that and use that to time the trigger on the decel sound. It's not crucial but that would remove a whole entity array that's doing the job manually from a from DR. I'm really just curious on the syntax because I know we have math operators that should be able to do this.

 

The two things that confused me was if the move time could be checked from script, if it's a value supplied via a spawnarg. The other is how to carry that value over (in the script) to achieve proper timing. It's really inconvenient to manually set the decel trigger time, so if it's possible I really want that to not have to be done in the final version.

Modeler galore & co-authors literally everything

 

 

Link to comment
Share on other sites

 


How to make the script check the move time, subtract six seconds off that and use that to time the trigger on the decel sound.

By move time do you mean the remaining move time or the move time from start on?

 

Btw: Func_movers have snd_accel and snd_decel spawnargs, which refer to the sound shader that should be played when accelerating/decelerating. You don't have to script this.

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

By move time do you mean the remaining move time or the move time from start on?

 

Btw: Func_movers have snd_accel and snd_decel spawnargs, which refer to the sound shader that should be played when accelerating/decelerating. You don't have to script this.

 

Never had any luck getting them to work. I tried just targeting the speaker labels that contained the sounds and then the actual sound reference names themselves but could never get that to work.

 

I had used, $mover_object.decelSound("tram_stop"); in the past but no luck in getting that to work. I was able to use conventional methods like, $snd_electrical_loop.activate($player1); but anything for the movetime, accel and decel sounds I couldn't. One thing that occurs to me now; does the decel script have to work in conjunction with the decel sound spawnarg (set in the tram mover) as well?

Modeler galore & co-authors literally everything

 

 

Link to comment
Share on other sites

Note that those spawnargs refer to soundshaders. Just passing a soundfile or the name of a speaker won't work.

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

Do the spawnargs have to be used in conjunction with the script though? I'd used shoundshader references in the past but only via script or spawnarg exclusively.

Modeler galore & co-authors literally everything

 

 

Link to comment
Share on other sites

The script functions allow you to change the sounds after the mission has started. If you don't want that you will not need them.

 

Simple set the soundshader names there.

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

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

    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 5 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
×
×
  • Create New...