Jump to content

Photo

tile of a Item


  • Please log in to reply
7 replies to this topic

#1 nyrox

nyrox

    Junior

  • Members
  • Location:Québec

Posted 10 August 2020 - 03:50 PM

i know the ID of a item and i want a code to have is Tile  and cset in a integer

 

(itemID = 127) for the variable init

 

 

void run(int indexshop, int itemID, int prix, int Yvisualoffset, int typesell, int o, int NoCounter, int Famille){
 

.....

 

int ItemTile;

int ItemCSet;

int message;

....

 

itemdata idata = Game->LoadItemData(itemID);

 

 

 

(now i want the Tile  and cset of the item itemID) 

 

ItemTile = ?????    // idata->Tile don't work

itemCSet = ????  // idata ->CSet don'T work

 

message = o;

 

 ItemPopup(iitemTile, itemCSet, iitemID, message);

 

this is the fonction is do well if i enter the init variable.. 

 

 

void ItemPopup(int itemTile, int cset, int itemID, int message){
     bool cond;
     if (!ITEM_PICKUP[itemID]){
        cond = true;
    }
    while(cond){
        while (!ITEM_PICKUP[itemID]){
                Waitframe();
        }
        Screen->Rectangle(6, 0, 0, 256, 512, 0x00, 1, 0, 0, 0, true, 128); //Clear the bitmap
        Screen->DrawTile(6, 24, 24, 51740, 12, 6, 5, -1, -1, 0, 0, 0, 0, true, OP_OPAQUE); //Draw the item frame
         Screen->FastTile(6, 32, 32, tile, cset, OP_OPAQUE); //Draw the item
         cond = false;
         Screen->Message(message);
   }
}


#2 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 10 August 2020 - 05:05 PM

idata->Tile and idata->CSet are correct...



#3 nyrox

nyrox

    Junior

  • Members
  • Location:Québec

Posted 10 August 2020 - 09:11 PM

I am in 2.53

 

error T29 that pointer type does not have variable  Tile



#4 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 11 August 2020 - 07:31 AM

Ah, 2.53. Sorry then, not possible. Gotta use 2.55 for that.

#5 nyrox

nyrox

    Junior

  • Members
  • Location:Québec

Posted 11 August 2020 - 10:01 PM

i can have the tile if i create a item  like this

 

item shpitm = CreateItemAt(itemID, Link->X, Link->Y);
shpitm->Pickup = IP_HOLDUP;
WaitA(10);
int ItemTile = shpitm->Tile;
int ItemCSet = shpitm->CSet;
ItemPopup(ItemTile, ItemCSet, itemID, message);
 
this do want i want but i dont want to see the item ... have a option to delete the item will just create?


#6 Emily

Emily

    Scripter / Dev

  • ZC Developers

Posted 12 August 2020 - 06:44 AM

`Remove(shpitm);`



#7 nyrox

nyrox

    Junior

  • Members
  • Location:Québec

Posted 12 August 2020 - 08:22 AM

thank a lot 



#8 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 12 August 2020 - 09:10 AM

In 2.53.x:

 

int do_getitemtile(int id)
{
    item i = Screen->CreateItem(id);
    i->HitYOffset = -32768;
    i->DrawYOffset = -32768;
    int t = i->OriginalTile;
    Remove(i);
    return t;
}

int do_getitemcset(int id)
{
    item i = Screen->CreateItem(id);
    i->HitYOffset = -32768;
    i->DrawYOffset = -32768;
    int c = i->CSet;
    Remove(i);
    return c;
}

 

While in 2.53.x, if you were to call Remove instantly, the function would work I intentionally placed it last, as in 2.55+, calling Remove may change via compiletime options and this would cause errors if it is used before reading from the item.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users