Jump to content

*zeewolf*

Member
  • Content Count

    187
  • Joined

  • Last visited

  • Medals

Everything posted by *zeewolf*

  1. *zeewolf*

    OFP Addon request thread

    Weird question but does anyone know if the mod name "Modern War Crisis" is already taken? That's the provisional name of a Call Of Duty style total conversion I've made. If it's already taken then how about "Modern Warfare Crisis"? Which would be my second choice. Any other suggestions for a name for the mod?
  2. *zeewolf*

    Dynamic grass script?

    UWAR grass is the only dynamic grass addon I've seen. It's efficient but I'm pretty sure it can't detect roads/buildings when placing grass. The other drawback of using UWAR grass is it's designed for single player missions, the grass is created locally on each machine. So in multiplayer you may be trying hide in a patch of grass that hasn't been spawned on other clients. The main reason the other grass mods like Battletech and I44 grass aren't spawned dynamically is that they are designed to be used as tiles rather than small organic looking patches. Any spawning script would also have to tile them properly and apply translations to avoid overlapping roads while keeping the edge of the grass as close to the road as possible. The noddy solution that I've been using is to spend the time to cover large areas of an island in grass tiles, with all of the roads done properly. Then save that as a template mission and merge it into other missions you make when you want to add grass to an area. So I have for example Houdan Template.Abel, Montignac Template.Eden etc. which cover a couple of square kilometers with grass centred around a given town. It depends on the size of the mission you are making for this to be practical.
  3. *zeewolf*

    Multiple Session Gamemode

    My demo wasn't supposed to be comprehensive, just a proof of concept to get you going. SOW2 is probably overkill for what you need but if you like using sledgehammers to crack walnuts then it will do the job. To add support for launchers to it just add another set of database arrays e.g. SecondaryWeaponDB = ["","LAWLauncher","RPGLauncher","CarlgustavLauncher","AT4Launcher","WW4_JavelinLauncher"] SecondaryMagazineDB = ["","LAWLauncher","RPGLauncher","CarlgustavLauncher","AT4Launcher","WW4_JavelinLauncherMag"] You only need a separate magazine database if you know your launcher uses a magazine classname that is different from the weapon classname. In the code example above its only needed to support the WW4 javelin launcher. In your saving script to detect what launcher the player has use secondaryweapon. Then search the database in the same way as in my example of saving a primary weapon. For pistols you add another database e.g. SidearmDB = ["Beretta","Tokarev","CZ75","Revolver","Ingram","Skorpion"] SidearmMagazineDB = ["BerettaMag","TokarevMag","CZ75Mag","RevolverMag","IngramMag","SkorpionMag"] Detecting what pistol the player has is slightly more difficult, you need to use weapons to get an array of all the player's weapons then remove the player's primaryweapon and secondaryweapon to leave you with just the pistol. Ancillary equipment like hand grenades are harder still. You could use a seperate variable to store the quantity of each piece of ancillary equipment the player could possibly have. E.g. PlayerHandGrenades, PlayerSmokeGrenades, PlayerFlares etc etc. But this is very wasteful, a more efficient way is to pack multiple values into a single SOW saved value then unpack them when you load. A single SOW1 entry can store an integer in the range 0 to 999998, or 19 bit words if you like thinking in binary (as I do). So you could store 19 bool values in a single variable or perhaps four numbers between 0 and 16. Hopefully you see where I'm going with this... MWC uses this principle to reduce the number of stored values from 652 to 74.
  4. *zeewolf*

    Multiplayer Death Cam

    You don't need anything to stay in first person view of the dead player you just have: ~30 enableEndDialog In the onPlayerKilled script with nothing else. To look left and right you need to enable freelook (* on numpad by default), you can't move the camera without freelook because your characters dead and can't move. If you want the first person view of another unit then use switchcamera to switch to them. If you want third person views them it's better to create a camera and manipulate it through standard camera commands.
  5. *zeewolf*

    Multiplayer Death Cam

    Well, I can't break it. Tested it in 1.96 and 1.99 as a single player mission. Here's the mission for what it's worth. The further up the script you move enableEndDialog the sooner it should appear. There doesn't appear to be another way to end the mission once the player is dead in single player.
  6. *zeewolf*

    Multiplayer Death Cam

    enableEndDialog (if you scroll down in the code above it's the last line). That is what causes the Retry dialog to appear and effectively ends the mission from a user input standpoint. Just change ~10 to ~30 or whatever for more time, alternatively you could use some other condition based on what's going on in the mission e.g. @!(alive someOtherBloke).
  7. *zeewolf*

    Multiple Session Gamemode

    My current project is briefly described at the end of this thread. It's now in closed beta testing. I will create a addon discussion thread when I'm ready to start working on the public release. Until then, if you or anyone else have questions about it, for the sake of politeness please post in that thread rather than this one as I hate thread-jacking. Yes, Sinews of war has restrictions but there is also a lot of room for expansion considering v1.0 only uses one parameter of the saved object (damage). But you'd need to dig around in the V2.0 demo or experiment yourself to learn more. Oh and you need to get a better translator I can barely understand what you're saying.
  8. *zeewolf*

    Multiplayer Death Cam

    I'm confused. Are you making a multiplayer mission with only one player in it or a true single player mission? (If the latter why is this thread called multiplayer death cam?) If you're making a singleplayer mission you just need to override the default event script onPlayerKilled.sqs with your own. Note that you cannot look around freely and have the "Retry", "End" dialog on the screen at the same time. You need to decide at what point to display the "Retry" dialog bars because the player will have no way of exiting the mission until it is shown and no way to move the camera after it is shown. Here is an example single player script, it needs to be named onPlayerKilled.sqs and placed in your mission folder: _unit = _this select 0 _killer = _this select 1 _pos = getpos _unit _pos set[2,80] _seagull = "seagull" camcreate _pos _camera = "camera" camCreate [0,0,0] _camera cameraEffect ["internal","back"] _camera camSetTarget _unit _camera camSetRelPos [2.71,19.55,12.94] _camera camCommit 0 @camCommitted _camera _camera camSetTarget _seagull _camera camSetRelPos [-6.66,18.99,2.59] _camera camSetFOV 0.700 _camera camCommit 3 @camCommitted _camera _camera camSetRelPos [1.17,-21.71,-1.07] _camera camSetFOV 0.070 _camera camCommit 3 @camCommitted _camera _seagull switchCamera "external" _seagull cameraEffect ["terminate","back"] _seagull camCommit 0 @camCommitted _seagull camdestroy _camera _seagull camcommand "manual on" ~10 enableEndDialog It gives the player control of a seagull for 10 seconds to have a look around then displays the Retry dialog which prevents further camera movement. Alternatively you can use switchcamera to get the view of another unit (e.g for a first person kill cam). Or create a standard camera object and give manual control of its position (camcommand "manual on"). In multiplayer the situation is different depending on the type of respawn you have selected in description.ext. onPlayerKilled.sqs is executed if you die permanently (respawn = "NONE"/0), onPlayerRespawnAsSeagull.sqs for seagull mode (respawn = "BIRD"/1) or onPlayerRespawnAsOtherUnit.sqs when you spawn into a teammate (respawn = "GROUP"/4). For unlimited respawning modes ("INSTANT"/2 or "BASE"/3) no script will be executed, instead you need to use a killed eventhandler to detect the player's death which performs whatever camera manipulations you want (usually during the respawnDelay period) before terminating back to the respawned player unit.
  9. *zeewolf*

    Multiple Session Gamemode

    Ok here's a quick demo of saving position, direction, primary weapon and primary magazines using sinews of war v1.0. Pick a gun from the gear list in the briefing use the action menu to save and load. It's set up for client side saving so the data is saved and loaded from the player's object.sav file, no publicvariables needed because the data is already where it needs to be for any locality sensitive functions. My current project (I won't take the piss by namedropping in someone else's thread) takes this system to the extreme by saving the weapon attachments (optics and barrel mounted accessories) purchased by a player in a create-a-class mission then loading them for use in other multiplayer missions. This provides up to 72 possible attachment combinations per gun.
  10. *zeewolf*

    Multiple Session Gamemode

    Going back on topic for a minute, the things I would save in some kind of dynamic RPG style mission (which is what I think you are doing here) would be: Player's last position (doesn't actually need to be exact if you use a safehouse mechanic where the player spawns at the nearest safehouse to their last position). Player's inventory (rather than saving strings for object class names why not assign each class a serial number which can be looked up in an array/database of classnames, this allows you to just save integers). Player's quest status (a list of currently active quests, again these could reference a quest database maintained by the server). Player experience and level Regarding Sinews of War, the basic SOW 1.0 uses savestatus to store an unsigned integer in the damage property of a game logic, there are utility scripts included to convert other data types (bools, reals and signed ints) to saveable unsigned integers. In multiplayer all missions load and save object status to the same raP file (Users\ProfileName\Save\Tmp\Object.sav) which means the same variables can be accessed by multiple missions. SOW 2.0 is far more advanced. As well as exploiting save/loadIdentity has an entire dialog framework to manage player status and equipment as well as handle all the client/server synchronisation. SOW 1.0 is very easy to learn and use and is ideal if you're just interested in a saving/loading function, you can adjust it to client or server side saving fairly easily. If you want a ready built framework and dialogs for persistent multiplayer missions then SOW 2.0 is available.
  11. *zeewolf*

    Multiple Session Gamemode

    Why don't you use Sinews Of War saving? It doesn't need Fwatch and can be tweaked to save client or server side depending on where the data is needed. You can get the full demo over at the SOW site. Or the basic version is present in kutya's GDCE or my recent Combat Mission demo. Personally I prefer client side saving for most character stuff because you don't have to transmit variables used by locality sensitive functions from the server using publicvariable (which will take an age to do with a reasonable number of players), you just load them into global variables on the client and setup the character using a client side script. The other massive advantage of client side saving is that you can play multiple sessions on different servers that are running the same mission. The player's PC effectively holds a profile of their progress which can be used on different servers and missions.
  12. *zeewolf*

    Battletech Grass pack new version

    There is no script, use the template missions provided to copy and paste tiles to your island. Depending on the island you may not be able to completely cover it without dropping frame rate. It also depends on what you're doing, flying in a jet at low level is going to put a lot more strain on your machine than plodding about on foot. Another way to optimise is to not use grass in forests (since real forests wouldn't have grass as thick as that found in a meadow) and use the low detail tiles in less frequented areas to cut down on the number of textures drawn by the engine. I suppose you could script a client to automatically create and delete grass depending on the player's current position but this would need a massive database of the positions of all the grass tiles on the island. The grass is also going to cover roads unless you manually cut it back using the alternative shapes (quadrants, triangles etc). Obviously this is very time consuming but once you've done a template for an island (or a portion of an island) you can save it as a mission and merge it into another mission using the editor whenever you need it. For multiplayer you should try to limit the grass to the mission area to keep lag down as shown in the included king of the hill demo mission.
  13. *zeewolf*

    Predator UAV camera and missiles

    Demo mission (multiupload) Just a single player mission that I made in about 5 minutes, but it's got the predator, reaper and two versions of the AC-130 script in it and some people to fire them at. There are two versions of the mission, one calls the laptop closing animation which is held in the included mwc_anims.pbo. If you don't care about having the laptop animation then use the mission in the no addons folder. Call the scripts using the radio, click on the map when prompted to set the position the camera will orbit. I've also included sounds for the AC-130 weapons. The glued AC130 is linked to the cessna that's droning around the village so if you want to control that just edit its waypoints. I'm not doing a demo for the multiplayer killstreak versions of these right now, it'll take me too long to disentangle it from MWC's other scripts and addons and I'd rather spend the time working on the main framework and templates. EDIT: Updated demo mission with fix for glued AC130 script (camera stuck at 100m AGL, not passed flyInHeight), fixed predator missile boost mode resetting target
  14. I just put together a script for a Predator UAV simulation that I was thinking of using as a killstreak in MP missions. It's a fun MW2 style orbiting camera with TV guided missile that you can steer with the arrow keys. This is purely a virtual unit using camera calculations to perform the simulation. Supply a position to the script, the camera will switch to a UAV which will orbit the position, during this time the player can slew the camera around a bit using "move forward", "move backward", "move left" and "move right". To fire a TV guided missile press V. The camera will then switch to a seeker head view while you guide it using the same control scheme. If the player doesn't fire a missile within one minute the script exits. _pos = _this select 0 _removeGogs = false ?((Daytime < 17) and (Daytime > 7)) : goto "start" ?!(player hasweapon "NVGoggles"): _removeGogs = true; player removeweapon "NVGoggles" player addweapon "NVGoggles" player action["NVGoggles"] #start _theta = random 360 _r = 900 _phi = (random 30) + 45 _vel = 6 _rx = _r * (sin _theta) * (cos _phi) _ry = _r * (cos _theta) * (cos _phi) _rz = _r * (sin _phi) _camera = "camera" camCreate [(_pos select 0) + _rx, (_pos select 1) + _ry, _rz] _camera cameraEffect ["internal","back"] _camera camSetTarget _pos _camera camSetFOV 0.1 _camera camCommit 0 @camCommitted _camera _campos = GetPos _camera _timeout = _time + 60 _direction = 1 ?(random 2 > 1) : _direction = -1 _tx = _pos select 0 _ty = _pos select 1 #orbit _theta = _theta + (_direction * 0.0688) _theta = _theta mod 360 _rx = _r * (sin _theta) * (cos _phi) _ry = _r * (cos _theta) * (cos _phi) _camera camSetPos [(_pos select 0) + _rx, (_pos select 1) + _ry, _rz] _camera camSetTarget [_tx,_ty,0] _camera camcommit 0 @camCommitted _camera _camera camCommand "Manual on" _campos = getpos _camera ~0.02 ?(_camera != _camera) : titletext["","BLACK OUT",0.04]; goto "fire" _camera camCommand "Manual off" _cx = 15*((getpos _camera select 0)-(_campos select 0)) _cy = 15*((getpos _camera select 1)-(_campos select 1)) _tx = _tx + _cx _ty = _ty + _cy ?(_timeout > _time) : goto "orbit" ?(_removeGogs) : player removeweapon "NVGoggles" _camera camCommand "Manual on" _camera cameraEffect ["Terminate","back"] _camera camcommit 0 @camcommitted _camera camDestroy _camera exit #fire titletext["","BLACK IN",10]; ~0.1 _pos = [_tx,_ty,0] ?(alive _camera): camDestroy _camera _camera = "camera" camcreate _campos _camera cameraEffect ["internal","back"] _camera camSetTarget _pos _camera camSetFOV 0.7 _camera camCommit 0 titletext["","BLACK IN",0.1]; @camcommitted _camera _vx = _vel * (cos _phi) * -(sin _theta) _vy = _vel * (cos _phi) * -(cos _theta) _vz = _vel * (sin _phi) #approach _rz = _rz - _vz _camera camsetpos [(_campos select 0) + _vx,(_campos select 1) + _vy,_rz] _camera camSetTarget _pos _camera camCommit 0 @camCommitted _camera _rx = (_campos select 0)-(_pos select 0) _ry = (_campos select 1)-(_pos select 1) _phi = ((_campos select 2) atan2 (sqrt((_rx^2)+(_ry^2)))) _theta = _rx atan2 _ry _campos = GetPos _camera _camera camCommand "Manual on" ~0.02 _cx = 15*((getpos _camera select 0)-(_campos select 0)) _cy = 15*((getpos _camera select 1)-(_campos select 1)) _pos set[0,(_pos select 0) + _cx] _pos set[1,(_pos select 1) + _cy] _camera camCommand "Manual off" _vx = _vel * (cos _phi) * - (sin _theta) _vy = _vel * (cos _phi) * - (cos _theta) _vz = _vel * (sin _phi) ?((getpos _camera select 2) > 1) : goto "approach" ?(_removeGogs) : player removeweapon "NVGoggles" _camera camCommand "Manual on" _camera cameraEffect ["Terminate","back"] _camera camcommit 0 @camcommitted _camera camDestroy _camera _bang = "maverick" createvehicle [_pos select 0, _pos select 1,0] I may add some on screen titletext info like heading, AGL and time to impact etc I'd like to add a missile smoke trail which follows the camera. Anyone got a particle array that might be suitable? Also is it possible to create a laptop opening/closing animation in the style of the game main menu that would be run before the camera switches to the UAV and when the camera switches back to the player? I believe it may be possible to make an AC-130 script in a similar fashion (providing keys to switch weapons is a bit convoluted a dialog may be necessary). Oh and yes, I do know that this is all completely unrealistic... "ENEMY PREDATOR MISSILE INCOMING!!!!!"
  15. *zeewolf*

    Predator UAV camera and missiles

    So I've put your particle array to good use (there's a bug in your .sqf listing by the way, in the particle array _randpos should be _rdpos and _rdpos should be calculated as (random 2) - 1). Here's a script for MW3's "Reaper" strike chain reward. As usual, move forward, backward, left, right pans the camera; but now move up or V cycles the FOV/zoom level, move down fires a "missile" which can be guided to the target by moving the crosshairs around after launch. You get fourteen missiles and one minute to launch them. _pos = getpos player ; Cutrsc for opening laptop ;cutrsc["RscLaptopOpen","PLAIN"] ; Setup ammo _missiles = 14 _missileStatus = "| | | | | | | | | | | | | |" ; Set velocity (300m/s) _vel = 6 ; Setup zoom levels _currentFOV = 2 _zooms = [0.7,0.4,0.1,0.05] _panGain = [60,30,10,5] ; setup Night vision _removeGogs = false ?((Daytime < 17) and (Daytime > 7)) : goto "start" ?!(player hasweapon "NVGoggles"): _removeGogs = true; player removeweapon "NVGoggles" player addweapon "NVGoggles" player action["NVGoggles"] #start ~0.5 ; calculate random azimuth _theta = random 360 ; set radius (500m for MP purposes) _r = 500 ; set polar angle _phi = (random 30) + 45 ; calculate initial cartesian position _rx = _r * (sin _theta) * (cos _phi) _ry = _r * (cos _theta) * (cos _phi) _rz = _r * (sin _phi) ; clear laptop cutrsc cutrsc["Default","PLAIN"] ; create the camera _camera = "camera" camCreate [(_pos select 0) + _rx, (_pos select 1) + _ry, _rz] _camera cameraEffect ["internal","back"] _camera camSetTarget _pos _camera camSetFOV 0.1 _camera camCommit 0 @camCommitted _camera _campos = getPos _camera ; set one minute timer _timeout = _time + 60 ; set random orbit direction _direction = 1 ?(random 2 > 1) : _direction = -1 ; set initial camera target _tx = _pos select 0 _ty = _pos select 1 ; initialise frame counter _i = 0 #orbit ; update azimuth _theta = _theta + (_direction * 0.0688) _theta = _theta mod 360 ; update cartesian position _rx = _r * (sin _theta) * (cos _phi) _ry = _r * (cos _theta) * (cos _phi) ; update camera _camera camSetPos [(_pos select 0) + _rx, (_pos select 1) + _ry, _rz] _camera camSetTarget [_tx,_ty,0] _camera camSetFOV (_zooms select _currentFOV) _camera camcommit 0 @camCommitted _camera ; set camera to manual until next frame _camera camCommand "Manual on" ; save current position _campos = getpos _camera ; wait for next frame ~0.02 ; increment frame counter _i = _i + 1 ; display status every ten frames ?(_i == 10): _i = 0; titletext[Format["\nHeading: %1 %2 %3\nAGL: %4 ", (direction _camera) - (direction _camera mod 1),_missileStatus, (_timeout - _time),_campos select 2],"PLAIN DOWN",0.05] ; detect user pressing V ?(_camera != _camera):camdestroy _camera;_ret = "orbit"; goto "zoom" ; turn manual mode off _camera camCommand "Manual off" ; calculate change in camera position due to user input _cx = (_panGain select _currentFOV)*((getpos _camera select 0)-(_campos select 0)) _cy = (_panGain select _currentFOV)*((getpos _camera select 1)-(_campos select 1)) _cz = (getpos _camera select 2)-(_campos select 2) ; update target position _tx = _tx + _cx _ty = _ty + _cy ; calculate change in height due to user input ?((_cz < -0.05) and (_cx == 0) and (_cy == 0)): goto "fire" ?((_cz > 0.05) and (_cx == 0) and (_cy == 0)): _ret = "orbit"; goto "zoom" ; check for timeout and player death ?((_timeout > _time) and (alive player)) : goto "orbit" ; reset nightvision ?(_removeGogs) : player removeweapon "NVGoggles" ; terminate and destroy camera _camera cameraEffect ["Terminate","back"] _camera camcommit 0 @camcommitted _camera camDestroy _camera ; Laptop close animation requires custom reversed .rtm ;cutrsc["RscLaptopClose","PLAIN"] ~0.5 ; clear laptop cutrsc cutrsc["Default","PLAIN"] exit #fire ; update ammo status display _i = 0 _missileStatus = "" _missiles = _missiles - 1 ?(_missiles == 0): _missileStatus = " "; goto "calculateShot" #updateStatus1 _missileStatus = format["%1| ",_missileStatus] _i = _i + 1 ?(_i < _missiles): goto "updateStatus1" #updateStatus2 _missileStatus = format["%1 ",_missileStatus] _i = _i + 1 ?(_i < 14): goto "updateStatus2" #calculateShot ; calculate azimuth and polar angle for missile _mphi = (_campos select 2) atan2 _distance _mtheta = _rx atan2 _ry ; calculate velocity vector for missile _vx = _vel * (cos _mphi) * -(sin _mtheta) _vy = _vel * (cos _mphi) * -(cos _mtheta) _vz = _vel * (sin _mphi) ; calculate distance to target _dx = (_campos select 0)-_tx _dy = (_campos select 1)-_ty ; set initial missile position _mx = _campos select 0 _my = _campos select 1 _mz = _campos select 2 ; reset frame counter _i = 0 #home ; update camera _camera camSetPos [(_pos select 0) + _rx, (_pos select 1) + _ry, _rz] _camera camSetTarget [_tx,_ty,0] _camera camCommit 0 @camCommitted _camera ; update camera azimuth _theta = _theta + (_direction * 0.0688) _theta = _theta mod 360 ; update camera position _rx = _r * (sin _theta) * (cos _phi) _ry = _r * (cos _theta) * (cos _phi) ; save camera position _campos = GetPos _camera ; set manual mode to detect user input _camera camCommand "Manual on" ; update distance to target _dx = _mx-_tx _dy = _my-_ty _distance = (sqrt((_dx^2)+(_dy^2))) ; update missile azimuth and polar angle _mphi = _mz atan2 _distance _mtheta = _dx atan2 _dy ; update missile velocity vector _vx = _vel * (cos _mphi) * - (sin _mtheta) _vy = _vel * (cos _mphi) * - (cos _mtheta) _vz = _vel * (sin _mphi) ; update missile position _mx = _mx + _vx _my = _my + _vy _mz = _mz - _vz ; create Nikiller missile smoke drop ["cl_basic","","Billboard",10,random(3)+3,[_mx,_my+(random 2)-1,_mz],[(random 3)-1.5,(random 3)-1.5,(random 3)-1.5],0,1.22,1,0.2,[1,5],[[0.95,0.95,0.95, 0.15],[0.95,0.95, 0.95,0]],[0],0.75,0.5,"","",""]; ~0.02 ; increment frame counter _i = _i + 1 ; update status display every ten frames ?(_i == 10): _i = 0; titletext[Format["\nHeading: %1 %2 %3\nAGL: %4 %5 ", (direction _camera) - (direction _camera mod 1),_missileStatus, (_timeout - _time),_campos select 2,_mz],"PLAIN DOWN",0.05] ; detect change in camera position due to user input _cx = (_panGain select _currentFOV)*((getpos _camera select 0)-(_campos select 0)) _cy = (_panGain select _currentFOV)*((getpos _camera select 1)-(_campos select 1)) _cz = (getpos _camera select 2)-(_campos select 2) ; update camera target _tx = _tx + _cx _ty = _ty + _cy ; detect change in camera height due to user input ?((_cz > 0.05) and (_cx == 0) and (_cy == 0)): _ret = "home"; goto "zoom" ?(_camera != _camera):camdestroy _camera;_ret = "home"; goto "zoom" ; switch manual mode off _camera camCommand "Manual off" ; loop until missile hits ground ?(_mz > 1) : goto "home" ; spawn warhead _bang = "maverick" createvehicle [_tx, _ty,0] ; if ammo remaining continue orbit ?(_missiles > 0): goto "orbit" ; reset nightvision ?(_removeGogs) : player removeweapon "NVGoggles" ; terminate and destroy camera _camera cameraEffect ["Terminate","back"] _camera camcommit 0 @camcommitted _camera camDestroy _camera ; laptop close animation requires custom .rtm ;cutrsc["RscLaptopClose","PLAIN"] ~0.5 ; clear laptop cutrsc cutrsc["Default","PLAIN"] exit #zoom ; update FOV selection _currentFOV = _currentFOV + 1 ; clip FOV selection ?(_currentFOV == count _zooms): _currentFOV = 0 ; black out camera titletext["","BLACK IN",10]; ; destroy old camera camdestroy _camera ; create a new camera _camera = "camera" camcreate _campos _camera cameraEffect ["internal","back"] _camera camSetTarget _pos _camera camSetFOV (_zooms select _currentFOV) _camera camCommit 0 @camcommitted _camera ~0.1 ; black back in titletext["","BLACK IN",0.1] ; return to caller goto _ret I'm sure you'll agree the missile smoke looks very nice, trouble is there is no solid object in front of it. I don't want to spawn a real missile or shell on the front of it and move it around or apply relative acceleration, because the whole purpose of this style of scripting is to cut down on bandwidth intensive commands like setpos and setvelocity. Any ideas on a way to put a solid looking object on the front of the smoke trail without broadcasting its position to other clients? If I create an object with camcreate do updates applied by setpos commands applied to it get broadcast to other clients even though it's a local object?
  16. Try this classic script Put the weapon_respawn.xsqs script in your mission folder (I also suggest changing the extension back to .sqs while you're at it). In your init.sqs script or the init line of the unit in the editor put: [Name of unit,1] exec "weapon_respawn.xsqs", where Name is what you've put in the unit's Name field in the editor. The second argument can be 0 or 1. 0 means the unit gets the weapons and magazines they had when the mission started, 1 means they get the weapons/magazines they had when they died. E.g. ["W1",1] exec "weapon_respawn.xsqs". For the unit named W1.
  17. *zeewolf*

    AC-130 camera script

    Well... There are a number of limitations if you try to attach the camera to the object. The main problem is the script relies on the camera height being kept almost constant from one frame to another. If you tie the height of the camera to the height of the plane then it will falsely trigger the weapon selection and firing. Fortunately there is a solution which will work for single player (and multiplayer as long as the pilot is AI), since the AI pilots always fly at or very near their set FlyInHeight (default 100) then the script can simply glue to their X and Y positions while following their ideal AGL flight path. Usage for this "glued" version is [plane,plane width, plane flyInHeight] exec "ac130glued.sqs". So for an example mission set an AI cessna named plane flying in a loose circle anti-clockwise around a village (six cycled waypoints should do). Then add a radio trigger with [plane,3,100] exec "ac130glued.sqs". For larger planes you'll need to adjust the width setting so that the camera remains "outside" of the aircraft. ; AC-130 Glue script ; move forward/move backward/move left/move right pans camera ; move up changes weapon (105mm M102, 40mm Bofors L/60, 25mm GAU-12) ; move down fires weapon ; plane to tie camera to _plane = _this select 0 ; distance from centre of plane to place camera _planeWidth = _this select 1 ; flyinheight of the plane _planeFlyInHeight = _this select 2 ; sea level reference for manual ASL calculation _sealevelref = "logic" camcreate [0,0,0] ; selected weapon number _currentWeapon = 0 ; on screen weapon names _weaponNames = ["105mm","40mm","25mm"] ; sound class names defined by descrition.ext or config cfgSounds _sounds = ["m102","bofors","gau12"] ; cfgammo class names _weaponClasses = ["shell125","shell73","Bullet4x23"] ; FOVs _zoom = [0.4,0.15,0.05] ; Pan/tilt sensitivity to compensate for change in FOV _panGain = [60,30,15] ; muzzle velocities in m/s _MuzzleVelocity = [737,881,1040] ; time between bursts/seconds _BurstReloadTime = [5,4,3] ; timers for weapon burst cooldown _BurstReload = [0,0,0] ; rounds per burst _burst = [1,4,20] ; rounds left in burst _roundsLeft = [1,4,20] ; time between shots in a burst _ReloadTime = [0,0.5,0.15] ; timers for reloading _reload = [0,0,0] ; dead time timer for switching weapon _switchDeadTime = 0 ; on screen weapon status _reloading = " " ; Laptop opening animation defined by description.ext ;cutrsc["RscLaptopOpen","PLAIN"] ; remember if the player had NVGs _removeGogs = false ?((Daytime < 17) and (Daytime > 7)) : goto "start" ; night time, force night vision by giving player goggles ?!(player hasweapon "NVGoggles"): _removeGogs = true; player removeweapon "NVGoggles" player addweapon "NVGoggles" player action["NVGoggles"] #start ~0.5 ; distance to initial target _r = 500 ; get plane position and direction _direction = getdir _plane _campos = [(getpos _plane select 0) + (_planeWidth * sin (_direction - 90)),(getpos _plane select 1) + (_planeWidth * cos (_direction - 90)),_planeFlyInHeight] ; set target position _pos = [(_campos select 0) + (_r*sin (_direction - 90)),(_campos select 1)+(_r*cos (_direction-90)),0] ; target marker for manual ASL calculation _target = "logic" camcreate _pos ; setup camera _camera = "camera" camCreate _campos _camera cameraEffect ["internal","back"] _camera camSetTarget _pos _camera camSetFOV 0.7 _camera camCommit 0 @camCommitted _camera ; remove laptop cutrsc cutrsc["Default","PLAIN"] _campos = GetPos _camera ; time on station _timeout = _time + 40 ; camera target coordinates _tx = _pos select 0 _ty = _pos select 1 ; frame counter for on screen text _i = 0 #orbit ; if weapon burst cooldown time over, reset burst counter and update on screen status ?((_roundsLeft select _currentWeapon == 0) and (_BurstReload select _currentWeapon < _time)): _roundsLeft set[_currentWeapon, _burst select _currentWeapon]; _reloading = " " ; calculate new positions _direction = getdir _plane _campos = [(getpos _plane select 0) + (_planeWidth * sin (_direction - 90)),(getpos _plane select 1) + (_planeWidth * cos (_direction - 90)),_planeFlyInHeight] _pos = [(_campos select 0) + (_r*sin (_direction - 90)),(_campos select 1)+(_r*cos (_direction-90)),0] ; update camera position _camera camSetPos _campos ; update camera target _camera camSetTarget [_tx,_ty,0] ; update FOV _camera camsetFOV (_zoom select _currentWeapon) _camera camcommit 0 @camCommitted _camera ; switch to manual _camera camCommand "Manual on" ; wait for next frame _campos = getpos _camera ~0.02 ; increment frame counter _i = _i + 1 ; display on screen text every ten frames ?(_i == 10): _i = 0; titletext[Format["\n%1 %2 %3\nAGL: %4 %5", _WeaponNames select _currentWeapon,_reloading,(_timeout - _time),getpos plane select 2],"PLAIN DOWN",0.05] ; detect if V pressed (camera killed), if so, restart ?(_camera != _camera): goto "restart" ; switch manual mode off _camera camCommand "Manual off" ; check for changes in camera position due to user input _cx = (_panGain select _currentWeapon)*((getpos _camera select 0)-(_campos select 0)) _cy = (_panGain select _currentWeapon)*((getpos _camera select 1)-(_campos select 1)) _cz = ((getpos _camera select 2)-(_campos select 2)) ; calculate distance of camera target to orbit datum _rx = (_pos select 0)-(_tx+_cx) _ry = (_pos select 1)-(_ty+_cy) _distance = sqrt((_rx^2)+(_ry^2)) ; limit pan and tilt of camera ?(_distance < 300): _tx = _tx + _cx; _ty = _ty + _cy ?(_distance > 350): titletext["","BLACK IN",0.1]; _tx = _pos select 0; _ty = _pos select 1 ; check for increase in camera AGL due to "move up" pressed ?((_cz > 0.05) and (_switchDeadTime < _time) and (_cx == 0) and (_cy == 0)): goto "switchWeapon" ; check for decrease in camera AGL due to "move down" pressed ?((_cz < -0.1) and (_cx == 0) and (_cy == 0)): goto "fire" ?((_timeout > _time) and (alive player) and (alive plane)) : goto "orbit" #end ; if player didn't have goggles remove them ?(_removeGogs) : player removeweapon "NVGoggles" _camera cameraEffect ["Terminate","back"] _camera camcommit 0 @camcommitted _camera camDestroy _camera ; Laptop closing animation defined in description.ext, requires custom .rtm file ;cutrsc["RscLaptopClose","PLAIN"] ~0.5 ; destroy local objects cutrsc["Default","PLAIN"] camdestroy _sealevelref camdestroy _target exit #switchWeapon _currentWeapon = _currentWeapon + 1 ; clip index ?(_currentWeapon == 3): _currentWeapon = 0 ; set deadtime timer _switchDeadTime = _time + 0.5 ; update on screen status _reloading = " " ?((_roundsLeft select _currentWeapon == 0) or (_time < _reload select _currentWeapon)): _reloading = "RELOADING" goto "orbit" #fire ; check if any rounds are left in the gun ?((_roundsLeft select _currentWeapon == 0) or (_time < _reload select _currentWeapon)): goto "orbit" ; update target position _target setpos [_tx,_ty,0] _reloading = " " ; set the reload timer (time between shots) _reload set[_currentWeapon, _time + (_ReloadTime select _currentWeapon)] ; decrement rounds left in burst _roundsLeft set[_currentWeapon,(_roundsLeft select _currentWeapon) - 1] ; calculate ASL (manually for v1.96 compatiblility) _distance = _camera distance _sealevelref _cameraHeight = sqrt((_distance^2) - (((_campos select 0)^2) + ((_campos select 1)^2))) _distance = _target distance _sealevelref _targetHeight = sqrt((_distance^2) - ((_tx^2) + (_ty^2))) ; calculate distance to target _rx = (_campos select 0)-_tx _ry = (_campos select 1)-_ty _distance = (sqrt((_rx^2)+(_ry^2))) ; calculate polar angle of target to camera _gunPhi = ((_cameraHeight - _targetHeight) atan2 _distance) ; calculate azimuth of target to camera _gunTheta = _rx atan2 _ry ; calculate velocity vector _vx = (_MuzzleVelocity select _currentWeapon)*(cos _gunPhi)*-(sin _gunTheta) _vy = (_MuzzleVelocity select _currentWeapon)*(cos _gunPhi)*-(cos _gunTheta) _vz = (_MuzzleVelocity select _currentWeapon)*-(sin _gunPhi) ; spawn round _round = (_WeaponClasses select _currentWeapon) createvehicle _campos ; "fire" the round _round setdir _gunTheta _round setvelocity [_vx,_vy,_vz] ; play the weapon sound ;playsound (_sounds select _currentWeapon) ; check burst status ?(_roundsLeft select _currentWeapon != 0): goto "orbit" ; burst completed update on screen status and set cooldown timer _reloading = "RELOADING" _BurstReload set[_currentWeapon, _time + (_BurstReloadTime select _currentWeapon)] goto "orbit" #restart titletext["","BLACK IN",10]; ~0.1 titletext["","BLACK IN",0.1]; ?(alive _camera): camDestroy _camera _camera = "camera" camCreate _campos _camera cameraEffect ["internal","back"] _camera camSetTarget [_tx,_ty,0] _camera camsetFOV (_zoom select _currentWeapon) _camera camcommit 0 @camcommitted _camera goto "orbit" You can see how closely the plane sticks to it's flyinheight from the AGL display. A human pilot would need to do the same for this version of the script to work on a player piloted aircraft. I wrote this version in about two hours so consider it a fudge. There are many ways it could be enhanced, for example; using the aircraft's bank angle to set the target position and running the plane's height through a low pass filter, then use the filtered version of the height to glue the camera to the plane. Addendum: I forgot to mention about muzzle velocities. Since the script does not compensate for bullet drop, using a (realistic) muzzle velocity of 472ms-1 (as done in the version shown in the first post) you will find the howitzer requires significant adjustment when attacking targets. To eliminate this, increase it to something like 700ms-1. Also, the 40mm really needs a custom cfgAmmo entry, since the 73mm heat round is over-powered and doesn't provide tracers (I think the real gun uses 40mm HEI-T).
  18. *zeewolf*

    AC-130 camera script

    The script is designed to be used as a multiplayer killstreak reward but it will work in single player, the main things you may want to change are the 40 second time limit (_timeout = _time + 40) and the weapon burst limits (_burst). If you're planning on recreating a certain classic COD4 mission then you'll also need to create a method of moving the position that the camera orbits in response to the player's progress, the easiest way to do this would be to make _pos global and move it around (very slowly) using a second script. As I mentioned above, you could also replace the orbit spherical coordinate code with code to "attach" the camera to the side of an aircraft which is controlled with standard waypoints. If you're thinking of adding audio commentary then that too would best be done by a second script. For a quick test just call the script using a trigger from the mission editor. It depends on where you want the camera to orbit when it spawns. If you just want it to orbit the player's position then call it with [getpos player] exec "ac130.sqs" (assuming you save the script as ac130.sqs in the mission folder). Alternatively you can use the map to specify the orbit position by calling it from a second script and adding OnMapSingleClick{} to the first line of the ac130 script. ; request_ac130.sqs [side player,"AIRBASE"] sidechat "AC-130 ready for deployment." ~1 [side player,"AIRBASE"] sidechat "Click on map to provide coordinates." onMapSingleClick {[_pos] exec "ac130.sqs"} The request script could be then called from a radio trigger. For example (as it would appear in mission.sqm): class Sensors { items=1; class Item0 { position[]={6144.855469,178.128052,9559.442383}; a=0.000000; b=0.000000; activationBy="JULIET"; repeating=1; age="UNKNOWN"; text="Request AC130"; expActiv="[] exec ""request_ac130.sqs"""; class Effects { }; }; }; As I've mentioned before, if I do release an example of this it will be part of the much larger killstreak/create-a-class framework I've been working on, but lots needs to happen before that project can be released publicly (if I even decide to do so).
  19. *zeewolf*

    Predator UAV camera and missiles

    Thanks for that, the smoke really needs to be shown on all clients, which is really tricky considering that the player can move the target point. I may end up just generating the smoke after the missile has hit (so the final impact point is known) then generate a trail from the impact point to the position it was fired from (i.e. broadcast two positions as publicvariables), or just make a random smoke trail from the impact point to a valid orbit position (i.e. broadcast only one position).
  20. *zeewolf*

    Predator UAV camera and missiles

    Thanks, I managed to get it working by creating a reversed version in RtmToolbox. Finally got round to play testing this today. Had it running as part of an oddball MP mission as an action available to the flag carrier. It worked very well, as did a basic killcam script I tested at the same time. The main feedback I got from players was that they preferred to have the initial camera feed focus on them rather than a selected map grid as it was much less disorienting in high speed game play. Some other refinements to the script are; A boost function that doubles the speed of the "missile" when you press V while it's already in-flight. Orbit view now cancelled if the player dies. Some on screen text gubbins (AGL, bearing, bingo/time to target). _pos = getpos player cutrsc["RscLaptopOpen","PLAIN"] _removeGogs = false ?((Daytime < 17) and (Daytime > 7)) : goto "start" ?!(player hasweapon "NVGoggles"): _removeGogs = true; player removeweapon "NVGoggles" player addweapon "NVGoggles" player action["NVGoggles"] #start ~0.5 _theta = random 360 _vel = 6 _r = 500 _phi = (random 30) + 45 _rx = _r * (sin _theta) * (cos _phi) _ry = _r * (cos _theta) * (cos _phi) _rz = _r * (sin _phi) _camera = "camera" camCreate [(_pos select 0) + _rx, (_pos select 1) + _ry, _rz] _camera cameraEffect ["internal","back"] _camera camSetTarget _pos _camera camSetFOV 0.1 _camera camCommit 0 @camCommitted _camera cutrsc["Default","PLAIN"] _campos = GetPos _camera _timeout = _time + 60 _direction = 1 ?(random 2 > 1) : _direction = -1 _tx = _pos select 0 _ty = _pos select 1 _i = 0 #orbit _theta = _theta + (_direction * 0.0688) _theta = _theta mod 360 _rx = _r * (sin _theta) * (cos _phi) _ry = _r * (cos _theta) * (cos _phi) _camera camSetPos [(_pos select 0) + _rx, (_pos select 1) + _ry, _rz] _camera camSetTarget [_tx,_ty,0] _camera camcommit 0 @camCommitted _camera _camera camCommand "Manual on" _campos = getpos _camera ~0.02 _i = _i + 1 ?(_i == 10): _i = 0; titletext[Format["\nHeading: %1 %2\nAGL: %3 ", (direction _camera) - (direction _camera mod 1),(_timeout - _time),_campos select 2],"PLAIN DOWN",0.05] ?(_camera != _camera): _pos = [_tx,_ty,0]; goto "fire" _camera camCommand "Manual off" _cx = 15*((getpos _camera select 0)-(_campos select 0)) _cy = 15*((getpos _camera select 1)-(_campos select 1)) _tx = _tx + _cx _ty = _ty + _cy ?((_timeout > _time) and (alive player)) : goto "orbit" ?(_removeGogs) : player removeweapon "NVGoggles" _camera camCommand "Manual on" _camera cameraEffect ["Terminate","back"] _camera camcommit 0 @camcommitted _camera camDestroy _camera ; Laptop Close animation requires reversed .rtm ;cutrsc["RscLaptopClose","PLAIN"] ~0.5 ;cutrsc["Default","PLAIN"] exit #fire titletext["","BLACK IN",10]; ; broadcast launch to other clients (triggers "enemy predator missile incoming" announcement) fxcode = 1 publicvariable "fxcode" ~0.1 #boost ?(alive _camera): camDestroy _camera _camera = "camera" camcreate _campos _camera cameraEffect ["internal","back"] _camera camSetTarget _pos _camera camSetFOV 0.7 _camera camCommit 0 titletext["","BLACK IN",0.1]; @camcommitted _camera _vx = _vel * (cos _phi) * -(sin _theta) _vy = _vel * (cos _phi) * -(cos _theta) _vz = _vel * (sin _phi) _i = 0 #approach _rz = _rz - _vz _camera camsetpos [(_campos select 0) + _vx,(_campos select 1) + _vy,_rz] _camera camSetTarget _pos _camera camCommit 0 @camCommitted _camera _rx = (_campos select 0)-(_pos select 0) _ry = (_campos select 1)-(_pos select 1) _distance = (sqrt((_rx^2)+(_ry^2))) _phi = (_campos select 2) atan2 _distance _theta = _rx atan2 _ry _campos = GetPos _camera _camera camCommand "Manual on" ~0.02 ?(_camera != _camera):titletext["","BLACK IN",10]; _vel = 12; goto "boost" _i = _i + 1 ?(_i == 10): _i = 0; titletext[Format["\nHeading: %1 %2\nAGL: %3 ", (direction _camera) - (direction _camera mod 1),(_distance*0.02)/_vel,_campos select 2],"PLAIN DOWN",0.05] _cx = 25*((getpos _camera select 0)-(_campos select 0)) _cy = 25*((getpos _camera select 1)-(_campos select 1)) _pos set[0,(_pos select 0) + _cx] _pos set[1,(_pos select 1) + _cy] _camera camCommand "Manual off" _vx = _vel * (cos _phi) * - (sin _theta) _vy = _vel * (cos _phi) * - (cos _theta) _vz = _vel * (sin _phi) ?((getpos _camera select 2) > 1) : goto "approach" ?(_removeGogs) : player removeweapon "NVGoggles" _camera camCommand "Manual on" _camera cameraEffect ["Terminate","back"] _camera camcommit 0 @camcommitted _camera camDestroy _camera ; Laptop Close animation requires reversed .rtm ;cutrsc["RscLaptopClose","PLAIN"] _bang = "maverick" createvehicle [_pos select 0, _pos select 1,0] ~0.5 ;cutrsc["Default","PLAIN"] exit EDIT: New killcam script (I forgot switchcamera worked in MP lol). Call it as a killed eventhandler or from a killed eventhandler e.g. player addeventhandler [{killed} , {_this exec {killcam.sqs}}] _killer = _this select 1 _killer switchCamera "Internal" _killer cameraEffect ["terminate","back"] _timeout = _time + 5 #lp ~0.1 ?(_timeout - _time > 0): titletext[format["KillCam %1",_timeout - _time],"PLAIN",0.05]; ?(_timeout > _time): goto "lp" player switchCamera "Internal" player cameraEffect ["terminate","back"] exit I won't be releasing a demo mission for this. This stuff will be in the MWC/Create-A-Class/Killstreak system I'm working on but I'm not committed to publicly releasing that, hence why I thought I'd post these handy scripts.
  21. *zeewolf*

    Mission requests and ideas

    Does anyone have or remember a mission (or addon) that has an opening and closing laptop animation like the one used in the game's option menu? I managed to make an opening laptop but I can't make a closing one...
  22. *zeewolf*

    Binmod Release Thread

    Regarding suppression. A basic implementation could probably be done using a hit eventhandler since there is always a small amount of splash damage for most bullets that I would expect to trigger it. If you can figure out how much then you can trigger the effect only for nearby impact rather than direct hits (although that may be desirable too). The eventhandlers then just need to trigger a black-in type cuttext. You may have to tweak out your ammo splash damage and/or soldier armor values to get the effect right. I use an init eventhandler on my player units that triggers black outs and rapid heartbeat when injured (with health regeneration after 5 seconds of not being injured). I haven't had any problems running it in MP.
  23. *zeewolf*

    Predator UAV camera and missiles

    Ok, I got a working cutrsc for an opening laptop by using this description.ext: class RscTitles { class RscLaptopOpen { idd=-1; type=80; movingEnable=1; objects[]={"Laptop"}; duration=4; class Laptop { duration=4; model="notebook.p3d"; idc=-1; type=83; autoOpen=1; autoZoom=1; animSpeed=2; animation="notebook.rtm"; position[]={0,-0.15,0.3}; direction[]={"sin 5","sin 20 * cos 5","cos 20 * cos 5"}; up[]={0,"cos 20","-sin 20"}; positionBack[]={0,-0.04,0.6}; inBack=0; enableZoom=0; zoomDuration=1; scale=1; }; }; }; But I can't get an equivalent closing animation. I'm guessing I need to change the phase, does anyone know how?
  24. Yes. If the class has scopeMagazine = 2 (public) and is instantiated by addmagazine, addmagazinecargo or by the Magazines class of description.ext, then it is added to the unit as a magazine and the game will search dtaext\equip\m for the image m_x.paa, where x is either the provided string (picture="x") or the magazine's class name (picture = ""). You have the option of using the weapon's gear description or creating a separate one in equipment.html. The same is true of weapons, a cfgWeapons class instantiated in a mission using addweapon, addweaponcargo or in the Weapons class of description.ext is assumed to be listed in dtaext\equip\w as w_x.paa, using the same method. If the image is missing from your dtaext.pbo you should see an error prompt showing the path of the image the game was looking for.
  25. I have just been trying to figure out how to make the game provide an "i" information button for any weapon. Based on this thread this is an unsolved problem for weapons being defined in addon .pbos. So I thought I'd share. The key is to never use the picture attribute in any weapon or magazine class. The default picture="" is what is used by all of the original non-resistance BIS weapons. This is what causes the game to search DTAEXT.pbo for an entry and (if it finds a matching picture in dtaext\equip\w) and description in dtaext\equipment.html display an "i" icon in gear. This does mean that a dtaext.pbo has to be provided with the addon containing weapon, magazine pictures and equipment html entries for every CfgWeapons class in the addon that requires an "i" icon. So as a quick example if I wanted to convert for example an addon weapon class called AN94 which uses the magazine AN94mag to provide an "i" icon: 1. Remove any "picture" attributes from the classes an94, an94mag, make sure that none of the parent/grandparent classes override the picture attribute to anything other than "" (ideally this should only be defined in CfgWeapons.Default). 2. Depbo Dtaext and add html entries for each class to equipment.html (just copy any other weapon's entry) change the EQ_ fields in the address to EQ_an94 and EQ_an94mag respectively. Change the _page2 addresses to unique values. 3. Create a picture for the weapon in dtaext\equip\w with the file name w_an94.paa, create one in dtaext\equip\m\ with the name m_an94mag.paa. 4. Repbo Dtaext and check out your new weapon information in game. 5. Feel free to customise the equipment.html entry once you've got a working "i" icon in gear for that weapon. For example I'm going to change my parameters pages to display a screenshot of the modeloptics used by each weapon to give people a better feel for what they're selecting when choosing weapons in a mission briefing (this will probably require me to add the screenshots to dtaext so equipment.html can access it). Once again it isn't important which .cpp the weapon is defined in (whether it be in the main config or an addon) the critical thing is not to override the picture attribute so the game accesses dtaext for equip\w_classname.paa. The same should be true for magazines which require a picture entry in dtaext\equip\m\. Obviously for small single weapon releases, forcing the user to replace their dtaext is impractical but for larger weapon collections, total conversions and mods it is well worth authors considering putting all their inventory pictures in a custom dtaext.pbo rather than an addon pbo.
×