DayZ
Heroes And Bandits
 此主题已被置顶,因此可能具有重要性
DaemonForge  [开发者] 2020 年 6 月 12 日 下午 2:46
init.c
These are Helper functions you can use in your init.c
These functions will allow you to set custom Character skins for different affinities and load outs based on their level

Get Player Skin
m_HeroesAndBandits.getPlayerSkin(PlayerID)
This will return the players skin based on what is defined in the BambiSkins, HeroSkins, or BanditSkins in the config file


Get Player Hero Or Bandit
m_HeroesAndBandits.GetPlayerHeroOrBandit(PlayerID)
This will return whether a player is a hero, bandit or bambi in a string


Get Player Affinity
m_HeroesAndBandits.GetPlayerAffinity(PlayerID)
This will return the players Affinity in a string usually bambi, hero, bandit but this can be configured by the server admins will return bambi(Default Level Affinity) if the player can't be found


Get Player Humanity
m_HeroesAndBandits.GetPlayerHumanity(PlayerID)
This will return the players Humanity in a float value, it will return 0 if the player can't be found


Get Player Level Name
m_HeroesAndBandits.GetPlayerLevelName(PlayerID)
Returns the Level Name in a string, it will return the default level's name (usually Bambi) if the player can't be found


Get Player Stat
m_HeroesAndBandits.GetPlayerStat(PlayerID, ActionName)
Returns INT of the player stats for the Action specified, if player or the player's stat doesn't exist it returns 0


Recalcuate Player Stats
m_HeroesAndBandits.updatePlayerTotals()
This will load and then recalcuate all of the players humanity based on the current action values. Since this will load all players into the local system, it is recommended to remove the code and restart the server once it finishes booting. To prevent any potential performance decreases especially on large population servers.
最后由 DaemonForge 编辑于; 2020 年 7 月 5 日 下午 9:46
< >
正在显示第 1 - 5 条,共 5 条留言
DaemonForge  [开发者] 2020 年 6 月 12 日 下午 3:02 
Get Player Skin Example
The below code will replace some code your init.c
override PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName) { Entity playerEnt; playerEnt = GetGame().CreatePlayer(identity, m_HeroesAndBandits.getPlayerSkin(identity.GetPlainId()), pos, 0, "NONE"); Class.CastTo(m_player, playerEnt); GetGame().SelectPlayer(identity, m_player); return m_player; }
最后由 DaemonForge 编辑于; 2020 年 6 月 12 日 下午 3:04
DaemonForge  [开发者] 2020 年 6 月 12 日 下午 3:05 
Get Player Affinity Example
This would be added to the StartingEquipSetup function in the init.c this would give any player with the Affinity of bandit a bandana Mask when they fresh spawn in.
TStringArray bandanaMask = {"BandanaMask_BlackPattern","BandanaMask_CamoPattern","BandanaMask_GreenPattern", "BandanaMask_PolkaPattern"}; if(m_HeroesAndBandits.GetPlayerAffinity(player.GetIdentity().GetPlainId()) == "bandit") { player.GetInventory().CreateInInventory(bandanaMask.GetRandomElement()); }

Add after the below if using expansion mod
itemEnt = itemTop.GetInventory().CreateInInventory(chemlightArray[rndIndex]); SetRandomHealth(itemEnt); } }
最后由 DaemonForge 编辑于; 2020 年 6 月 15 日 上午 9:01
DaemonForge  [开发者] 2020 年 6 月 12 日 下午 3:09 
Get Player Humanity Example
This could be used similar to above but instead give load outs to any player over a certain humanity
EG, every player with over 15,000 Humanity will spawn in with a Glock19 and a mag for it

if ( m_HeroesAndBandits.GetPlayerHumanity( player.GetIdentity().GetPlainId() ) >= 15000) { player.GetInventory().CreateInInventory("Glock19"); player.GetInventory().CreateInInventory("Mag_Glock_15Rnd"); }
最后由 DaemonForge 编辑于; 2020 年 6 月 15 日 上午 8:58
DaemonForge  [开发者] 2020 年 6 月 12 日 下午 3:10 
Get Player Level Name Example
To do later or if anyone creates an example send it to me Ill add it here

but this could be used similar to Get Affinity but instead give load outs to any player with a certain level
最后由 DaemonForge 编辑于; 2020 年 6 月 12 日 下午 3:10
DaemonForge  [开发者] 2020 年 6 月 12 日 下午 3:11 
Get Player Stat Example
This could be used to give certain players items for doing more than a certain number of actions for example if a player had bandage other players for than 100 times AND they have given blood to more than 20 players they spawn in with a first aid kit
if ( m_HeroesAndBandits.GetPlayerStat( player.GetIdentity().GetPlainId(), "BandagePlayer" ) > 100 && m_HeroesAndBandits.GetPlayerStat( player.GetIdentity().GetPlainId(), "GiveBloodPlayer" ) > 20) { EntityAI kit = player.GetInventory().CreateInInventory("FirstAidKit"); kit.GetInventory().CreateInInventory("TetracyclineAntibiotics"); kit.GetInventory().CreateInInventory("BandageDressing"); kit.GetInventory().CreateInInventory("BandageDressing"); kit.GetInventory().CreateInInventory("CharcoalTablets"); kit.GetInventory().CreateInInventory("BloodTestKit"); }
最后由 DaemonForge 编辑于; 2020 年 6 月 15 日 下午 1:47
< >
正在显示第 1 - 5 条,共 5 条留言
每页显示数: 1530 50