Gothic 2[C++] co to za funkcja ? 1972 9

O temacie

Autor Siemekk

Zaczęty 28.09.2016 roku

Wyświetleń 1972

Odpowiedzi 9

Siemekk

Siemekk

Złote Wrota
Untersturmfuhrer
posty2143
Propsy1151
ProfesjaProgramista
  • Złote Wrota
  • Untersturmfuhrer
Cześć  :) Dostałem od Gratt'a kod źródłowy Agama Script Tools. Chciałem przepisać kołczany na Ikarusa. Wszystko ładnie pięknie tylko mam problem z takim czymś:
//  Get source model from file...
zCVisual* aCQuiver::GetVisual(zSTRING file)
{ //  dont return if file name is empty
if(file.IsEmpty())
return NULL;
//  Return pointer for new model object...
zCVisual* pVisual = zCVisual::LoadVisual(zSTRING(file).Upper());
return pVisual;
}
Ale co to jest Upper? W gothicu mam funkcję LoadVisual wygląda ona tak:
const int zCVisual__LoadVisual = 6318800; //0x00606AD0

func int Quiver_LoadVisual(var string vis)
{
    CALL_zStringPtrParam(vis);
CALL__cdecl(zCVisual__LoadVisual);
    return CALL_RetValAsInt();
};
Ale jak mam pod to podpiąć kod z C++ ? Nie mam pojęcia o pisaniu w C++ dlatego umieszczam to tutaj :I Może ktoś mi pomoże mówiąc czym jest to Upper :)
 

P.S A Splash w szafie i nie ma psychy by mi dać bana.

Szmyk

Szmyk

Użytkownicy
posty64
Propsy58
Profesjabrak
  • Użytkownicy
Wygląda na to, że funkcja Upper () zwraca wartość typu string. Po jej nazwie możesz się domyślić co ona robi.
 

Splash

Splash

Moderator
posty4207
Propsy3403
ProfesjaNierób
  • Moderator
Można też pomyśleć trochę i napisać po swojemu:
func int GetSlotItem (var C_NPC slf, var string slotName)
{
    CALL_zStringPtrParam (slotName);
    CALL__thiscall (MEM_InstToPtr (slf), 7544560);
    return CALL_RetValAsPtr ();
};

func void CreateQuiver (var c_npc slf)
{
    if (GetSlotItem (slf, "ZS_BOW"))
    {
    var c_item bow; bow = _^ (GetSlotItem (slf, "ZS_BOW"));

        if (Npc_IsPlayer (slf) && !Npc_HasItems (slf, bow.munition))
        {
        oCNpc_PutInSlot (slf, "ZS_CROSSBOW", MEM_InsertVob ("", MEM_GetAnyWP ()), 4);
        return;
        };

    oCNpc_PutInSlot (slf, "ZS_CROSSBOW", MEM_InsertVob ("BowQuiver.3DS", MEM_GetAnyWP ()), 4);
    };

    if (GetSlotItem (slf, "ZS_CROSSWBOW"))
    {
    var c_item crossbow; crossbow = _^ (GetSlotItem (slf, "ZS_CROSSBOW"));

if (Npc_IsPlayer (slf) && !Npc_HasItems (slf, crossbow.munition))
{
oCNpc_PutInSlot (slf, "ZS_BOW", MEM_InsertVob ("", MEM_GetAnyWP ()), 4);
return;
};

    oCNpc_PutInSlot (slf, "ZS_BOW", MEM_InsertVob ("CrossbowQuiver.3DS", MEM_GetAnyWP ()), 4);
    };
};

func void RemoveQuiver ()
{
    var int ptr
    var c_npc slf; slf = _^ (ECX);

    if (Hlp_Is_oCItem (MEM_ReadInt (ESP+4)))
    {
    var c_item itm; itm = _^ (MEM_ReadInt (ESP+4));

        if (itm.flags & ITEM_BOW)
        {
        ptr = oCNpc_PutInSlot (slf, "ZS_CROSSBOW", MEM_InsertVob (itm.visual, MEM_GetAnyWP ()), 4);
        oCNpc_RemoveFromSlot (slf, "ZS_CROSSBOW", ptr, 4);
        }
else if (itm.flags & ITEM_CROSSBOW)
        {
        ptr = oCNpc_PutInSlot (slf, "ZS_BOW", MEM_InsertVob (itm.visual, MEM_GetAnyWP ()), 4);
        oCNpc_RemoveFromSlot (slf, "ZS_BOW", ptr, 4);
        };
    };
};

func void CreateQuiver_Broadcast ()
{
    DoForSphere (CreateQuiver);
};

func void InitQuivers ()
{
    FF_ApplyOnce (CreateQuiver_Broadcast);
    HookEngineF (7546560, 6, RemoveQuiver);
};

Potrzebny będzie jeszcze pakiet Broadcasts: http://forum.worldofplayers.de/forum/threads/775333-Script-Broadcasts?p=17232705&viewfull=1#post17232705
 
Nie zajmuję się multiplayerami do Gothica. Przestańcie zawracać mi tym głowę...
Ps. Siemekk ma downa i śpi w pufie

Siemekk

Siemekk

Złote Wrota
Untersturmfuhrer
posty2143
Propsy1151
ProfesjaProgramista
  • Złote Wrota
  • Untersturmfuhrer
@Splash na 100% komuś się to przyda :) Ale ja chcę zrobić, że NPC ma w kołczanie ilość strzał zależną od jego strzał w ekwipunku (tylko że wiadomo, że da się jakiś limit)
Starą wersję mam tutaj:
tutaj.
Problem w tym, że pokazuje tylko ilość strzał u bohatera :I
W AST są czytani wszyscy npc z danego świata. I tworzony jest kołczan w formacie .asc (wiadomo kości) i na nim są tworzone strzały. Dlatego chciałbym się dowiedzieć czym jest ten Upper :I
 

P.S A Splash w szafie i nie ma psychy by mi dać bana.

Splash

Splash

Moderator
posty4207
Propsy3403
ProfesjaNierób
  • Moderator
Ten skrypt działa na wszystkich npc.

A upper po prostu zwraca stringa w dużych literach.
 
Nie zajmuję się multiplayerami do Gothica. Przestańcie zawracać mi tym głowę...
Ps. Siemekk ma downa i śpi w pufie

Siemekk

Siemekk

Złote Wrota
Untersturmfuhrer
posty2143
Propsy1151
ProfesjaProgramista
  • Złote Wrota
  • Untersturmfuhrer
Wiem że zawraca wszystkich npc więc na 100% go wykorzystam :) A i jeszcze jedno czy w G2 też jest taka funkcja ?
Mogę się mylić ale coś takiego gdzieś chyba widziałem STR_UP(...); z dużym naciskiem na CHYBA!
 

P.S A Splash w szafie i nie ma psychy by mi dać bana.

Splash

Splash

Moderator
posty4207
Propsy3403
ProfesjaNierób
  • Moderator
STR_Upper
 
Nie zajmuję się multiplayerami do Gothica. Przestańcie zawracać mi tym głowę...
Ps. Siemekk ma downa i śpi w pufie

Siemekk

Siemekk

Złote Wrota
Untersturmfuhrer
posty2143
Propsy1151
ProfesjaProgramista
  • Złote Wrota
  • Untersturmfuhrer
Dzięki :) Czyli ostateczne uber hiper pytanie D:
Funkcja powinna wyglądać tak w Deadalusie:
const int zCVisual__LoadVisual = 6318800; //0x00606AD0

func int Quiver_LoadVisual(var string vis)
{
    CALL_zStringPtrParam(vis);
CALL__cdecl(zCVisual__LoadVisual);
    return CALL_RetValAsInt();
};

func int Quiver_GetVisual(var string sub)
{
var int pVisual; pVisual = Quiver_LoadVisual(STR_Upper(sub));
return pVisual;
};
 

P.S A Splash w szafie i nie ma psychy by mi dać bana.

Splash

Splash

Moderator
posty4207
Propsy3403
ProfesjaNierób
  • Moderator
Tak.
 
Nie zajmuję się multiplayerami do Gothica. Przestańcie zawracać mi tym głowę...
Ps. Siemekk ma downa i śpi w pufie

Siemekk

Siemekk

Złote Wrota
Untersturmfuhrer
posty2143
Propsy1151
ProfesjaProgramista
  • Złote Wrota
  • Untersturmfuhrer
Dziękuje do zamknięcia.
 

P.S A Splash w szafie i nie ma psychy by mi dać bana.


0 użytkowników i 1 Gość przegląda ten wątek.
0 użytkowników
Do góry