Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Tiberian Technologies / Blackhand Studios » Tiberian Technologies Forum » [REQUEST]Sound on turret rotate
[REQUEST]Sound on turret rotate [message #478104] Thu, 20 December 2012 21:50 Go to next message
Generalcamo is currently offline  Generalcamo
Messages: 522
Registered: October 2010
Karma: 0
Colonel
Hey, I am trying to create a turret rotate sound, but the only one I can find, RA2VEN_TurretSound, is giving me heaps of problems. Could the TT team potentially create another, easier to use script please?
Re: [REQUEST]Sound on turret rotate [message #478105 is a reply to message #478104] Thu, 20 December 2012 23:32 Go to previous messageGo to next message
StealthEye is currently offline  StealthEye
Messages: 2518
Registered: May 2006
Location: The Netherlands
Karma: 0
General (2 Stars)

Sorry, that is not a priority right now. If someone writes one we can add it, but that's it.

BlackIntel admin/founder/coder
Please visit http://www.blackintel.org/
Re: [REQUEST]Sound on turret rotate [message #478109 is a reply to message #478104] Fri, 21 December 2012 09:22 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
What problems are you having with it? Perhaps you're just using it incorrectly?

http://steamsignature.com/card/1/76561197975867233.png
Re: [REQUEST]Sound on turret rotate [message #478166 is a reply to message #478104] Mon, 24 December 2012 17:30 Go to previous messageGo to next message
Generalcamo is currently offline  Generalcamo
Messages: 522
Registered: October 2010
Karma: 0
Colonel
Mostly that it doesn't sound the sound I put into it. I know I used it right, because I temporarily set it to a visible daves arrow to see if it attaches, and it does.
Re: [REQUEST]Sound on turret rotate [message #478182 is a reply to message #478104] Tue, 25 December 2012 12:56 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Can you list the parameters you are using with the script? Looking at the code it should work, in theory.

http://steamsignature.com/card/1/76561197975867233.png
Re: [REQUEST]Sound on turret rotate [message #478191 is a reply to message #478104] Tue, 25 December 2012 17:37 Go to previous messageGo to next message
Generalcamo is currently offline  Generalcamo
Messages: 522
Registered: October 2010
Karma: 0
Colonel
test_sam
Type: Mounted AI Defense
Scripts:
ra2ven_TurretSound
Parameter:
TurretSoundObj: SAM_TURRET

SAM_TURRET
Type: Daves Arrow
Scripts:
RA2Ven_TurretSoundObj
Parameters
RotationAngleLimit: 572957
Rotate3dSound:Turret_Sound
Explosion_Preset: Blamo_Killer
Time: 1.00
Timer Number: 0
Wav_Length: 2.00
Timer Number2: 0
Re: [REQUEST]Sound on turret rotate [message #478203 is a reply to message #478104] Wed, 26 December 2012 04:32 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
There's your problem. TimerNumber and TimerNumber2 must be >0 and different from each other.

Oh, and "RotationAngleLimit" doesn't do anything apparently. Good eh?


http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Wed, 26 December 2012 04:34]

Report message to a moderator

Re: [REQUEST]Sound on turret rotate [message #478216 is a reply to message #478203] Wed, 26 December 2012 18:44 Go to previous messageGo to next message
Generalcamo is currently offline  Generalcamo
Messages: 522
Registered: October 2010
Karma: 0
Colonel
danpaul88 wrote on Wed, 26 December 2012 06:32

There's your problem. TimerNumber and TimerNumber2 must be >0 and different from each other.

Oh, and "RotationAngleLimit" doesn't do anything apparently. Good eh?


Tried that, it didn't work. Plus, the documentation specifically states not to set them unless you have other timers in your map, and you know exactly what you are doing.
Re: [REQUEST]Sound on turret rotate [message #478226 is a reply to message #478104] Thu, 27 December 2012 07:41 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
having read the code, the documentation is wrong

http://steamsignature.com/card/1/76561197975867233.png
Re: [REQUEST]Sound on turret rotate [message #478227 is a reply to message #478104] Thu, 27 December 2012 07:48 Go to previous messageGo to next message
Omar007 is currently offline  Omar007
Messages: 1711
Registered: December 2007
Location: Amsterdam
Karma: 0
General (1 Star)
TBH the timer system in Renegade sucks. I vote for improvement (if it is possible to change it) Razz
Doing that would break existing scripts though :/


http://tiberiumredux.omarpakker.nl/Old Unused Parts/Plaatjes/PromoteBanner_Hades_small.jpg

[Updated on: Thu, 27 December 2012 07:48]

Report message to a moderator

Re: [REQUEST]Sound on turret rotate [message #478233 is a reply to message #478104] Thu, 27 December 2012 15:13 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Actually... I'm not even sure timers NEED unique numbers... custom messages do because all scripts receive them, but timers pass a pointer to the calling script into the timer and I believe only that script gets notified when the timer expires.


As for saying they suck... why exactly do they suck? I find them very flexible and haven't found anything I can't do with either a timer or a custom.


http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Thu, 27 December 2012 15:14]

Report message to a moderator

Re: [REQUEST]Sound on turret rotate [message #478237 is a reply to message #478104] Thu, 27 December 2012 18:35 Go to previous messageGo to next message
Omar007 is currently offline  Omar007
Messages: 1711
Registered: December 2007
Location: Amsterdam
Karma: 0
General (1 Star)
It does allow you to do whatever you want and it's more of a personal preference but I'd like to be able to give a function pointer instead of a number so that that function is executed when the timer ends instead of the Timer_Expired function where you have to check the number.

So kinda like
//Ampersand is actually optional but just added it to make it obvious that I'm giving the address of the function to the timer
Commands->Start_Timer(obj, this, 0.5f, &myFunction);

public void myFunction()
{
    //Do stuff
}


It'd also make it readable what the job of the timer is by reading the name of the function attached to it. (assuming the programmer named it 'harvesterCheckTimer' and not 'timer123' or something)

But as I said it is more of a personal thing. The system does not suck in that it is limited or anything. It's just that it could be done in a more useable manner.
Scripts wouldn't ever need custom timer numbers to be set in LE.
You would never have the problem of Script A and Script B both running a timer with number 1337 on the same object. (if Timer_Expired is indeed only called on the calling script and not on the object, you don't have this problem anyway; it has been a while so I'm not sure which one it was)


http://tiberiumredux.omarpakker.nl/Old Unused Parts/Plaatjes/PromoteBanner_Hades_small.jpg

[Updated on: Thu, 27 December 2012 18:53]

Report message to a moderator

Re: [REQUEST]Sound on turret rotate [message #478255 is a reply to message #478104] Fri, 28 December 2012 12:17 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
It helps if you used named constants for your timer numbers, instead of magic numbers. For example;

void dp88_RemoteControlConsole::Timer_Expired ( GameObject *obj, int number )
{
	if ( number == TIMER_REMOTECONTROL_TIMEOUT && vehicleID == 0 )
	{
		<code>
	}


	else if ( number == TIMER_REMOTECONTROL_DRIVERENTER )
	{
		<code>
	}


	// This can be called for the vehicle being destroyed OR the console becoming disabled
	else if ( number == TIMER_REMOTECONTROL_DRIVEREXIT )
	{
		<code>
	}


	// Count down tick for charge time
	else if ( number == TIMER_REMOTECONTROL_CHARGETICK )
	{
		<code>
	}
}


The above is actually very read-able and you could call seperate functions to handle each if/elseif case. You could alternatively use a timed custom and pass the address of a function to be called when the custom is fired if you really wanted to.


This also works for custom messages, in cases where you don't need them to be user-controllable (because the script should't be attached to the same object twice anyway). For instance;

void dp88_buildingScripts_baseClass::Custom ( GameObject *obj, int type, int param, GameObject *sender )
{
  if ( (m_parentId == -1 && obj == sender)
    || (m_parentId != -1 && Commands->Get_ID(sender) == m_parentId ) )
  {
    if ( type == CUSTOM_BUILDINGSCRIPTS_BUILDINGOFFLINE )
      return OnBuildingOffline(obj);
    if ( type == CUSTOM_BUILDINGSCRIPTS_BUILDINGONLINE )
      return OnBuildingOnline(obj);
    if ( type == CUSTOM_BUILDINGSCRIPTS_BUILDINGCAPTURED )
      return OnBuildingCaptured(obj, param);
    if ( type == CUSTOM_BUILDINGSCRIPTS_BUILDINGDESTROYED )
    {
      OnBuildingDestroyed(obj);
      m_parentId = -1;
      return;
    }
  }

  OnCustom(obj,type,param,sender);
}


http://steamsignature.com/card/1/76561197975867233.png
Re: [REQUEST]Sound on turret rotate [message #478256 is a reply to message #478104] Fri, 28 December 2012 12:28 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
UPDATE;

Looking at the code in the script, I think it has a flaw in the way it works. Regardless of which timer fires (Timer1 or Timer2) it restarts Timer1, which means you end up with multiple trigger instances for Timer1 running concurrently... this shouldn't stop the script working, but it will add a lot of unnecessary overhead.

The other bug in the script is that it assumes the sound object has a bone named "turret", despite the fact that the object itself is attached to the parent vehicles turret bone. That will either make it play the sound at the origin position (good) or not at all (bad).



I'm not sure whether it's a good idea to modify the script at this time since another map or mod might have it up and running... then again, since it was written for a now-defunct mod (RA2:Venegence) it's possible it is unused and could be fixed.


http://steamsignature.com/card/1/76561197975867233.png
Re: [REQUEST]Sound on turret rotate [message #478258 is a reply to message #478104] Fri, 28 December 2012 13:30 Go to previous message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
OK, so I figured the existing script had some fundamental flaws in it's implementation so I wrote a new, much simpler to use, version.

http://doc.tiberiantechnologies.org/scripts.dll/classdp88__turret_sound.html

If you want to edit scripts.dll to start using it now, before the next scripts release, here's the code. Please don't ship any .dll files to anyone with this in, since we don't want people running non-versioned (and therefore, non-debuggable) client side code, but you can use it for testing or in a server side mod.

Toggle Spoiler


http://steamsignature.com/card/1/76561197975867233.png

[Updated on: Fri, 28 December 2012 13:33]

Report message to a moderator

Previous Topic: Going away for Xmas
Next Topic: [outdated] How to get TT working under Wine (Linux)
Goto Forum:
  


Current Time: Fri Nov 08 15:40:57 MST 2024

Total time taken to generate the page: 0.01030 seconds