![]() |
|
|
#1 |
|
Архивный участник
Join Date: Feb 2006
Posts: 453
|
first lets look on common code for aggro mobs:
class warrior_aggressive_patrol : warrior_patrol inside SEE_CREATURE handler: Code:
EventHandler SEE_CREATURE(creature, myself) {
if ((GetLifeTime() > 7) && InMyTerritory(myself.sm)) {
AddAttackDesire(creature, 1, 200);
}
}
// 3 functions called (1+2)
sorry, 200 - is not distance.. its something like probability easy, we can change 200 to 500 or to 50 to some mobs, just for diversify somehow mobs behaviour or we can add something like "if Rand(100)<5" so mob will desire attack only 5% and turn on your lively imagination =) example 1: what if mob desire attack players with level>40 only? example 2: what if mob desire attack only if player not have some quest item (OwnItemCount function) hmm.. (almost same as "silence" skill =))? example 3: what if mob desire attack orcs only ? etc... etc... |
|
|
|
|
#2 |
|
Архивный участник
Join Date: Jan 2006
Posts: 69
|
nice thx
|
|
|
|
|
#3 | |
|
Архивный участник
Join Date: Feb 2006
Posts: 453
|
Quote:
Code:
EventHandler SEE_CREATURE(creature, myself) {
if ((GetLifeTime() > 7) && (creature.level > 40) && InMyTerritory(myself.sm)) {
AddAttackDesire(creature);
}
}
Code:
EventHandler SEE_CREATURE(creature, myself) {
if ((GetLifeTime() > 7) && (OwnItemCount(creature, MaigcItemID)!=0) && InMyTerritory(myself.sm)) {
AddAttackDesire(creature);
}
}
Code:
EventHandler SEE_CREATURE(creature, myself) {
if ((GetLifeTime() > 7) && (creature.race == OrcRaceID) && InMyTerritory(myself.sm)) {
AddAttackDesire(creature);
}
}
|
|
|
|
|
|
#4 |
|
Архивный участник
Join Date: Feb 2006
Posts: 453
|
example 4. coward mob (run from high level players) =)
Code:
EventHandler SEE_CREATURE(creature, myself) {
if ((creature.level-myself.level)>20)
{
AddFleeDesire(creature, 200);
}
else if ((GetLifeTime() > 7) && InMyTerritory(myself.sm)) {
AddAttackDesire(creature);
}
}
|
|
|
|
|
#5 |
|
Архивный участник
Join Date: May 2005
Posts: 81
|
nice tutorial HD thx
|
|
|
|
|
#6 | |
|
Архивный участник
Join Date: Mar 2006
Posts: 57
|
Quote:
|
|
|
|
|
|
#7 | ||
|
Архивный участник
Join Date: Feb 2006
Posts: 453
|
Quote:
guard handler is just: Code:
EventHandler SEE_CREATURE(creature) {
if (creature.karma > 0) {
AddAttackDesire(creature, 0, 1500);
}
}
// 1 functions called (1+0)
2. called each time when new player appears nearby 3. called ? after EnableMakingSeeEvent() (not tested, if its true - add this using AddTimerEx(), handlers CREATED, TIMER_FIRED using e.g. 30 seconds) you can also try to use handler from class guard_move_around Code:
EventHandler NO_DESIRE() {
AddMoveAroundDesire(5, 5);
}
or try put there EnableMakingSeeEvent(); instead of around desire... anyway... more expeiments = better results |
||
|
|
|
|
#8 |
|
Архивный участник
Join Date: Mar 2006
Posts: 57
|
Thanks, we'll try this (moving around maybe) and also if there is any fox for veil when you're PK.
|
|
|
|
|
#9 |
|
Архивный участник
Join Date: Mar 2006
Posts: 97
|
Great tutorial. Respect HD
|
|
|
|
|
#10 | ||
|
Архивный участник
Join Date: Feb 2005
Posts: 357
|
Quote:
|
||
|
|
|
|
#11 |
|
Архивный участник
Join Date: May 2005
Posts: 2,033
|
he didnt say its possible...
he ASKED IF its possible...
|
|
|
|
|
#12 |
|
Архивный участник
Join Date: Apr 2005
Posts: 127
|
what about time ?
som like spawn mob only on monday? or mog say somthing every hour (for example "2:00 PM ! please take a rest for eat !"). and other thing: mob teleport/kill/giveitem only 2/3/5 playres choisen by som criteria. (now i use stupid system when mog when choise player by see_creature(own item) taking damage and when choic another just die and cant choice more >< ) thx forward. |
|
|
|
|
#13 | |
|
Архивный участник
Join Date: May 2005
Posts: 2,033
|
Quote:
at least the 2nd thingy when used together with the Say function... (NASC) |
|
|
|
|
|
#14 |
|
Архивный участник
Join Date: Oct 2005
Posts: 267
|
Various time thingies from nasc
EventHandler TIME() {} Castle_GetRawSystemTime(); EnableTimeEvent(i0); SayInt(time); All of which would allow you to manage timed events. |
|
|
|
|
#15 |
|
Архивный участник
Join Date: Apr 2005
Posts: 42
|
Another good job HD, you are sexy <3
|
|
|
|
|
#16 |
|
Архивный участник
Join Date: Feb 2006
Posts: 453
|
also... u can use somthing like below to see when handler works
Code:
EventHandler SEE_CREATURE(creature) {
Say(creature.name);
}
|
|
|
|
|
#17 |
|
Архивный участник
Join Date: Mar 2006
Posts: 57
|
Mmm, this is like the printfs for a first debugging, great idea, I'll consider it when I have time to "play" with AI.
Thank you very much master
|
|
|
|
|
#18 | |
|
Архивный участник
Join Date: Apr 2006
Posts: 70
|
Quote:
200 it's a desire! :roll: But you have a nice idea! :wink: |
|
|
|
|
|
#19 | |
|
Архивный участник
Join Date: Apr 2006
Posts: 70
|
Quote:
Code:
EventHandler SEE_CREATURE(creature) {
if (creature.karma > 0) {
if (creature.karma > 1000) AddAttackDesire(creature, 1, 1500);
else AddAttackDesire(creature, 0, 1500);
}
}
|
|
|
|
|
|
#20 |
|
Архивный участник
Join Date: Apr 2005
Posts: 127
|
btw
on oficial servers some mobs use only magic. no physical attack. ive make som changes in warrior_casting_ddmagic and create new class here is example Code:
EventHandler ATTACKED(attacker, damage)
{
{
if(attacker.is_pc != 0 || IsInCategory(@summon_npc_group, attacker.npc_class_id))
AddUseSkillDesire(attacker, DDMagic, @ST_ATTACK, @AMT_MOVE_TO_TARGET, 1000000);
AddAttackDesire(attacker, @AMT_MOVE_TO_TARGET, (damage/myself.sm.max_hp/0.05) * 100);
}
}
but skills have reload time and when skill is reloading mob hit by physical attack. ive createt special class and replace all warrior_casting_ddmagic with that. and aggro to. looks nice. |
|
|
|
|
#21 |
|
Архивный участник
Join Date: May 2006
Posts: 9
|
if it works it sounds like an awsome idea
|
|
|
|
|
#22 |
|
Архивный участник
Join Date: Apr 2006
Posts: 23
|
NASC seems to be haunted with some kind of evil force that opposes me when I try to do smth with ai
)I can't understand why when I first compile a txt file with a script, NASC says that there are errors, but when I add a space somewhere in script, compile it, than remove that space - and NASC says "Success!!!". Moving a "{" symbol to the next line could "fix" a bunch of errors... What the ?.. Is there some kind of "random error generator" built-in in NASC?)) |
|
|
|
|
#23 |
|
Архивный участник
Join Date: May 2006
Posts: 24
|
handler 5 have problem
because handler 5 is l2NPC offer one touch off event NPC must update npcinfo all the time you can made a test you fist summon a guard_npc then //setkarma npc must update npcinfo ,so,npc attack you |
|
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|