unitattack clarification...

xienne15

New member
Messages
120
Points
0
*unitattack <GID>,<Target ID>{,<action type>};*unitattack <GID>,"<Target Name>"{,<action type>};

does this mean i can make npc attack monsters? if it is can you give me a sample script?

 
I don't think an npc attacking or using actual skills (not just effects) will get a nice behavior in the emulator. I bet you can make it but you'll probably get a server crash or a huge warning, since npcs don't have any atk value.

What you can do with it is maybe making a monster attack another monster provided you have their GIDs. Or a player attacking some other thing without actually ordering his player character himself.

But as said, I don't think making a npc attacking or being attacked is a big idea.

 
I don't think an npc attacking or using actual skills (not just effects) will get a nice behavior in the emulator. I bet you can make it but you'll probably get a server crash or a huge warning, since npcs don't have any atk value.

What you can do with it is maybe making a monster attack another monster provided you have their GIDs. Or a player attacking some other thing without actually ordering his player character himself.

But as said, I don't think making a npc attacking or being attacked is a big idea.
how if i use a monster ID as a NPC ID?

 
GID stands for Game ID. Every in-game object has a Game ID. For players it's the same than their RID, which is also their Account ID. For mobs, it's quite more complicated since here in Hercules the Mob Control suite isn't available.

You could use the monster command, spawning 1 only monster and setting what it returns to a variable and then using the unit* commands with it. Refer to some part of doc/script_commands.txt in the monster/areamonster documentation:

Both 'monster' and 'areamonster' return the GID of the monster
spawned if there was ONLY ONE monster to be spawned. This is useful for
controlling each of the spawned mobs with the unit* commands shown below.
For example:

 // We'll make a poring which will automatically attack invoking player:
 set .@mobGID, monster "Prontera",150,150,"Poring",1002,1;
 unitattack .@mobGID, getcharid(3); // Attacker GID, attacked GID

The way you can get the GID of more than only one monster is looping
through all the summons to get their individual GIDs and do whatever you
want with them. For example:

 // We want to summon .mobnumber porings which will give us a kiss
 for (set .@i, 0; .@i < .mobnumber; set .@i, .@i + 1){
   set .@mobGID, monster "map",.x,.y,"Kisser Poring",1002,1;
   unitemote .@mobGID, e_kis;
 }

Refer to the unit* commands below in this document.
unit* commands are just a leftover of the mob control suite that was custom built long long ago in the eAthena era and then was removed. The unit* commands just give a quite basic control which isn't just enough for much purposes).

 
Last edited by a moderator:
Back
Top