Skip to content

Maxinger15/VU-Killstreak

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VU-Killstreak

Core mod for Killstreaks in Battlefield 3.

Attention ! please adjust the settings to your server. It is not recommended to use the default values !

See here how you can do this

This mod adds the UI and the logic to interact with killstreaks. The UI is made with React. To develop you need NodeJS and npm installed on you System. On first use go into the UI Folder and type in the command line "npm install" to install all dependencies then you can run the UI on your local System with "npm run start"

Killstreaks will be provided as extra mods. See here how you create one

Killstreak-Mods:

Killstreaks only work if you load them in the ModList.txt

Develop killstreaks:

Defaults:

The default keys to trigger the killstreaks are F5, F6 ,F7 ,F8. It is possible to change this in the configuration.lua but it would be more instinctively to keep the defaults and the UI needs to be modified. If it don't has a UI then the Killstreak should be activated in one step with the trigger. If it has a UI then it should be separately activated with F9 after the killstreak was triggerd.

Events:

Your killstreak needs the following Events at the client side to be used by the core mod.

The :Invoke event is triggerd when the User has the points to use your killstreak and pressed the declared button in the configuration.lua Parameters:

  • stepNr: The number of your killstreak (1-4 including)
Events:Subscribe("<your mod name>:Invoke",function(stepNr)
  -- Killstreak enabled. Enable UI if available
   Do things the killstreak should do
end)

The :Disable event is only necessary if you have a step between invoke killstreak and actually use it. A UI where you can select a place for example. See this

Events:Subscribe("<your mod name>:Disable",function(stepNr)
  -- Killstreak not Used. Disable UI....
end)

The Killstreak:newTimer event allows you to show a timer at the UI

The timerObj in the JSON-String needs the following properties:

  • duration: number - time to tick in seconds
  • text: text displayed at the UI (best letters < 25 but not limited)
Events:Dispatch("Killstreak:newTimer", timerObjJson)
NetEvents:SendTo("Killstreak:newTimer",player, timerObjJson)

The Killstreak:showNotification event allows you to show a notification at the UI

The messageObj in the JSON-String needs the following properties:

  • title: string
  • message: string
Events:Dispatch("Killstreak:showNotification", messageObjJson)
NetEvents:SendTo("Killstreak:showNotification",player, messageObjJson)

Dispatch this event when the killstreak was used. This decreases the points of the player and adjusts the UI Parameter:

  • stepNr: the stepNr you got with the invoke event.
  • timeBased: boolean - blocks the use of your killstreaks till you invoke Killstreak:Finished
Events:Dispatch("Killstreak:usedStep",stepNr,timeBased)

Dispatch this event only when you called Killstreak:usedStep with timeBased = true. Maybe nothing bad would happen if you do it anyways but just don't do it! This will allow the player to use your killstreak again. Parameter:

  • stepNr: the stepNr you got with the invoke event.
Events:Dispatch("Killstreak:Finished",stepNr)

Configuration

Server

In the Server folder you can find this configuration files.

Configuration.lua

In this file you define which killstreak mods are available, how many points they cost, change the selection keys (not recommended!) Currently only 4 killstreaks at the same time are supportet!!! Not more not less! The file looks like that:

local conf  ={
{
       "vu-artillerystrike", -- name from the mod.json of the killstreak
       InputDeviceKeys.IDK_F5, !!deprecated ! don't use !! -- key to trigger the killstreak
       150, -- the cost of the killstreak (can/should be changed)
       "Grenades", -- The name that is shown in the UI
       "Left %NR", -- The description that is shown in the UI.
       "Press F to use", -- displayed when a user activates the killstreak
       "Your Killstreak is ready", -- replaces the description when the killstreak is ready to use
     },
     {
       "vu-artillerystrike",
       65,
       250,
       "Health",
       "Left %NR",
       "Press F to use",
        "Your Killstreak is ready"
     },
     ...
}

Fancy thing: %NR will be replaced by the UI with the points left to unlock the killstreak. "Left: %NR Points" -> "Left: 150 Points"

settings.lua

Here you can change the mechanics of the mod.

local setting = { resetOnDeath = false; -- resets the points of the player to 0 if he dies ignoreScoreInVehicle = false; -- ignores all points a player get if he is in a vehicle }

Client

keybindings.lua

Here you can define which keys are used to trigger the killstreak-mod execution. The basic key to use the killstreak after that is F9

local bindings = { InputDeviceKeys.IDK_F5,InputDeviceKeys.IDK_F6,InputDeviceKeys.IDK_F7,InputDeviceKeys.IDK_F8 }

Get your values from here