Jump to content
  • 0

how to use unitwarp?


xienne15

Question


  • Group:  Members
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  226
  • Reputation:   11
  • Joined:  01/09/12
  • Last Seen:  

They say i can use unitwarp to warp monster when the script has
OnTouchNPC:

OnTouchNPC:
    unitwarp 0,"this",-1,-1;

what is this?

Link to comment
Share on other sites

7 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  127
  • Reputation:   36
  • Joined:  01/21/13
  • Last Seen:  

"this" is the current map.

Here's an example of how to use OnTouchNPC:

// Since this script should only be triggered by touch, we can set the Sprite ID to -1 (invisible)
// The extra "5,5," signifies a 5-by-5 cell area around the NPC that will trigger the 'OnTouch' label

prontera,151,172,0    script    no_mob_walk    -1,5,5,{    

    //end;    // Uncomment this line if you use a visible sprite

    OnTouchNPC:    // Triggers when the defined area is walked into
        unitwarp 0, "this", -1, -1;    // Warps invoking monster to random cell on the same map
        end;

}

 

Note: Sorry for the mistake on the other board lol. I have since replied to your topic there as well.

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

if not mistaken ....

monster will never trigger the OnTouch label,...only players does...

 

to warp a particular monster..you required their GID ....

the only way you can get the GID ... Get_monster_gid

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  226
  • Reputation:   11
  • Joined:  01/09/12
  • Last Seen:  

bif_fild01,72,61,4	script	Meta Spirit	2114,5,5,{
	mes "I will protect this city with my blazing fire!";
	emotion e_no1;
	close;
OnTouchNPC:
	unitwarp 0, "this", -1, -1;
	end;
}

so i added a message, but when i walk near that npc it will play like ontouch, how to make this npc talk only when clicked?

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

remove OnTouch and change to

bif_fild01,72,61,4	script	Meta Spirit	2114,{
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  254
  • Reputation:   72
  • Joined:  07/10/13
  • Last Seen:  

if not mistaken ....

monster will never trigger the OnTouch label,...only players does...

 

to warp a particular monster..you required their GID ....

the only way you can get the GID ... Get_monster_gid

[...]
Monsters can also trigger the NPC, though the label 'OnTouchNPC:' is 
used in this case.
[...]
If <GID> is zero, the command runs for the unit that invoked the script. This can be
used with "OnTouch" to warp monsters:

OnTouch:
	unitwarp 0,"this",-1,-1;
[...]
Taken from trunk/doc/script_commands.txt.

remove OnTouch and change to

bif_fild01,72,61,4	script	Meta Spirit	2114,{
I do not really understand how this will solve the problem, because if you have no label to be triggered at all, the monsters will not be warped either.
bif_fild01,72,61,4	script	Meta Spirit	2114,5,5,{
	mes "I will protect this city with my blazing fire!";
	emotion e_no1;
	close;
OnTouchNPC:
	unitwarp 0, "this", -1, -1;
	end;
}
so i added a message, but when i walk near that npc it will play like ontouch, how to make this npc talk only when clicked?
bif_fild01,72,61,4	script	Meta Spirit	2114,5,5,{
	mes "I will protect this city with my blazing fire!";
	emotion e_no1;
	close;
OnTouch:
	end;
OnTouchNPC:
	unitwarp 0, "this", -1, -1;
	end;
}
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  127
  • Reputation:   36
  • Joined:  01/21/13
  • Last Seen:  

if not mistaken ....

monster will never trigger the OnTouch label,...only players does...

 

to warp a particular monster..you required their GID ....

the only way you can get the GID ... Get_monster_gid

 

I used OnTouchNPC, not OnTouch; OnTouchNPC can be triggered by a monster. Using 0 for the unitwarp's GID will warp any monster away; however, if he wanted to be more specific with the GID (regarding monsters), yes, he would likely have to make source modifications to do so.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  226
  • Reputation:   11
  • Joined:  01/09/12
  • Last Seen:  

Ev

 

if not mistaken ....

monster will never trigger the OnTouch label,...only players does...

 

to warp a particular monster..you required their GID ....

the only way you can get the GID ... Get_monster_gid

 

I used OnTouchNPC, not OnTouch; OnTouchNPC can be triggered by a monster. Using 0 for the unitwarp's GID will warp any monster away; however, if he wanted to be more specific with the GID (regarding monsters), yes, he would likely have to make source modifications to do so.

everything went fine, i tried to summon monster in that area, and all monster has been warped randomly. But sadly warped monster that has been warped again to that area will not be warped again by the unitwarp, therefore the monster stays and not getting warp.

Link to comment
Share on other sites

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.

×
×
  • Create New...