Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Need help?

    Create a topic in the appropriate section
    Don't write everything in the chat!
  • Take a look at the marketplace

    There you can buy
    everything related to game servers
  • Don't want a ban?

    Please read our rules
    Don't disturb the order!
  • Sell or buy?

    Use services of the guarantor
    We will make your deal safe
  • 0
222Orbita

Серверостроение – Float Scale

Доброго времени суток! Ребят, подскажите, пожалуйста, каким способом можно изменить размер какой-либо модели в игре? Например, у меня есть модель цыплёнка, в скрипте у него прописано float scale = 0.35; и он бегает маленький, как и положено цыплёнку, но когда его убиваешь, то тушка становится снова большой, размером с курицу. Все скрипты по добавлению трупика цыплёнка я прописал и они отлично работают, но одна загвоздка – размер. Нужно что бы размер трупика соответствовал живому цыплёнку. Вот конфиг и скрипты:

class cfgVehicles
{
	class AnimalBase;
	class Animal_GallusGallusDomesticusF: AnimalBase{};
	class Animal_GallusGallusDomesticusF_baby: Animal_GallusGallusDomesticusF
	{
		scope=2;
		hiddenSelectionsTextures[]=
		{
			"dz\animals\gallus_gallus_domesticus_feminam\data\hen_white_co.paa"
		};
	};
	class babychicken: Animal_GallusGallusDomesticusF_baby
	{
		displayName="Цыплёнок";
	};
	class Edible_Base;
	class DeadChicken_ColorBase: Edible_Base{};
	class DeadChicken_baby: DeadChicken_ColorBase
	{
		scope=2;
		displayName="Мертвый цыплёнок";
		descriptionShort="Мертвый цыплёнок.";
		model="\dz\gear\food\gallus_gallus_female_dead.p3d";
		hiddenSelectionsTextures[]=
		{
			"dz\animals\gallus_gallus_domesticus_feminam\data\hen_white_co.paa"
		};
	};
};

Размер живого цыплёнка:

class babychicken: Animal_GallusGallusDomesticusF_baby{  };

modded class babychicken
{
    void babychicken()
    {
        SetEventMask(EntityEvent.POSTFRAME);
    }
        
    override void EOnPostFrame(IEntity other, int extra)
    {
        float scale = 0.35;
        vector transform[4];
        GetTransform(transform);
        
        transform[0] = transform[0] * scale;
        transform[1] = transform[1] * scale;
        transform[2] = transform[2] * scale;
        
        SetTransform(transform);
        Update();
    }

    override void EOnFrame(IEntity other, float timeSlice) // | EntityEvent.FRAME
    {
        vector rotation = GetYawPitchRoll();
        SetYawPitchRoll(Vector(rotation[0], 0, 0));
    }
}

Добавление принадлежности трупика к взаимодействиям:

modded class DeadChicken_ColorBase extends Edible_Base
{
	override bool CanBeCookedOnStick()
	{
		return false;
	}

	override bool CanBeCooked()
	{
		return false;
	}	
	
	override bool IsCorpse()
	{
		return true;
	}

	override bool CanDecay()
	{
		return true;
	}
	
	override bool CanBeSkinned()
	{
		if ( GetHealthLevel() == GameConstants.STATE_RUINED )
			return false;

		return true;
	}
}

modded class DeadRooster extends DeadChicken_ColorBase {}
modded class DeadChicken_White extends DeadChicken_ColorBase {}
modded class DeadChicken_Spotted extends DeadChicken_ColorBase {}
modded class DeadChicken_Brown extends DeadChicken_ColorBase {}
modded class DeadChicken_baby extends DeadChicken_ColorBase {}

Создание трупика после убийства цыплёнка:

modded class AnimalBase extends DayZAnimal
{
	protected ref ArrowManagerBase m_ArrowManager;
	
	void AnimalBase()
	{
		m_ArrowManager = new ArrowManagerBase(this);
	}
	
	override ArrowManagerBase GetArrowManager()
	{
		return m_ArrowManager;
	}
	
	override bool IsRefresherSignalingViable()
	{
		return false;
	}
}

class Animal_GallusGallusDomesticusF_baby extends Animal_GallusGallusDomesticusF
{
	override string GetDeadItemName()
	{
		return "DeadChicken_baby";
	}
}

И, наконец, сам размер трупика:

class DeadChicken_baby: DeadChicken_ColorBase{  };

modded class DeadChicken_baby
{
    void DeadChicken_baby()
    {
        SetEventMask(EntityEvent.POSTFRAME);
    }
        
    override void EOnPostFrame(IEntity other, int extra)
    {
        float scale = 0.35;
        vector transform[4];
        GetTransform(transform);
        
        transform[0] = transform[0] * scale;
        transform[1] = transform[1] * scale;
        transform[2] = transform[2] * scale;
        
        SetTransform(transform);
        Update();
    }

    override void EOnFrame(IEntity other, float timeSlice) // | EntityEvent.FRAME
    {
        vector rotation = GetYawPitchRoll();
        SetYawPitchRoll(Vector(rotation[0], 0, 0));
    }
}

Но почему-то не работает размерчик, не понимаю почему. Подскажите, пожалуйста, где я ошибся? Спасибо!

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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

Important Information

By using this site, you automaticly agree to our Guidelines and Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.