Graal Forums

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

skillmaster19 03-20-2011 11:21 PM

NPC combat
 
I have created a NPC that you can kill by slashing it three times, and respawns in a different spot after 5 seconds of dieing(also shows the dead gani.)

However, I am stuck with making the NPC actually fight and kill the player. where are the scripts documented that I would best use to make the NPC follow the player/ walk around, swing its sword, shoot a projectile such as an explosive, etc?

fowlplay4 03-20-2011 11:36 PM

I would recommend taking a look at Gambet's gBaddy 3.0

Source:
http://forums.graalonline.com/forums...hp?t=134258428

skillmaster19 03-20-2011 11:48 PM

Quote:

Originally Posted by fowlplay4 (Post 1637824)
I would recommend taking a look at Gambet's gBaddy 3.0

Source:
http://forums.graalonline.com/forums...hp?t=134258428

That is nice, but it seems a little too complicated for me at the time (im new to gscript2)

is there any basic ways to make a simple baddy?

xAndrewx 03-20-2011 11:59 PM

no

fowlplay4 03-21-2011 12:11 AM

Quote:

Originally Posted by skillmaster19 (Post 1637830)
That is nice, but it seems a little too complicated for me at the time (im new to gscript2)

is there any basic ways to make a simple baddy?

Well it's about breaking it down into pieces...

PHP Code:

function onCreated() {
  
setTimer(0.1);
}

function 
onTimeout() {
  
setTimer(1);
  
baddyLogic();
}

function 
baddyLogic() {
  if (
hasTarget()) {
    if (
targetInAttackRange()) {
      
attackTarget();
    } else {
      if (
targetInChaseRange()) {
        
chaseTarget();
      } else {
        
returnHome();
      }
    }
  } else {
    
findTarget();
  }
} 


skillmaster19 03-22-2011 11:33 PM

Got the baddy to work :D (and yes I did most of it myself)

Now I am attempting to make baddies that shoot arrows and cause explosions. I noticed there are functions for this in gs1, but are there some in GS2? if so, what are they?


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

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