Portal-Zone Gothic-Zone Gothic II-Zone Gothic 3-Zone Gothic 4-Zone Modifikationen-Zone Download-Zone Foren-Zone RPG-Zone Almanach-Zone Spirit of Gothic

 

Ergebnis 1 bis 5 von 5
  1. Beiträge anzeigen #1 Zitieren
    Waldläufer Avatar von Siemekk
    Registriert seit
    May 2016
    Beiträge
    121
     
    Siemekk ist offline

    How game create class C_NPC, C_ITEM etc.

    Hello
    I have small problem with C++ in game. I'd like to create a class similary to C_NPC - source methods in C++ but params i can set in game. So how i can create this class? What's parser methods i must use? zCParser::CreateInstance? Or where is saved info about c_npc?

    Thanks for help.

  2. Beiträge anzeigen #2 Zitieren
    Knight Commander Avatar von Neconspictor
    Registriert seit
    Jan 2009
    Beiträge
    2.749
     
    Neconspictor ist offline
    C_NPC is directly mapped to an oCNpc object. The same applies to C_Item, which is mapped to oCItem.
    To create an oCNpc or an oCItem you can use the oCObjectFactory class.

    zCParser::CreateInstance is used to create a specific instance of a daedalus class (e.g. a dagger is an instance of C_ITEM). It creates C++ objects (e.g. oCNpc for C_NPC) and when the daedalus code of the instance is executed, so that the object gets initialized.

  3. Beiträge anzeigen #3 Zitieren
    Waldläufer Avatar von Siemekk
    Registriert seit
    May 2016
    Beiträge
    121
     
    Siemekk ist offline

    So how i can init my object? zCObjectFactory create objects (Worlds etc.) But i need create C++ class and implement this by deadalus.
    Code:
    //C++
    class CRecept
    {
    
    	int nProduct;		// product instance
    	int nProcuctAmount;	
    	int nItem[6];		// instance of item
    	int nItemNeed[6];
    	zSTRING nAtr;		// parser value of talent
    	int nNeed;			// need attribute
    };
    
    //Daedalus
    class CRecept
    
    {
    	var int product;
    	var int amount;
    	var int nItem[6];
    	var int nNeed[6];
    	var string attribute;
    };
    
    INSTANCE ItRe_Test(CRecept)
    {
    
    	product = itar_pal_h;
    	amount = 1;
    	nItem[0] = itpl_dragroth;
    
    //etc.
    };
    How i can get this effect by C++ (AST)

  4. Beiträge anzeigen #4 Zitieren
    Knight Commander Avatar von Neconspictor
    Registriert seit
    Jan 2009
    Beiträge
    2.749
     
    Neconspictor ist offline
    I have not much time so i can you only give small hints, and some of it are only assumptions.
    In general you should know, that you have to experiment and properly also do some reverse engineering.

    1. You have to provide an external that allows you to create an instance of your class type (here CRecept)
    2. You have to get the zCPar_Symbol of your instance (ItRe_Test). The parser has a function to get a symbol by its name. You should look at that.
    3. In C++ than you create an object of your CRecept class and than you have to initialize it using the values you specified in your instance
    (in your exampe ItRe_Test). I never did it exactly this way, but i think it could work to call
    Code:
    .text:00792FA0 ; int __thiscall zCParser::CreateInstance(zCParser *this, int instanceID, void * objectPtr)
    where...
    - instanceID the zCPar_Symbol of your instance
    - objectPtr the pointer to your created CRecept c++ object.

  5. Beiträge anzeigen #5 Zitieren
    Knight Commander Avatar von Neconspictor
    Registriert seit
    Jan 2009
    Beiträge
    2.749
     
    Neconspictor ist offline
    Zitat Zitat von Neconspictor Beitrag anzeigen
    Code:
    .text:00792FA0 ; int __thiscall zCParser::CreateInstance(zCParser *this, int instanceID, void * objectPtr)
    where...
    - instanceID the zCPar_Symbol of your instance
    I have to correct my statement: instanceID of course is not the zCPar_Symbol itself, but the index of it in the parser symbol table.

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
Impressum | Link Us | intern
World of Gothic © by World of Gothic Team
Gothic, Gothic 2 & Gothic 3 are © by Piranha Bytes & Egmont Interactive & JoWooD Productions AG, all rights reserved worldwide