Jump to content


Photo

Creating a Robust Tram Script


64 replies to this topic

#51 Epifire

Epifire

    Member

  • Active Developer
  • PipPip
  • 388 posts

Posted 07 June 2017 - 02:47 PM

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, 07 June 2017 - 05:40 PM.

Needing dem environment models?

 

Speak to the EPI!

 

Or rummage my online mesh repository instead...  https://www.mediafire.com/folder/7q1r8him1y63d/TDM%20Repository


#52 Epifire

Epifire

    Member

  • Active Developer
  • PipPip
  • 388 posts

Posted 08 June 2017 - 11:46 PM

post has been removed


Edited by Epifire, 09 June 2017 - 12:42 AM.

Needing dem environment models?

 

Speak to the EPI!

 

Or rummage my online mesh repository instead...  https://www.mediafire.com/folder/7q1r8him1y63d/TDM%20Repository


#53 teh_saccade

teh_saccade

    Member

  • Member
  • PipPip
  • 482 posts

Posted 03 July 2017 - 10:09 AM

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.

 



#54 Epifire

Epifire

    Member

  • Active Developer
  • PipPip
  • 388 posts

Posted 03 July 2017 - 05:51 PM

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.


Needing dem environment models?

 

Speak to the EPI!

 

Or rummage my online mesh repository instead...  https://www.mediafire.com/folder/7q1r8him1y63d/TDM%20Repository


#55 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5151 posts

Posted 04 July 2017 - 01:05 AM

http://wiki.thedarkm...ce/2.03#idMover

 

You can read out all important information about movers.


FM's: Builder Roads, Old Habits, Old Habits Rebuild
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#56 Epifire

Epifire

    Member

  • Active Developer
  • PipPip
  • 388 posts

Posted 04 July 2017 - 03:03 AM

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.


Needing dem environment models?

 

Speak to the EPI!

 

Or rummage my online mesh repository instead...  https://www.mediafire.com/folder/7q1r8him1y63d/TDM%20Repository


#57 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5151 posts

Posted 04 July 2017 - 03:46 AM

  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
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#58 Epifire

Epifire

    Member

  • Active Developer
  • PipPip
  • 388 posts

Posted 04 July 2017 - 02:19 PM

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.


Needing dem environment models?

 

Speak to the EPI!

 

Or rummage my online mesh repository instead...  https://www.mediafire.com/folder/7q1r8him1y63d/TDM%20Repository


#59 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5151 posts

Posted 05 July 2017 - 01:12 AM

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.


  • Epifire likes this
FM's: Builder Roads, Old Habits, Old Habits Rebuild
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#60 Epifire

Epifire

    Member

  • Active Developer
  • PipPip
  • 388 posts

Posted 05 July 2017 - 02:10 AM

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.


Needing dem environment models?

 

Speak to the EPI!

 

Or rummage my online mesh repository instead...  https://www.mediafire.com/folder/7q1r8him1y63d/TDM%20Repository


#61 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5151 posts

Posted 05 July 2017 - 06:13 AM


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
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#62 Epifire

Epifire

    Member

  • Active Developer
  • PipPip
  • 388 posts

Posted 05 July 2017 - 03:25 PM

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?


Needing dem environment models?

 

Speak to the EPI!

 

Or rummage my online mesh repository instead...  https://www.mediafire.com/folder/7q1r8him1y63d/TDM%20Repository


#63 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5151 posts

Posted 06 July 2017 - 02:29 AM

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
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#64 Epifire

Epifire

    Member

  • Active Developer
  • PipPip
  • 388 posts

Posted 06 July 2017 - 02:17 PM

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.


Needing dem environment models?

 

Speak to the EPI!

 

Or rummage my online mesh repository instead...  https://www.mediafire.com/folder/7q1r8him1y63d/TDM%20Repository


#65 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5151 posts

Posted 06 July 2017 - 02:33 PM

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
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users