Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Custom baddies (https://forums.graalonline.com/forums/showthread.php?t=80889)

The_Kez 07-27-2008 08:24 PM

Custom baddies
 
I'm working on a system for custom baddies for my server. I already have the movement, targeting and attack systems done, so the more involved steps of creating a custom baddy are already done.

What should be the more simple step of creating a custom baddy is something I've never done before. Right now the custom baddies that I'm fighting are all block.png's, which doesn't make for a very interesting baddy. So can anyone tell me the technique for setting the animations on baddies?

My first thought was to simply create the baddy and that I'd be able to use replaceani, or setani on it, but since it isn't a showcharacter I'm not sure if that's possible.

Thanks!

Loriel 07-27-2008 08:26 PM

setcharani

The_Kez 07-27-2008 08:43 PM

Quote:

Originally Posted by Loriel (Post 1409061)
setcharani

This isn't a very ellaborative answer, I know there is such a command but I wouldn't have posted this forum topic if I didn't need help that required an answer beyond what the Graal wiki can provide.

When you use this command is it necessary to check the direction of the baddy? And since the baddy is not a showcharacter how can you check which direction the baddy is facing in the first place?

Or would actually making it a showcharacter and then using setcharani on it work well enough?

Loriel 07-27-2008 08:59 PM

If you are cool with the baddy being basically 32x32, showcharacter seems to be the way to go.

If not, you could emulate the whole thing with a bunch of clientside showanis and manually keeping track of the direction, I guess.

The_Kez 07-27-2008 09:07 PM

Well, it doesn't need to be anything complicated, so I suppose showcharacter will work for now.

cbk1994 07-27-2008 09:08 PM

Quote:

Originally Posted by The_Kez (Post 1409070)
This isn't a very ellaborative answer, I know there is such a command but I wouldn't have posted this forum topic if I didn't need help that required an answer beyond what the Graal wiki can provide.

When you use this command is it necessary to check the direction of the baddy? And since the baddy is not a showcharacter how can you check which direction the baddy is facing in the first place?

Or would actually making it a showcharacter and then using setcharani on it work well enough?

PHP Code:

function onCreated()
{
  
this.ani "myidle";
  
onMovementFinished();
}
function 
onMovementFinished()
{
  if ( 
shouldMove() )
  {
    
// move again
    
this.ani "mywalk";
  }
  else
  {
    
this.ani "myidle";
    
scheduleevent1"MovementFinished"", "" );
  }


Something like that has always worked for me. showcharacter() isn't neccesary.

Loriel 07-27-2008 09:12 PM

Quote:

Originally Posted by cbk1994 (Post 1409087)
[PHP]
Something like that has always worked for me. showcharacter() isn't neccesary.

Do you not get funny blocking behaviour without showcharacter?

The_Kez 07-27-2008 09:12 PM

Hmm. Something like that would be nice but that brings back the question of; if it's not a showcharacter then how do you decide which direction the baddy is facing so that the gani will work properly?

cbk1994 07-27-2008 09:14 PM

Quote:

Originally Posted by Loriel (Post 1409089)
Do you not get funny blocking behaviour without showcharacter?

Nope :o
Quote:

Originally Posted by The_Kez (Post 1409090)
Hmm. Something like that would be nice but that brings back the question of; if it's not a showcharacter then how do you decide which direction the baddy is facing so that the gani will work properly?

You don't have to use showCharacter() to change this.dir.

The_Kez 07-27-2008 09:25 PM

Quote:

You don't have to use showCharacter() to change this.dir.
Okay so my custom movement system would have to calculate which direction to turn the baddy.
I now see why so many people would like to see a basic open-source baddy.

cbk1994 07-27-2008 09:46 PM

Quote:

Originally Posted by The_Kez (Post 1409096)
Okay so my custom movement system would have to calculate which direction to turn the baddy.
I now see why so many people would like to see a basic open-source baddy.

getDir( targetx - this.x, targety - this.y );

The_Kez 07-27-2008 09:53 PM

Quote:

Originally Posted by cbk1994 (Post 1409101)
getDir( targetx - this.x, targety - this.y );

Awesome thanks

Inverness 07-27-2008 10:09 PM

Source code?


All times are GMT +2. The time now is 12:06 AM.

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