Jump to content

Recommended Posts

What the title says. I want a character to automatically befriend the anthropomorphic creatures such as pigmen, bunnymen, and merms. Is there a simple bit of code I can use for this? I'm sorry to say I'm not particularly skilled with programming (it's a wonder I ever managed to complete my mod in the first place), but if I could add this feature, it would fit the character incredibly well.

Edited by FractiousLemon
typo

common way to make any character friedly:

  • change his tags (i.e. monster), thats make other non-hostile mobs neutral to him
  • change brains
  • change onattack, onattacked, ontarget functions

i taked it from my memory, maybe i missed something here. But it's common procedure. Some mobs will require less changes.

but it's not easy at all.

 

about pigmen - he is not hostile at all, just give him food and he will follow you for some period of time.

if talking about code, pigmen's brain is probably most complicated.

Edited by R1ncewind

you can go into the prefabs.

theres no need to change the brain.

whether a pig man is your friend or not is merely a variable. you'd only need to look at brains if you wanted to somehow completely change their behaviour.

you're gonna have to look through the pigmans prefab and analyze the structure. Basically a bunch of functions and one of them will do something to the pigs obedience ( I think that's what it's called in the code) what this function will probably also do is, assign an ally to the pig once a certain obediency level has been reached. You may be able to bypass this process by using your own character (player.GetCharacter()) as a parameter and directly grant servitude. Don't forget to look at how the ally state is removed as well :p

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...