Jump to content
  • 0

Question

Posted (edited)

Hello rathena people !
I'm simply trying to make two monsters fight amongst themselves with the following script :

prontera,155,175,4 script test 46,{

mes "[test]";
mes "Je vais invoquer deux monstres et tenter de les faire combattre ."; //I'm gonna spawn 2 mobs and make them fight each other
if (select("ok:non") == 2) end;

@gid1 = monster ("prontera",153,170,"poring",1002,1);
@gid2 = monster ("prontera",155,170,"drops",1113,1);
unitattack @gid1 , @gid2 , 1;
unitattack @gid2 , @gid1 , 1;
}

When the monsters spawn, they run into each other. When they're on the same square they stop and turn into "I don't give a damn" mode, doing what they want again. /hum

 

I already followed this guide to have the GID based functions working and so the unitattack command returns 1(success).

I also downloaded this patch as it seemed to be able to solve my problem but when I compiled my server I got errors (I'm running on rA 17706).

 

If anyone could help me, I'd really appreciate it  /no1

Edited by Kurofly

4 answers to this question

Recommended Posts

Posted (edited)

I solved my problem /no1

 

If anyone ever wants to make monsters fight amongst themselves, here is what you need in order to do so:

 

 

-open your server folder trunk/src/map/script.c and look for the monster function : 

BUILDIN_FUNC(monster) {

look for this line :

int mobid = mob_once_spawn(sd, m, x, y, str, class_, 1, event, size, ai);

 

then replace it to these :

int mobid = mob_once_spawn(sd, m, x, y, str, class_, 1, event, size, ai);
script_pushint(st,mobid);

 

Now the monster command returns the GID of the monster created

 

-make two monster, one with an IA of 0 and the other with an IA of 1, and save their GID to use it later :

.gid1 = monster ("prontera",153,170,"poring",1002,1,"",0,0);
.gid2 = monster ("prontera",154,170,"drops",1113,1,"",0,1);

You can now use all of the GID based commands and make an epic fight between a poring and a drops  :D

 

viewer.php?id=892067screen.jpg

Edited by Kurofly
Posted

I was also unable to make units attack each other. I got unitwalk and setunitdata working just fine, so it wasn't the GID being messed up.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...