Difficulty: 2/10
Purpose: To be able to make an NPC teleport its killer upon death. Also can be used for teleportation mini-games that use waves such as fire cape minigame.
Files Edited: NPCHandler.java
Required Knowledge: Ability to follow directions
Server Base: Pimpscape Related Sources (Czar, hiya, etc.)
Tutorial:
Step 1: Finding The Section
Everything we will be doing takes place in NPCHandler.java and the first thing you might want to do is make a backup in case you miscode something. Next Search (control + f) for: Code:
(npcs[i].IsDead == true)
Why did I just do that? Because this section deals with the animation the selected NPC simulates upon death, but were going to be adding other stuff with the animations.
Step 2: Adding The Command to Teleport
Next we'll have to add a new part for our type of NPC, heres an example of one:
Code:
} else if (npcs[i].npcType == 2627) {
npcs[i].animNumber = 0x900; //Tz-kih
plr.teleportToX = 2228;
plr.teleportToY = 4954;
plr.heightLevel = 0;
Important You can place this anywhere in the list as long as its above Code:
} else {
because that code means all other npc ids not stated above.
What did I just do? Well the npc Type is the npc id; I used 2627 which is tz-kih also known as the first creature in the fire cape minigame. Then the animNumber is the animation that Tz-kih will do when he dies, I chose 0x900 because thats the default animation that most creatures do when they die. You should understand what 'teleportToX', 'teleportToY', and 'heightLevel' is because those come straight from client.java. We added the 'plr.' in front of them because were telling the server to teleport the player not the npc.
Step 3: Declaring The New Commands
Scroll back up to Code:
} else if (npcs[i].IsDead == true) {
and make sure you're at the end of the line or after the '{' if its in the next line, then you'll have to hit enter. (if you want, I like to hit it a few times for the extra room and white space) Then Add this in that area: Code:
int Player = npcs[i].StartKilling;
client plr = (client) server.playerHandler.players[Player];
All Credits to : Me!!



Reply With Quote![[Tut] making Npc's Teleport You Upon Your Death](http://ragezone.com/hyper728.png)


