1
Pytania i problemy / Czas na wybór dialogu
« dnia: 2020-05-02, 22:22 »
Ewentualnie użyj tick tocków

Ta sekcja pozwala Ci zobaczyć wszystkie wiadomości wysłane przez tego użytkownika. Zwróć uwagę, że możesz widzieć tylko wiadomości wysłane w działach do których masz aktualnie dostęp.
Mam to oczywiście w INIT_SUB_SWIAT.O ile się nie mylę INIT_SUB wywołuje się tylko dla światów złączonych opcją Macros w spacerze.
Wld_SetMobRoutine (00,00, "FIREPLACE", 1);
//czas, prefix, ,czy ma świecić = 1-tak, 0-nie
Podana funkcja zapali(zaświeci) wszystkie moby(oCMobFire) z prefixem FIREPLACE w nazwie modelu o godzinie 00:00.Wld_SetMobRoutine (hh,mm, "TORCH", 1);
//enum zTMat_AlphaFunc
const int RND_ALPHA_FUNC_MAT_DEFAULT = 0;
const int RND_ALPHA_FUNC_NONE = 1;
const int RND_ALPHA_FUNC_BLEND = 2;
const int RND_ALPHA_FUNC_ADD = 3;
const int RND_ALPHA_FUNC_SUB = 4;
const int RND_ALPHA_FUNC_MUL = 5;
const int RND_ALPHA_FUNC_MUL2 = 6;
const int RND_ALPHA_FUNC_TEST = 7;
const int RND_ALPHA_FUNC_BLEND_TEST = 8;
func int zCMaterial_SearchName(var string _mname) { //return zCMaterial
CALL_zStringPtrParam(STR_Upper(_mname));
CALL__cdecl(zCMaterial__SearchName);
return CALL_RetValAsInt();
};
func void zCMaterial_SetAlpha(var string _mname, var int blendType, var int alpha) {
var int mat; mat = zCMaterial_SearchName(_mname);
if(!mat) { return; };
MEM_WriteInt(mat+116, blendType);
MEM_WriteInt(mat+56, RGBA(255, 255, 255, alpha));
};
Wywołaj tylko raz:zCMaterial_SetAlpha("NazwaMaterialu", RND_ALPHA_FUNC_BLEND, alpha);
Na pierwszym lepszym materiale działa bez problemu:const int zCParticleFX__Load = 5959152; //0x005AEDF0
const int zCVobLight__zCVobLight = 6323472; //0x607D10
const int zCWorld__AddVobAsChild = 6440352; //0x6245A0
const int zCWorld__RemoveVob = 6441840; //0x624B70
const int oCVisualFX__DoMovements = 4814160; //0x00497550 / 6
const int oCVisualFX__EndEffect = 4803712; //0x00494C80 / 9
const int sizeof_zCVobLight = 392; //0x188
const int SPELL_DYNAMICLIGHT_RANGE = 150; //Range of light for Vobs
const float SPELL_STATICLIGHT_RANGE = 0.004; //Range of light for LevelMesh
func int GetPfxColor(var string pfxname)
{
CALL_zStringPtrParam(pfxname); //zCParticleFX name
CALL__cdecl(zCParticleFX__Load);
var int PFX_ptr; PFX_ptr = CALL_RetValAsInt(); //zCParticleFX
var int ParticleEm; ParticleEm = MEM_ReadInt(PFX_ptr+84); //zCParticleFX.m_pEm
var string ParticleColS; ParticleColS = MEM_ReadString(ParticleEm+412); //zCParticleEmitter.m_sVisTexColorStart
var string ParticleColE; ParticleColE = MEM_ReadString(ParticleEm+432); //zCParticleEmitter.m_sVisTexColorEnd
var int PFXColS[3]; var int PFXColE[3];
PFXColS[0] = STR_ToInt(STR_Split(ParticleColS, " ", 0)); PFXColE[0] = STR_ToInt(STR_Split(ParticleColE, " ", 0));
PFXColS[1] = STR_ToInt(STR_Split(ParticleColS, " ", 1)); PFXColE[1] = STR_ToInt(STR_Split(ParticleColE, " ", 1));
PFXColS[2] = STR_ToInt(STR_Split(ParticleColS, " ", 2)); PFXColE[2] = STR_ToInt(STR_Split(ParticleColE, " ", 2));
return RGBA((PFXColS[0]+PFXColE[0])/2, (PFXColS[1]+PFXColE[1])/2, (PFXColS[2]+PFXColE[2])/2, 255);
};
func int VFX_isSpell(var string vfx) {
var int vfx_l; vfx_l = STR_Len(vfx);
if(vfx_l<10) { return false; };
if(STR_Compare(STR_SubStr(vfx, 0, 3), "MFX")) { return false; };
if(!STR_Compare(STR_SubStr(vfx, vfx_l-5, vfx_l-1), "_INIT"))
||(!STR_Compare(STR_SubStr(vfx, vfx_l-5, vfx_l-1), "_CAST")) { return true; };
return false;
};
func int AddLightToVFX(var int VFXPtr) {
var int lightPtr; lightPtr = MEM_Alloc(sizeof_zCVobLight);
CALL__thiscall(lightPtr, zCVobLight__zCVobLight);
var zCVobLight light; light = _^(lightPtr);
//Configure
light.lightColor = GetPfxColor(MEM_ReadString(ECX+288)); //PFX name
light.range = mkf(SPELL_DYNAMICLIGHT_RANGE);
light.rangeInv = castToIntf(SPELL_STATICLIGHT_RANGE);
light.bitfield = zCVobLight_bitfield_isTurnedOn;
MEM_CopyWords(VFXPtr+60, lightPtr+60, 16);
CALL_PtrParam(MEM_ReadInt(VFXPtr+36)); //zCVisualFX._zCVob_globalVobTreeNode
CALL_PtrParam(lightPtr);
CALL__thiscall(_@(MEM_World), zCWorld__AddVobAsChild);
return lightPtr;
};
func void VisualFX_DoMovements() {
var String PFXName; PFXName = MEM_ReadString(ECX+288);
if(!VFX_isSpell(PFXName)) { return; };
if(MEM_ReadInt(ECX+216)>0) { return; }; //Check if zCVobLight is created
MEM_WriteInt(ECX+216, AddLightToVFX(ECX));
};
func void VisualFX_EndEffect() {
var String PFXName; PFXName = MEM_ReadString(ECX+288);
if(!VFX_isSpell(PFXName)) { return; };
if(MEM_ReadInt(ECX+216)==0) { return; }; //Check if zCVobLight is not created
//Delete zCVobLight
CALL_PtrParam(MEM_ReadInt(ECX+216));
CALL__thiscall(_@(MEM_World), zCWorld__RemoveVob);
};
func void SpellLight_Init() {
HookEngineF(oCVisualFX__DoMovements, 6, VisualFX_DoMovements);
HookEngineF(oCVisualFX__EndEffect, 9, VisualFX_EndEffect);
};
UWAGA: Skrypt do działania wymaga pakietów skryptowych Ikarus&LeGo.Album
0x005FD940 static zCObject * __cdecl zCVob::_CreateNewInstance(void)
następnie skonfiguruj go (pozycja trafoObjToWorld, wyglad itd...) i dodaj do świata wywołując to:0x00624810 zCTree<zCVob> * __thiscall zCWorld::AddVob(zCVob *)
Powinno działać bez waypointów w świecie func int oCNpc_GetModel(var int npc)
{
const int oCNpc__GetModel = 7571232; //0x00738720
CALL__Thiscall(npc, oCNpc__GetModel);
return CALL_RetValAsInt();
};
func int zCModel_GetAniIDFromAniName(var int model, var string aniName)
{
const int zCModel__GetAniIDFromAniName = 6365296; //0x00612070
CALL_zStringPtrParam(aniName);
CALL__thiscall(model, zCModel__GetAniIDFromAniName);
return CALL_RetValAsInt();
};
func void zCModel_SetCombineAniXY(var int model, var int aniID, var int aniX, var int aniY)
{
const int zCModel__SetCombineAniXY = 5764016; //0x0057F3B0
CALL_FloatParam(aniY);
CALL_FloatParam(aniX);
CALL_IntParam(aniID);
CALL__thiscall(model, zCModel__SetCombineAniXY);
};
func void Npc_SetCombAniXY(var c_npc npc, var string aniName, var int aniX, var int aniY)
{
var int npcModel; npcModel = oCNpc_GetModel(_@(npc));
zCModel_SetCombineAniXY(npcModel, zCModel_GetAniIDFromAniName(npcModel, STR_Upper(aniName)), aniX, aniY);
};
Przykład użycia funkcji://Najpierw odpalamy animacje
AI_PlayAni(hero, "T_LOOK");
//Parametry xFloat i yFloat muszą być w przedziale od 0.0 do 1.0.
Npc_SetCombAniXY(hero, "T_LOOK", xFloat, yFloat);
Oraz jak to wygląda w grze