Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Using a NPC to move tiles: Help! (https://forums.graalonline.com/forums/showthread.php?t=60761)

Raeiphon 08-27-2005 03:47 AM

Using a NPC to move tiles: Help!
 
I'm making a jousting arena, but the ET member who controls it sits in a seat INSIDE the arena, making him vunerable to attacks. I want to do two things:

I want, when the ET member says something like begin judging that a tile hides for 3 seconds, then the ET member goes in side and sits in the seat, and is protected.

I also want, to move the player out of the level when he/she dies, or into a graveyard part on the field. I also want to incorporate this into a boot function, only accessible by ET members.

How would I do that? Help is greatly appriecated.

My current PvP herald code:
NPC Code:

// NPC by Sephir/Raeiphon
// Please credit if you use!
if (created) {
// Initialize the attributes
showcharacter;
setcharprop #3,head19.png;
setcharprop #C0,orange;
setcharprop #C1,gray;
setcharprop #C2,gray;
setcharprop #C3,brown;
setcharprop #C4,black;
setcharprop #n,PvP Herald;
setcharprop #2,no-shield.png;
shieldpower = 1;
dir = 2;
message Say start to begin the joust!;
}

if (playerchats) {

if(strequals(#c,start)){
putbomb 0,38,25;
sleep 5;
message ET Judges from now!;
}
if(strequals(#c,superjoust)){
putcomp goldenwarrior,npcs[self].x,npcs[self].y+10;
putcomp goldenwarrior,npcs[self].x,npcs[self].y+10;
putcomp goldenwarrior,npcs[self].x,npcs[self].y+10;
putcomp goldenwarrior,npcs[self].x,npcs[self].y+10;
putcomp goldenwarrior,npcs[self].x,npcs[self].y+10;

}
}

if (playerdies) {
message A PLAYER HAS WON!!;
setlevel2 mainhouse.nw,0,0

}




The setlevel2 was my original means, but i cant get it to work in the Offline test.

Idrox0 08-27-2005 05:41 AM

Well, first of all, the superjoust thing should use a for loop, considering it's the same thing five times in a row.

Now, as for the whole the-ET's-vulnerable-hide-tiles-then-he's-safe thing, could you be a bit more specific of what you want to happen?

And as for the go-to-a-graveyard-when-dead thing, I would just set the playerx and playery to whatever when playerhearts = 0, but I only know that would work offline. I'm not exactly sure how you access a given player's variables except through direct account association (with (account))... but yeah, I think that should help a bit.

calani 08-27-2005 05:51 AM

To change tiles via a script, you can access the tile array directly using tiles[y][x]=integer; and then updating the tiles with updateboard x,y,width,height;

to get the tile ID's, go into the editor and select a tile (draw a box around one tile) then go up to the toolbar and click on the thing that looks like four cobbles. that will give you the ID of that tile (use that as the value in the tiles[][] array)

tiles[0][0]=0x00; will replace the top left tile with the left side of the two-tile grass tuft.
note, the level is 64x64, so you can do up to tiles[64][64]

you -must- to updateboard in order to have the new tile display on the level without having to re-enter the level (or at least move so the tile you changed is off-screen) before it will update.

Raeiphon 08-27-2005 04:10 PM

Okay, i'll be a little more specific (thanks calani, i now understand how to do it.) with the booting thing:

When a player dies, i want him/her off the map. Or warped to a co-ordinate on the current map so they can exit thorugh a door. I've tried setlevel2 when playerdies, but it doesnt work.

xAndrewx 08-27-2005 06:32 PM

Check if the player has been hit. Check if the players HP hits 0, if yes setlevel2.

calani 08-27-2005 09:08 PM

Yes (playerdies) doesn't work right, if at all. I remember getting it to work two or so years ago on babylon, but it could be depreciated in the current release.
check the player's HP in a timeout loop (all you'll need is .5 or so: no need to check it 20 times a second)


All times are GMT +2. The time now is 11:00 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.