Repository navigation
Custom scripts
To add a custom script, make a script that inherits from CustomMod, then after add it to your GameObject. Make sure you use ModStart for your Start method
- Make sure it has a SocketView and rpcsender component
Player GetLocalPlayer(): Returns the local player info Player GetHostPlayer(): Returns the host player info Player GetPlayerInfo(GameObject playerobj): Returns the player info of a GameObject Gameobject GetNearestPlayer: Returns the nearest GameObject with the "Player" tag DamagePlayer(GameObject PlayerObject, object[] options): Damages a Player GameObject:
-
options[0]= sender (string) -
options[1]= damage (float)
OnWeaponDamage(float Damage){ }: Called when the GameObject is hit with a raycast from a weapon onplayerspawn(){ }: Called on player join For modded events: look at RPCs
"toggleweapons" - Toggles weapons on the Player
(You can access all values from within your CustomMod script by referencing the object name) SocketView view: The the current SocketView bool hosting: Returns true if you are the host
of a room
string owner: The owner ID of the SocketView string moddedowner: The owner ID of the SocketView (set to the same as owner by default) bool islocal: Returns if the SocketView is
local string viewid: The ID of the SocketView
GameObject gameObject: Returns the GameObject of the player bool islocal: Returns if the player is local bool hosting: Returns if the player is the host string playerid: Returns the player id string playername: Returns the name of the player float health: Returns the current health of the player int team: Returns the value of which team the player is on bool hasweapons: Returns if weapons are enabled for a specific player bool chatting: True if
chatting bool paused: True if paused
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using BracketProto.Modding;
[RequireComponent(typeof(SocketView))]
[RequireComponent(typeof(rpcsender))]
public class ModClassName : CustomMod{
public void ModStart(){
//your start function
}
void Update(){
//your update function
}
public void ReceiveModRPC(ModRPC RPC){
//receiving RPCs
}
public void onplayerspawn(){
//called on player join
}
}