Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   with(findimg(1)) { (https://forums.graalonline.com/forums/showthread.php?t=134259848)

xAndrewx 07-15-2010 07:13 PM

with(findimg(1)) {
 
HTML Code:

      with (findimg(5)) {
        x = player.x + 5;
        y = player.y + 5;
       
        this.ani = "idle"
        this.dir = 1;
        this.layer = 1;
       
        this.playerlook = false;
        actor.headimg = playero.headimg;
        actor.bodyimg = playero.bodyimg;
        actor.shield = playero.shieldimg;   
      }

Doesn't seem to show for other players- any idea why o-o

DustyPorViva 07-15-2010 07:14 PM

I don't think you need to prefix the variables with "this."

xAndrewx 07-15-2010 07:17 PM

no fix :[

Inverness 07-15-2010 07:18 PM

Quote:

Originally Posted by DustyPorViva (Post 1587771)
I don't think you need to prefix the variables with "this."

You don't need to, but I often do it for clarity.

DustyPorViva 07-15-2010 07:22 PM

Quote:

Originally Posted by Inverness (Post 1587774)
You don't need to, but I often do it for clarity.

Aye, but in this case there is a fair amount of inconsistency.

Loriel 07-15-2010 07:53 PM

Quote:

Originally Posted by DustyPorViva (Post 1587771)
I don't think you need to prefix the variables with "this."

Surely using "this." makes it faster because it does not have to make lookups through the entire scope and then the scope of the with'ed object, and instead only the latter!

WhiteDragon 07-15-2010 08:15 PM

Quote:

Originally Posted by Loriel (Post 1587783)
Surely

This is where you went wrong.

Crow 07-15-2010 08:40 PM

Missing semicolon at this.ani = "idle"...?

DustyPorViva 07-15-2010 08:45 PM

Quote:

Originally Posted by Crow (Post 1587793)
Missing semicolon at this.ani = "idle"...?

lols!

xAndrewx 07-15-2010 08:51 PM

lol no xD

but thanks :[

It has to be the findimg :(

cbk1994 07-15-2010 09:22 PM

I've never had success with showani (or the GS2 equivalent) showing for other players :(.

xAndrewx 07-15-2010 09:34 PM

that makes sense... :[

Must be a graal error?

salesman 07-15-2010 09:38 PM

How are you showing the image?

I copied your code into a weapon script, and it works fine for me (I have two accounts logged on, and both accounts see the image).

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
setTimer(.05);
}

function 
onTimeout() {
  if (
keydown(0)) {
    
with (findimg(5)) {
      
player.5
      
player.5;
        
      
this.ani "idle";
      
this.dir 1;
      
this.layer 1;
        
      
this.playerlook false;
      
actor.headimg playero.headimg;
      
actor.bodyimg playero.bodyimg;
      
actor.shield playero.shieldimg;    
    }
  } else {
    
hideImg(5);
  }
  
  
setTimer(.05);


Edit: I know that image indexes < 200 will not show for all players in a level or DBNPC...it has to be a weapon.

xAndrewx 07-15-2010 09:40 PM

In a class =o

salesman 07-15-2010 09:44 PM

Yeah, that wont work...it needs to be in a weapon for it to show for all players (possibly in a class joined to the player, but I haven't tested that).

I remember when I was making a drawing tool, I tried to get past the 200 index limit by placing npcs every time my image index reached 200 and starting the index back at 1 for that npc. It worked fine on my client, but nobody else could see the images.


All times are GMT +2. The time now is 10:29 AM.

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