Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 13 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Finally, rotating hud elems are here [Pros only]
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Monday, Jul. 16, 2012 09:41 pm
[23:22] IzNoGoD: eat poo-poo IW
[23:22] IzNoGoD: i got rotating of hud elems working.

And thats about it right now guys.

No need to manually create a lot of rotated images anymore :)


How-to (quick n dirty):
- You need to have an image that already is in .iwi, preferably square (non-square images get stretched)
- Name it something with exactly 15 letters.
- Create a background for this image, same size as the image used above (also square). Give it a 9 char name.
- Now for the tricky part. Find the material files called "hudstopwatch" and "hudstopwatchneedle" and rename the first one to whatever you like (12 chars though), and rename the second one to exactly the same name, but add "needle" to the end. (so a total of 18 chars)
- Open up both files in some program like notepad++. Scroll to the end of the file, notice the hudstopwatchneedle and stopwatchneedle for the "hudstopwatchneedle" file.
Replace the first of those references with the name of the material file (18 char, ending in needle) and the second with the name of the actual image file that has to be rotated (15 char).
Do the same for the other material file, but remember to use the 12 and 9 char filenames here
- Now put the images and the material files in the appropriate folders
- Take a look at sd.gsc: see that both hudstopwatch and hudstopwatchneedle shaders are being precached.
This means you have to precache both YOUR images too
- Scroll to the following part in sd.gsc:
Code:

showPlayerBombTimer()
{
	timeleft = (level.bombtimer - (getTime() - level.bombtimerstart) / 1000);

	if(timeleft > 0)
	{
		self.bombtimer = newClientHudElem(self);
		self.bombtimer.x = 6;
		self.bombtimer.y = 76;
		self.bombtimer.horzAlign = "left";
		self.bombtimer.vertAlign = "top";
		self.bombtimer setClock(timeleft, level.bombtimer, "hudStopwatch", 48, 48);
	}
}

The most important line here is:
Code:

		self.bombtimer setClock(timeleft, level.bombtimer, "hudStopwatch", 48, 48);

Take a look at the appropriate reference for this function:
http://www.zeroy.com/script/hud/setclock.htm
If you set the full time really high and reset the clock every 0.05 seconds, you can control the angle your image is held under, or just give it a spin with a low total time and let it just go round.

This opens up a LOT of possibilities for modders.

PS: this write-up was done really quick, and should not be made a reference for future generations. If someone has some time to spare and feels like doing a rewrite: please feel free to do so.

For all hungarian readers: if you do not understand a word i said above, please, feel free to NOT contact me about this. You wont understand me then either.

For all dogs reading this: bark bark bark. Good dog.
Share |
kungfooman
General Member
Since: Jun 30, 2012
Posts: 10
Last: Jul 17, 2012
[view latest posts]
Level 0
Category: CoD2 Scripting
Posted: Tuesday, Jul. 17, 2012 09:14 am
Very open-minded solution. Good human! [biggrin]
Share |
pluxy
General Member
Since: Aug 9, 2010
Posts: 21
Last: Oct 27, 2012
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Tuesday, Jul. 17, 2012 04:12 pm
nice idea to solve that!, i'll give it a try later,

Quote:
For all hungarian readers: if you do not understand a word i said above, please, feel free to NOT contact me about this. You wont understand me then either.

For all dogs reading this: bark bark bark. Good dog.


Those lines made my day[lol][crazy]

edited on Jul. 17, 2012 09:12 am by pluxy
Share |
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD2 Scripting
Posted: Tuesday, Jul. 17, 2012 10:57 pm
hack of the year +1!

IzNoDog, great idea!
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Wednesday, Jul. 18, 2012 07:46 am
The only reason for the limitations on filenames is that the assets manager doesnt produce a proper, rotatable material file.

You really need to edit the stock material files, and without much knowledge of those things, you have to keep the amount of characters in both filenames the same.

The "needle" part in those filenames seems hardcoded, as setclock() never requires an additional needle-shader.
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Wednesday, Jul. 18, 2012 12:36 pm
IzNoGoD writes...
Quote:
The only reason for the limitations on filenames is that the assets manager doesnt produce a proper, rotatable material file.

You really need to edit the stock material files, and without much knowledge of those things, you have to keep the amount of characters in both filenames the same.

The "needle" part in those filenames seems hardcoded, as setclock() never requires an additional needle-shader.


It can't be hardcoded if can you can change the materials file name (even if you keep the right number of letters). Hardcoded would mean it would insist on using "hudstopwatchneedle" and nothing else.

What is happening is that you aren't getting the Asset Manager settings right. These can be tricky, it took me a year to find out exactly the right ones for the material file setting for glowing xmodels (using "corona"). In the past I've resorted to hex editing the material file header info to match one IW had made because I couldn't figure out exactly how they had done it. You could try doing the same here:

1. create your custom materials file in the standard way, as a 2d colormap materials, with any number of letters in the name that you like.
2. Open hudstopwatchneedle in a good Hex editor.
3. Also open your new materials file.
4. Now, comparing the 2 together, look at the bit numbers in the header of hudstopwatchneedle and edit the ones in the header of your new materials which are different from those in hudstopwatchneedle.

This will change any setting to match those in hudstopwatchneedle and should give you the ability to create materials with any number of letters in the name but preserve the right Asset Manger settings.

Or, alternatively, you could spend a couple of hours/days/weeks trying different settings in Asset Manager till you stumble on the right combination.

As with everything in this modding lark, it's all trial and error, with most of it being error.

edited on Jul. 18, 2012 05:46 am by Tally
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Wednesday, Jul. 18, 2012 01:14 pm
Or, I could just go with 15/9 chars in the filename and dont waste my time on trying to get it to work with other filenamelengths.
Share |
serthy
General Member
Since: Sep 8, 2010
Posts: 482
Last: Jun 28, 2013
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Wednesday, Jul. 18, 2012 03:35 pm
LOLOLOL THANKS TALLY! :D
Quote:
These can be tricky, it took me a year to find out exactly the right ones for the material file setting for glowing xmodels (using "corona").

Now i got it xD

i created 2 material files a time ago named "hud_indicator" and "hud_indicatorneedle" and it is working as the normal "hudstopwatch" one
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD2 Scripting
Posted: Wednesday, Jul. 18, 2012 08:32 pm
serthy writes...
Quote:
LOLOLOL THANKS TALLY! :D
Quote:
These can be tricky, it took me a year to find out exactly the right ones for the material file setting for glowing xmodels (using "corona").

Now i got it xD

i created 2 material files a time ago named "hud_indicator" and "hud_indicatorneedle" and it is working as the normal "hudstopwatch" one


I was certain it could be done. Perhaps if you shared the Asset Manager settings, IznoGod will be able to take advantage of them?
Share |
serthy
General Member
Since: Sep 8, 2010
Posts: 482
Last: Jun 28, 2013
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Wednesday, Jul. 18, 2012 08:48 pm
huh? it was a simple 2d material with no special settings on it
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»