Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-08-2007, 10:31 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
Scripted ani+show ani destroy itself..

I have a scripted ani being shown by a weapon NPC.

I want that ani to hide itself after it's finished (i tried destroy() in the ani but it didn't work) so I thought I could do something like:

PHP Code:
showani(i,x,y,0,"ani",i); 
Then in the ani:
PHP Code:
SCRIPT
function onPlayerEnters() {
    
this.indexnum params[0];
    
setTimer(0.05);

}
function 
onTimeout() {
    
this.count++;
...
    if (
this.count == 100) {
         
with(findweapon("weapon")) {
             
hideimg(this.indexnum);
         }
    }
setTimer(0.05);

}
SCRIPTEND 
This causes an access violation... but as far as I can tell the logic is correct.


Is what I want to do possible?
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #2  
Old 02-08-2007, 10:44 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
I'm not too sure if that would work. However, to be sure I'd make the
HTML Code:
if (this.count == 100) {
to:
HTML Code:
if (this.count => 100) {
Unfortanetly, I can't debug anything as of late. V$:C is down!
Reply With Quote
  #3  
Old 02-08-2007, 10:47 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
I actually had that, but I thought that might have been the cause of the access violation, if it looped round again it will try to hide the image again. It doesn't make any difference, still gives access violation
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #4  
Old 02-08-2007, 10:49 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Is the object to follow a player? What's the objects purpose?
Reply With Quote
  #5  
Old 02-08-2007, 10:52 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
It stays exactly where it's placed.

It's a fire ani I scripted, it 'burns out' after 100 timeouts. I can hide the stuff created by the ani but not the actual ani placed by the weapon/

It's displayed serverside using ids <200.
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #6  
Old 02-08-2007, 10:55 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Ah, why're you displaying it serverside? Some kind of damage effect I assume.

I would've thought that destroy inside the gani would have done it, but you've already tried that. Weird.
Reply With Quote
  #7  
Old 02-08-2007, 11:00 PM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
Make sure "weapon" isn't trying to modify the image/gani in any way after hiding.

Also, I think this.indexnum should be thiso.- ?
__________________
◕‿‿◕ · pfa · check yer syntax! · src

Killa Be: when i got that locker in 6th grade the only thing in it was a picture of a midget useing a firehose :/
Reply With Quote
  #8  
Old 02-08-2007, 11:05 PM
JkWhoSaysNi JkWhoSaysNi is offline
Ruler of the graalaxy
Join Date: Feb 2005
Location: Great Britain
Posts: 488
JkWhoSaysNi is on a distinguished road
Send a message via ICQ to JkWhoSaysNi
You're right, it should be thiso I changed that and it still causes an access violation when hideimg is called. All the weapon NPC does is show the ani, it doesnt do anything else with it.
__________________

Coming soon (Hopefully:P)
Reply With Quote
  #9  
Old 02-09-2007, 10:46 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
It should not hide itself, that's not working right now, and doesn't make a lot of sense in gani scripts anyway since it's running on each client and you only want to hide it on the client/server that controls the object. Just let the gani script stop displaying something and let a weapon or npc control the showing/hiding of the gani script attr[] (or showimg).
Reply With Quote
  #10  
Old 02-09-2007, 04:06 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Hmm, I've had this problem before (Float text), where when the player is hurt, it places a gani at the players location with showani( ... );
but sometimes they randomly appear around inside levels or gmaps, like they
have just been temporaly hided or something.. anyone know how to destroy them (removing them from the level or something)?
__________________
Reply With Quote
  #11  
Old 02-09-2007, 10:43 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Chompy View Post
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)
__________________
Reply With Quote
  #12  
Old 02-09-2007, 10:51 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by Chompy View Post
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.
Reply With Quote
  #13  
Old 02-09-2007, 11:17 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Chandler View Post
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 :]
__________________
Reply With Quote
  #14  
Old 02-09-2007, 11:32 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Quote:
Originally Posted by Chompy View Post
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?
Reply With Quote
  #15  
Old 02-09-2007, 05:41 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Well I'm at school now so I can't test this for now.
You could get the object of the gani and join it to a class that destroys itself after a time limit.
__________________
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 05:09 PM.


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