Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Hat system help (https://forums.graalonline.com/forums/showthread.php?t=134265553)

r3ckless 01-10-2012 11:01 PM

Hat system help
 
Hello, I'm trying to script part of a hat system. I have the hats, the shops etc. Im now stuck on scripting free hats you can find around the world. Something similar to UN. Below is what I have, it works except for one thing...it doesn't hide after it has been received! Could somebody please give me some tips on this/point me in the right direction for this...

PHP Code:

// NPC made by Stowen

function onCreated(){
  
blockagain();
  
setshape(1,32,32);
}

function 
onActionGrab() {
  
clientr.hat3 1;
  
client.hats.add("hat3.png");
  
player.chat "You received the Western Hat!";
  
hide;
  
hideimg 200;
}

//#CLIENTSIDE

function onPlayerEnters() {
  if (!
clientr.hat3) {
    
with(findimg(200)){
      
image "hat3.png";
      
this.x;
      
this.y;
      
partx 100;
      
party 0;
      
parth 40;
      
partw 45;
    }
  }else 
hide;
}

function 
onCreated(){
  
blockagain();
  
setshape(1,32,32);
}

function 
Hide() {
hide;



callimuc 01-10-2012 11:32 PM

Quote:

Originally Posted by r3ckless (Post 1681462)
Hello, I'm trying to script part of a hat system. I have the hats, the shops etc. Im now stuck on scripting free hats you can find around the world. Something similar to UN. Below is what I have, it works except for one thing...it doesn't hide after it has been received! Could somebody please give me some tips on this/point me in the right direction for this...

script..

It´s not the securest one. You should look around for more secure ways. Anyway this should work:

PHP Code:

// NPC made by Stowen
function onCreated(){
  
blockagain();
  
setshape(1,32,32);
}

function 
onActionGrab() {
  
clientr.hat3 1;
  
clientr.hats.add("hat3.png");
  
player.chat "You received the Western Hat!";
}

//#CLIENTSIDE
function onPlayerEnters() {
  if (!
clientr.hat3) {
    
setimgpart("hat3.png"9604848);
  }
  else
    
hide();
}

function 
onCreated() {
  if (!
clientr.hat3) {
    
blockagain();
    
setshape(1,32,32);
  }
  else 
dontblock();



Tolnaftate2004 01-10-2012 11:38 PM

Quote:

Originally Posted by callimuc (Post 1681465)
It´s not the securest one. You should look around for more secure ways. Anyway this should work:

PHP Code:

...

  
hide();
}

//#CLIENTSIDE
... 


This is going to hide for everyone until they re-enter the level.

callimuc 01-10-2012 11:54 PM

Oh totally forgot about that. Just checked some GS1->GS2 stuff and missed that one while doing the rest. Fixed the post.

r3ckless 01-11-2012 02:30 AM

Still the same problem...it still won't hide after being grabbed....It adds the flags and such, but the hat doesnt hide after it is grabbed.

EDIT: Nevermind, I solved my own problem. :)

Skyld 01-11-2012 01:59 PM

Renamed the thread to a more suitable title; please see the posting guidelines.

r3ckless 01-12-2012 05:55 AM

Alright, sorry. I'll read that next time.


All times are GMT +2. The time now is 01:58 AM.

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