Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Set layers and RGB/alpha in GuiDrawingPanel (https://forums.graalonline.com/forums/showthread.php?t=134266591)

callimuc 06-07-2012 02:39 AM

Set layers and RGB/alpha in GuiDrawingPanel
 
Is it possible to change / set layers in the GuiDrawingPanel aswell as the RGB/alpha value? I'm messing around with something on Delteria which does display the tiles inside the DrawingPanel, the NPCs but the NPCs and players.
But the NPCs dont have the proper layer. Aswell I couldn't find any way how I could fix the problem with the RGB and alpha. Using maskimage(x, y, img, mode) was the only solution I could find which is not perfect. While using drawObject(x, y, obj) it doesnt seem to be a problem or atleast I couldnt find one yet.
This is the code I am using:
PHP Code:

for (temp.nnpcs) {
  if (
n.visible && n.x in |player.x-(player.x%64), (player.x-(player.x%64))+63.95| && n.y in |player.y-(player.y%64), (player.y-(player.y%64))+63.95|) {
    if (
temp.n.image != NULL && temp.n.ani == NULL) {
      if (
temp.n.alpha == 1) {
        
drawimagestretched(((n.x%64)*16)/ir, ((n.y%64)*16)/irgetImgWidth(n.image)/irgetImgHeight(n.image)/irn.image00getImgWidth(n.image), getImgHeight(n.image));
      }
      else {
        
maskimage(((n.x%64)*16)/ir, ((n.y%64)*16)/irn.image"add");
      }
    }
    else if (
temp.n.ani != NULL) {
      
drawobject(((n.x%64)*16)/ir, ((n.y%64)*16)/irn);
    }
  }
}
for (
temp.pplayers) {
  if (
p.x in |player.x-(player.x%64), (player.x-(player.x%64))+63.95| && p.y in |player.y-(player.y%64), (player.y-(player.y%64))+63.95|) {
    if (
p.alpha 0drawobject(((p.x%64)*16)/ir, ((p.y%64)*16)/irp);
  }


Screenshot:
http://uploads.graalcenter.org/upload/screenshot_3.png

fowlplay4 06-07-2012 02:48 AM

No, so you have to determine and draw each layer.

callimuc 06-07-2012 03:09 AM

Ok, thanks.

Recently I found another bug:
Sometimes NPCs do seem to disappear while checking for them. I have to update the level to get them back. But they do get displayed in the GUI. How does it come that some disappear, some wont and how can that get fixed?

The script of the NPC which disappears
PHP Code:

// Created by Alex Stravier
join("npcdefault");
function 
onCreated() {
  
showcharacter();
  
this.head "kouji-head.png";
  
this.skin "orange";
  
this.shoes "orange";
  
this.sleeves "red";
  
this.belt "red";
  
this.coat "red";
  
this.dir 2;
  
this.ani "sit";
  
this.body "xor-body.png";
  
//this.nick = "Simon Fowl";
  
this.-= 0.5;
  
this.0.5;

  
this.chat "Absolutely, 100% no.";


The script of the NPC next to the disappearing NPC
PHP Code:

// Created by Alex Stravier
join("npcdefault");
function 
onCreated() {
  
showcharacter();
  
this.head "headrexx.png";
  
this.body "arwind-josey-body102.gif";
  
this.skin "orange";
  
this.shoes "orange";
  
this.sleeves "brown";
  
this.belt "gray";
  
this.coat "brown";
  
this.hat "hat777.png";
  
this.dir "right";
  
this.ani "sit";
  
this.nick "";
  
this.-= 0.5;
}

this.join("npc");

//#CLIENTSIDE

function onCreated() {
  
this.join("npc");
  
setnpcfeature("nickname""Rexx");
  
setnpcfeature("nicknamecolour""brown");



http://uploads.graalcenter.org/upload/screenshot2.png

Emera 06-07-2012 03:25 AM

It might be an issue with my npc class :P I'll have a look.
EDIT: Nope. Not my class.

xXziroXx 06-07-2012 03:35 AM

Quote:

Originally Posted by callimuc (Post 1696636)
Ok, thanks.

Recently I found another bug:
Sometimes NPCs do seem to disappear while checking for them. I have to update the level to get them back. But they do get displayed in the GUI. How does it come that some disappear, some wont and how can that get fixed?

The script of the NPC which disappears
PHP Code:

// Created by Alex Stravier
join("npcdefault");
function 
onCreated() {
  
showcharacter();
  
this.head "kouji-head.png";
  
this.skin "orange";
  
this.shoes "orange";
  
this.sleeves "red";
  
this.belt "red";
  
this.coat "red";
  
this.dir 2;
  
this.ani "sit";
  
this.body "xor-body.png";
  
//this.nick = "Simon Fowl";
  
this.-= 0.5;
  
this.0.5;

  
this.chat "Absolutely, 100% no.";


The script of the NPC next to the disappearing NPC
PHP Code:

// Created by Alex Stravier
join("npcdefault");
function 
onCreated() {
  
showcharacter();
  
this.head "headrexx.png";
  
this.body "arwind-josey-body102.gif";
  
this.skin "orange";
  
this.shoes "orange";
  
this.sleeves "brown";
  
this.belt "gray";
  
this.coat "brown";
  
this.hat "hat777.png";
  
this.dir "right";
  
this.ani "sit";
  
this.nick "";
  
this.-= 0.5;
}

this.join("npc");

//#CLIENTSIDE

function onCreated() {
  
this.join("npc");
  
setnpcfeature("nickname""Rexx");
  
setnpcfeature("nicknamecolour""brown");



http://uploads.graalcenter.org/upload/screenshot2.png

Already a reported issue.

http://forums.graalonline.com/forums...39&post1690139 + the next couple of posts.

callimuc 06-07-2012 04:28 AM

Quote:

Originally Posted by xXziroXx (Post 1696638)
Already a reported issue.

http://forums.graalonline.com/forums...39&post1690139 + the next couple of posts.

Thanks a lot.

Emera 06-07-2012 01:27 PM

Whatever you've got going there, it looks really nice. Good job.


All times are GMT +2. The time now is 11:27 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.