new feature for mods in next scripts.dll, custom scopes [message #146079] |
Sun, 27 March 2005 18:31 |
|
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 . Thanks to HTMLGOD for the texture used for testing
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 #146131] |
Sun, 27 March 2005 23:24 |
|
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 #146377] |
Tue, 29 March 2005 09:21 |
|
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
|
|
|
|