Jump to content

Male and female characters


Nebula

Recommended Posts

2 hours ago, Axezombie said:

well same as IRL, undress him/her

Your jokes are inappropriate here.
I need help with the code.

 

And by the way, yes, it would be more interesting if the characters were completely undressable, and underwear was dressed as well as clothes.

Edited by Nebula
Link to comment
Share on other sites

  • 2 months later...

Use the function "getPlayer():isFemale()"

There's more ways to get some player's gender, but this is one way.

 

"getPlayer()" is a global Project Zomboid function that returns an "IsoPlayer" object that is the client's character.

https://projectzomboid.com/modding/zombie/Lua/LuaManager.GlobalObject.html

https://projectzomboid.com/modding/zombie/Lua/LuaManager.GlobalObject.html#getPlayer--

image.png.192cb9bc03c1a2d8d779c1fa1cd28cfa.png

 

"isFemale()" is a function of "IsoPlayer" which is inherited from the "IsoGameCharacter" class.

https://projectzomboid.com/modding/zombie/characters/IsoPlayer.html

image.thumb.png.4b537ae29b984293d5e301235bc6b764.png

 

"IsoGameCharacter"

https://projectzomboid.com/modding/zombie/characters/IsoGameCharacter.html#isFemale--

image.thumb.png.1b664c9cee0a5aecea9affbb73fb5df5.png

 

 

Here's some example functions that use these classes and their functions.

This only returns if the client's gender is female as true or false.

 

The code has to be put inside the client folder in "..\media\lua\client" on some lua file.

Any questions feel free to ask me.

PlayerFunctions = {}

--[[
    Returns a boolean true if the player is female.
    Returns a boolean false if the player is male.
    
    Requirements: This code must be run under the client folder inside "..\media\lua\client" inside some lua file.
]]
function PlayerFunctions.isFemale()
    local playerObj = getPlayer()
    local isFemale = playerObj:isFemale()
    return isFemale
end

function PlayerFunctions.isFemale2()
    return getPlayer():isFemale()
end

local function isFemale()
    return getPlayer():isFemale()
end

function isFemaleGlobalFunction()
    return getPlayer():isFemale()
end

local function printPlayerGender()
    print("IsFemale? --> " .. getPlayer():isFemale())
end

function printPlayerGenderGlobalFunction()
    print("IsFemale? --> " .. getPlayer():isFemale())
end

 

 

 

PlayerFunctions.lua

Edited by ATPHHe
Edited code.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...