Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » new feature for mods in next scripts.dll, custom scopes
new feature for mods in next scripts.dll, custom scopes [message #146079] Sun, 27 March 2005 18:31 Go to next message
jonwil is currently offline  jonwil
Messages: 3557
Registered: February 2003
Karma: 0
General (3 Stars)

Here is a picture:
http://users.tpgi.com.au/adsloptd/scope.png (the texture is only a test texture, you can do more stuff than that Smile. Thanks to HTMLGOD for the texture used for testing Smile

This feature lets you give every infantry unit in your mod a custom scope. (although because of incompatibilities, you cant have both the standard sniper scope and thie custom scope together)
Scopes are per-unit (as opposed to per-weapon).
There is no real limit on the number of scopes you can have.
It can be used for an old time telescope for an old time mod, a modern day sniper scope for a modern day mod, WW2 era field glasses for a WW2 era mod, futuristic glasses for a futuristic mod or whatever else you want.

Firstly, you create a scope texture for each scope that is square with the width and height a power of 2 (like any other renegade texture). This texture will be "stretched" to fill the screen. Use alpha blending like on the default renegade sniper scope to create the "hole" that you can see through.

Then, you create a scopes.cfg file either in your data folder or in one of the mix files for your mod. This has lines like the following:
scope.tga=Sniper=0.61154997=11.200000
The first part is the texture name (use .tga on the end even if it is a dds file)
The second part is the name of the camera profile to use
The third part is the minumum zoom level to use (how far to zoom out)
The last part is the maximum zoom level to use (how far to zoom in)
These settings shown above (which will be in the documentation) provide an acceptable camera profile (similar to how the default sniper scope works)

At startup, scopes.cfg is read with each scope (i.e. each line) being given a number starting from 0.
Then, in your mod you put the script JFW_Scope on every player-buyable infantry unit in the game (i.e. anything the player could become) passing either the scope number of -1 (for no scope).

If you wish to change scopes at runtime, you can use something like
JFW_Attach_Script_Custom to attach a new copy of JFW_Scope to change the scope.

JFW_Scope sends a message to the client that initalizes the specified scope.

When the "scope" logical key (set in keys.cfg and used via my keyboard hook code), if the scope is not -1 and the player is not in a vehicle, the scope is switched on. Pressing it again switches it off.
Whilst in scope mode, you can use the "zoom" keys (same as with the normal sniper scope) to zoom in and out.
Also, when the scope is enabled, the Next Weapon, Previous Weapon, First Person Toggle and Action keys are disabled. The weapon switch keys are disabled because the mouse wheel is used for both zoom and for switch weapon. The number keys at the top still work to switch weapons.
The First Person Toggle and Action (i.e. PT, ladder, vehicle entry etc) keys are disabled because they change the camera settings which breaks the scope camera logic. (although if you need to use those keys, just switch out of scope mode)


Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
new feature for mods in next scripts.dll, custom scopes [message #146130] Sun, 27 March 2005 23:21 Go to previous messageGo to next message
Chronojam is currently offline  Chronojam
Messages: 688
Registered: March 2003
Karma: 0
Colonel
Scope keys, or mouse wheel too?
new feature for mods in next scripts.dll, custom scopes [message #146131] Sun, 27 March 2005 23:24 Go to previous messageGo to next message
jonwil is currently offline  jonwil
Messages: 3557
Registered: February 2003
Karma: 0
General (3 Stars)

For the disable, any key or mouse action that is assigned to "First Person Toggle", "Action", "Next Weapon" or "Previous Weapon" will be disabled.
For the zoom, any key or mouse action that is assigned to "Zoom" will work.
And for the scope itself, whatever key is assigned to "scope" in keys.cfg will trigger this.


Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
new feature for mods in next scripts.dll, custom scopes [message #146266] Mon, 28 March 2005 16:36 Go to previous messageGo to next message
WNxCABAL is currently offline  WNxCABAL
Messages: 1391
Registered: July 2004
Karma: 0
General (1 Star)
n/m

Warrior Nation Number One Gaming Clan In The World Razz

http://www.tibnas.com/Outbound_Images/wnxcabal_cabalcc3kw_sig_ani.gif
new feature for mods in next scripts.dll, custom scopes [message #146345] Tue, 29 March 2005 01:37 Go to previous messageGo to next message
vloktboky is currently offline  vloktboky
Messages: 290
Registered: February 2003
Location: Kentucky, USA
Karma: 0
Recruit

The settings for the scope are defined in a file. The file is loaded on to the preset through a script. This seems very redundant; it's similar to handing your money to a person to hand it to the cashier when you're checking out. Why not just have the settings defined in the script attached to the preset? Or better yet...

Add a fourth parameter to your config file that defines which preset this scope is to be used with. Have the DLL load all scope files present in either a master file or a folder housing them all, meaning all scope files defined in the master file or placed in the folder will be looked at by the DLL. Then just have the DLL do whatever it needs to do on the preset defined. I know you can do this, and it makes a lot more sense. The end result is any average joe can make their own scope for whatever preset without even having to open up LE or the scripts' source code. It's a lot more practical.

Or at the very least just put the settings as parameters for your script.
new feature for mods in next scripts.dll, custom scopes [message #146377] Tue, 29 March 2005 09:21 Go to previous messageGo to next message
jonwil is currently offline  jonwil
Messages: 3557
Registered: February 2003
Karma: 0
General (3 Stars)

The reason that things are the way they are is that it also allows for the creation of things like "binoculars" powerups that can be collected and that will change the scope.

Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
new feature for mods in next scripts.dll, custom scopes [message #146381] Tue, 29 March 2005 10:15 Go to previous message
vloktboky is currently offline  vloktboky
Messages: 290
Registered: February 2003
Location: Kentucky, USA
Karma: 0
Recruit

So make the change when they pickup the powerup. That doesn't mean their scope can't be set on creation via the method I listed above.
Previous Topic: Change Camera Angle Script Zone?
Next Topic: AI Drop
Goto Forum:
  


Current Time: Sat Sep 21 13:24:03 MST 2024

Total time taken to generate the page: 0.00902 seconds