Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-20-2007, 06:35 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Yet another gani script question...

I have a gani script so that it shows player hp and nicks.

The gani is working fine, but just that if I am with another player and I leave the level, I no longer see the text from that player at all, but I still see the text from my player. If either of us reconnect, the text from the other player reappears.

Any ideas?
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #2  
Old 02-20-2007, 07:03 AM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
Quote:
Originally Posted by napo_p2p View Post
I have a gani script so that it shows player hp and nicks.

The gani is working fine, but just that if I am with another player and I leave the level, I no longer see the text from that player at all, but I still see the text from my player. If either of us reconnect, the text from the other player reappears.

Any ideas?
Showing the scripts involved helps a tad!
__________________
Reply With Quote
  #3  
Old 02-20-2007, 07:13 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Kristi View Post
Showing the scripts involved helps a tad!
lol, I was going to come back to this and add them, and completely forgot.

Here is some code that sets up the gani to an attr and some sample attrs that the ganis uses:
PHP Code:
player.attr[10] = "opan_playerstats.gani";
player.attr[11] = "15/15";
player.attr[12] = "0/0"
Here is the gani script:
PHP Code:
function onPlayerEnters() {
  
temp.i;
  
temp.stattemp.stats
  
stats = {"nick""hp""armor"};
  
  
0;
  for (
statstats) { 
    
with (findimg(201 i)) {
      
font "Verdana";
      
style "cb";
      
zoom = (stat == "nick") ? 0.7:0.5;
      
layer 1;
      
textshadow true;
      
shadowcolor = {111};
      
shadowoffset = {0.10.1};
      if (
stat == "armor") {
        
red 0;
        
green 0;
        
blue 1;
      }
      
thiso.(stat "img") = this;
    }
    
i++;
  }

  
setTimer(0.05);
}

function 
onTimeOut() {
  
this.nickimg.player.1.5;
  
this.nickimg.player.3.2;
  
this.nickimg.text player.nick;

  
this.hpimg.player.1.5;
  
this.hpimg.player.1;
  
this.hpimg.text "HP: " player.attr[11];
  
temp.colors hpColor(player.attr[11]);
  
this.hpimg.red temp.colors[0];
  
this.hpimg.green temp.colors[1];
  
this.hpimg.blue temp.colors[2];

  
this.armorimg.player.1.5;
  
this.armorimg.player.4;
  
this.armorimg.text "Armor: " player.attr[12];
  
setTimer(0.05);
}

function 
hpColor(pattr) {
  
temp.hp temp.pattr.substring(0temp.pattr.pos("/"));
  if (
temp.hp >= 7) {
    return {
0,1,0,1};
  }
  else if (
temp.hp >= 4) {
    return {
1,1,0,1};
  }
  else {
    return {
1,0,0,1};
  }

__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.

Last edited by napo_p2p; 02-20-2007 at 10:44 AM..
Reply With Quote
  #4  
Old 02-20-2007, 09:58 AM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Kristi [Hell Raven] sometimes uses "thiso.(stat @ "img") = this;" things similar to this. It works, however I don't really know much about it.
Maybe try "thiso.(stat @ "img") = findIMG(201 + i);".
Reply With Quote
  #5  
Old 02-20-2007, 10:12 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Chandler View Post
Kristi [Hell Raven] sometimes uses "thiso.(stat @ "img") = this;" things similar to this. It works, however I don't really know much about it.
Maybe try "thiso.(stat @ "img") = findIMG(201 + i);".
Yeah, I tried both . Same thing.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #6  
Old 02-20-2007, 11:53 AM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
Read this:
thiso.(stat @ "img") = this;

Now read this:
this.nickimg.x = player.x + 1.5;

thiso. to this. MIGHT be a problem? :o Just a guess. Fix that up first, then if theres still a problem report back, and I will finish looking at it.
__________________
Reply With Quote
  #7  
Old 02-21-2007, 02:18 AM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
The script looks ok. The text disappears when you leave the level (where the other guy is) and then come back to that level ? Both see the text of the other player disappearing?
Reply With Quote
  #8  
Old 02-21-2007, 08:14 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Kristi View Post
Read this:
thiso.(stat @ "img") = this;

Now read this:
this.nickimg.x = player.x + 1.5;

thiso. to this. MIGHT be a problem? :o Just a guess. Fix that up first, then if theres still a problem report back, and I will finish looking at it.
Well, thiso. is just a way to refer to the weapon script's 'this.' flags (distinguishes them from the img's this. flags), so it should act the same. I still tried both ways too and got the same thing .

Quote:
Originally Posted by Stefan View Post
The script looks ok. The text disappears when you leave the level (where the other guy is) and then come back to that level ?
Yes.

Quote:
Originally Posted by Stefan View Post
Both see the text of the other player disappearing?
No, it just happens to me.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #9  
Old 02-22-2007, 12:40 AM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
The playerenters function (same as playercreated) does not happen again when you reenter a room with a player youve already met in a gani (apparently). instead, the timeout keeps going. Likewise, leaving the room is destroying the objects, so when you return, there is nothing to reference. This is my solution.

PHP Code:
function onCreated() {
  
onTimeout();
}

function 
createStat(i,stat) {
  
with (findimg(201 i)) {
    
font "Verdana";
    
style "cb";
    
zoom = (stat == "nick") ? 0.7:0.5;
    
layer 1;
    
textshadow true;
    
shadowcolor = {111};
    
shadowoffset = {0.10.1};
    if (
stat == "armor") {
      
red 0;
      
green 0;
      
blue 1;
    }
    
thiso.(stat "img") = this;
  }
}

function 
onTimeOut() {
  
temp.i;
  
temp.stattemp.stats
  
stats = {"nick""hp""armor"};
  
  
0;
  for (
statstats) { 
    if(
this.(stat "img").font != "Verdana"// Does not exist
      
createStat(i,stat);
    
i++;
  }
  
this.nickimg.player.1.5;
  
this.nickimg.player.3.2;
  
this.nickimg.text player.nick;

  
this.hpimg.player.1.5;
  
this.hpimg.player.1;
  
this.hpimg.text "HP: " player.attr[11];
  
temp.colors hpColor(player.attr[11]);
  
this.hpimg.red temp.colors[0];
  
this.hpimg.green temp.colors[1];
  
this.hpimg.blue temp.colors[2];

  
this.armorimg.player.1.5;
  
this.armorimg.player.4;
  
this.armorimg.text "Armor: " player.attr[12];
  
setTimer(0.05);
}

function 
hpColor(pattr) {
  
temp.hp temp.pattr.substring(0temp.pattr.pos("/"));
  if (
temp.hp >= 7) {
    return {
0,1,0,1};
  }
  else if (
temp.hp >= 4) {
    return {
1,1,0,1};
  }
  else {
    return {
1,0,0,1};
  }

__________________

Last edited by Kristi; 02-22-2007 at 12:54 AM..
Reply With Quote
  #10  
Old 02-22-2007, 12:43 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Kristi View Post
The playerenters function (same as playercreated) does not happen again when you reenter a room with a player youve already met in a gani (apparently). instead, the timeout keeps going. Likewise, leaving the room is destroying the objects, so when you return, there is nothing to reference. This is my solution.
That did it. TYVM .
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:10 PM.


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