Minecraft Inventar

  • GM 8

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Minecraft Inventar

    Hi Leute, hab ma ne Frage:

    Ich würde gerne so ein Inventar wie bei Minecraft machen. (Auch mit dem Stoffe transformieren) Leider hab ich keine Ahnung wie man so was macht. Könnte mir bitte jemand ein Example machen?
  • jou,ich brauch auch iventar.
    hab wenig erfahrung in scripten
    ,seh mir aber gerne agumente und hilfen an.
    scriptsammlung themen: 23

    aktuelles projekt: nix

    wer was wissen will fragt!


    "die black pearl ist mehr alls nur ein schiff,jack.es ist die freiheit"
  • Hab vor längerem mal sowas gemacht:

    Neues Inventar:

    GML-Quellcode

    1. var inewfor (inew=1; inew<11; inew+=1){global.place[inew]=""global.place_count[inew]=0global.place_draw[inew]=spr_emty_inv}



    Freien Platz rausfinden (scr_globalfree)

    GML-Quellcode

    1. var ifree
    2. for (ifree=1; ifree<11; ifree+=1) if string(global.place[ifree])="" {global.free=ifree; exit;}



    Inventar säubern (Anzal 0 -> Rauswurf)

    GML-Quellcode

    1. var iclean
    2. for (iclean=1; iclean<11; iclean+=1) if global.place_count[iclean]=0 {global.place[iclean]="" global.place_draw[iclean]=spr_emty_inv}



    Etwas dem Inventar hinzufügen:

    GML-Quellcode

    1. var iadd1
    2. for (iadd1=1; iadd1<11; iadd1+=1) if string(global.place[iadd1])=argument0 {global.place_count[iadd1]+=1; exit;}
    3. scr_globalfree()for (iadd2=0; iadd2<11; iadd2+=1) {if global.free=iadd2 {global.place[iadd2]=argument0; global.place_count[iadd2]=1; global.place_draw[iadd2]=argument1; exit;}}



    Inventar speichern

    GML-Quellcode

    1. ini_open(global.file)var isave
    2. for (isave=1; isave<11; isave+=1) {if string(global.place[isave])!="" {ini_write_string("Inventory","global.place["+string(isave)+"]",global.place[isave]) ini_write_string("Inventory","global.place_count["+string(isave)+"]",string(global.place_count[isave])) ini_write_string("Inventory","global.place_draw["+string(isave)+"]",string(global.place_draw[isave]))}}



    Inventar laden

    GML-Quellcode

    1. ini_open(global.file)var iload
    2. for (iload=1; iload<11; iload+=1) global.place[iload]=ini_read_string("Inventory","global.place["+string(iload)+"]","") global.place_count[iload]=ini_read_real("Inventory","global.place_count["+string(iload)+"]",0) global.place_draw[iload]=ini_read_real("Inventory","global.place_draw["+string(iload)+"]",spr_emty_inv)


    Variablen:
    global.place[1-10] - Ein string mit einer Id des Items
    global.place_count[1-10] - Anzahl des Items
    global.place_draw[1-10] - Sprite des Items

    Drawen musst dus selbst. :p