Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Scripted ani+show ani destroy itself.. (https://forums.graalonline.com/forums/showthread.php?t=72063)

JkWhoSaysNi 02-09-2007 10:08 PM

ah! You're right. It's being created serverside but destroyed clientside. I'll try destroying it serverside and see if it fixes it. :)

Edit: Thanks! That seems to have been my problem :D

Chandler 02-09-2007 10:38 PM

I'd recommend something like
HTML Code:

function onCreated()
{
  setTimer(5);
}
function onTimeout()
{
  this.destroy();
}
//#CLIENTSIDE
function onCreated()
{
  Yourclientsidepart...
}


Chompy 02-09-2007 10:43 PM

Quote:

Originally Posted by Chompy (Post 1275415)
Hmm, I've had this problem before (Float text), when the player is hurt, it places a gani at the players location with showani();
but sometimes they randomly appear around inside levels or on gmaps, like they
have just been hided or something.. anyone know how to destroy them (removing them from the level or something)?

Anyone can help me? :(
(Trying to destroy them from the gani)

Chandler 02-09-2007 10:51 PM

Quote:

Originally Posted by Chompy (Post 1275586)
Anyone can help me? :(
(Trying to destroy them from the gani)


Make the damage display a player.attribute. Remove the attribute once it's been used.

Chompy 02-09-2007 11:17 PM

Quote:

Originally Posted by Chandler (Post 1275594)
Make the damage display a player.attribute. Remove the attribute once it's been used.

Hmm, could you explain? :] I usually don't use player.attr for showing ganises :o
No experience at that area, the ganises with player.attrs :]

Chandler 02-09-2007 11:32 PM

Quote:

Originally Posted by Chompy (Post 1275604)
Hmm, could you explain? :] I usually don't use player.attr for showing ganises :o
No experience at that area, the ganises with player.attrs :]

Sorry for the long reply. I had to chase six youths who have just thrown a snowball at my house. I did it back to theirs!

HTML Code:

function onActionclientside(curOption, curMessage)
{
  if (temp.curOption == "addAttr")
  {
    this.attrSize.add(temp.curMessage);
    this.onTimeout();
  }
}
function onTimeout()
{
  if (this.doCount > 0)
  {
    this.doCount -= 0.05;
    if (this.doCount <= 0)
    {
      this.attrSize.delete(0);
      this.doCount = 0;
    }
    setTimer(0.05);
    return true;
  }
  if (this.attrSize.size() >
0)
  {
    player.attr[3] = "myGani," @ this.attrSize[0];
    this.doCount = 5; //Alter this to how long the display lasts
    setTimer(0.05);
  }
}

Maybe something like this?

Chompy 02-09-2007 11:38 PM

Quote:

Originally Posted by Chandler (Post 1275610)
Sorry for the long reply. I had to chase six youths who have just thrown a snowball at my house. I did it back to theirs!

HTML Code:

function onActionclientside(curOption, curMessage)
{
  if (temp.curOption == "addAttr")
  {
    this.attrSize.add(temp.curMessage);
    this.onTimeout();
  }
}
function onTimeout()
{
  if (this.doCount > 0)
  {
    this.doCount -= 0.05;
    if (this.doCount <= 0)
    {
      this.attrSize.delete(0);
      this.doCount = 0;
    }
    setTimer(0.05);
    return true;
  }
  if (this.attrSize.size() >
0)
  {
    player.attr[3] = "myGani," @ this.attrSize[0];
    this.doCount = 5; //Alter this to how long the display lasts
    setTimer(0.05);
  }
}

Maybe something like this?

Hmm, can you explain what it does?
Still not getting the player.attr[] stuff :[

Got any easier examples?

Chandler 02-09-2007 11:44 PM

Quote:

Originally Posted by Chompy (Post 1275617)
Hmm, can you explain what it does?
Still not getting the player.attr[] stuff :[

Got any easier examples?

Sure
HTML Code:

//#CLIENTSIDE
function onCreated()
{
  player.attr[3] = "bombermad_bomb.gani";
}

Would make the bombermad gani display over your graal character. Well, if you were to have that gani that is.

HTML Code:

//#CLIENTSIDE
function onPlayerChats()
{
  if (player.chat == ":setAttr")
  {
    temp.curAttr = player.chat.substring(8, 1);
    temp.curGani = player.chat.substring(9).trim();
    player.( @ "attr[" @ temp.curAttr @ "]") = (temp.curGani.ends(".gani")? temp.curGani: temp.curGani @ ".gani");
  }
}

:setAttr 3 myGani.gani
choose a gani from inside of your graal folder, which is a solid object for example.

Edit: I'll write a few documents explaining the advantages to using player attributes. :)

Chompy 02-10-2007 12:06 AM

Quote:

Originally Posted by Chandler (Post 1275620)
Sure
HTML Code:

//#CLIENTSIDE
function onCreated()
{
  player.attr[3] = "bombermad_bomb.gani";
}

Would make the bombermad gani display over your graal character. Well, if you were to have that gani that is.

HTML Code:

//#CLIENTSIDE
function onPlayerChats()
{
  if (player.chat == ":setAttr")
  {
    temp.curAttr = player.chat.substring(8, 1);
    temp.curGani = player.chat.substring(9).trim();
    player.( @ "attr[" @ temp.curAttr @ "]") = (temp.curGani.ends(".gani")? temp.curGani: temp.curGani @ ".gani");
  }
}

:setAttr 3 myGani.gani
choose a gani from inside of your graal folder, which is a solid object for example.

Edit: I'll write a few documents explaining the advantages to using player attributes. :)

Got it to work :D Thanks (btw, the :setattr stuff didn't work, made it into tokenize and had obj.starts(), but didn't work, but first example did, thanks!)

hmm, just one more thing.. on my server some weapons are faster, so alot of flaot texts will come..
so must I use a new player.attr for each flaot text, or can I use an existing attr more ganises?

Admins 02-10-2007 12:57 AM

Hmmm on Kingdoms we do it so that on serverside we set some player.attr[] to the gani script which displays the hp loss / damage taken. In the gani script onPlayerEnters() it emits a particle with "emitter.continueafterdestroy = true;" so the particle is continuing to move even if the gani script is deleted or restarted. To get several effects using the same gani script there are probably two says:
1. make the gani script being restarted, this can be done by setting the attr[] to "" and then setting the value again (it should be sent again and restart the script if it's not a CONTINUOUS gani, although I have not tested this fully yet)
2. store the actual data that should be displayed into another attr[] and in the gani script check if that data is changed and display another text or effect, let the gani script check for new data until it is removed (by using a 0.05 seconds timeout or so)

xXziroXx 02-10-2007 03:28 PM

Quote:

Originally Posted by JkWhoSaysNi (Post 1275555)
ah! You're right. It's being created serverside but destroyed clientside. I'll try destroying it serverside and see if it fixes it. :)

Edit: Thanks! That seems to have been my problem :D

You're welcome. :)

Chompy 02-10-2007 06:21 PM

Quote:

Originally Posted by Stefan (Post 1275653)
Hmmm on Kingdoms we do it so that on serverside we set some player.attr[] to the gani script which displays the hp loss / damage taken. In the gani script onPlayerEnters() it emits a particle with "emitter.continueafterdestroy = true;" so the particle is continuing to move even if the gani script is deleted or restarted. To get several effects using the same gani script there are probably two says:
1. make the gani script being restarted, this can be done by setting the attr[] to "" and then setting the value again (it should be sent again and restart the script if it's not a CONTINUOUS gani, although I have not tested this fully yet)
2. store the actual data that should be displayed into another attr[] and in the gani script check if that data is changed and display another text or effect, let the gani script check for new data until it is removed (by using a 0.05 seconds timeout or so)

Can you display text with emitters? If so, how then? >_<

cbk1994 02-12-2007 03:27 AM

Quote:

Originally Posted by Chompy (Post 1275840)
Can you display text with emitters? If so, how then? >_<

No ... that'd be weird.
Why would you want to do that?

Chompy 02-12-2007 04:12 PM

Quote:

Originally Posted by cbkbud (Post 1276440)
No ... that'd be weird.
Why would you want to do that?

I actualy you can display text with emitters .. :p

emitter.particle.text or emitter.particle.code


All times are GMT +2. The time now is 01:19 PM.

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