Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   A bush (https://forums.graalonline.com/forums/showthread.php?t=35042)

DarkHero2002 08-04-2002 09:40 AM

A bush
 
Ok, I made a bush script and it works just like a real bush. The one thing I have a problem with is when you carry it off the level. How would I got about having it reset to the level x and y of where it started if it was thrown on a different level?

NPC Code:
// NPC made by Brent
if (created) {
setshape 1,32,32;
this.startx = x;
this.starty = y;
canbecarried;
}
if (wasthrown) {
putleaps 1,x,y;
hidelocal;
dontblock;
sleep 5;
x = this.startx;
y = this.starty;
showlocal;
blockagain;
}



-Brent

adam 08-04-2002 10:15 AM

Re: A bush
 
Quote:

Originally posted by DarkHero2002
Ok, I made a bush script and it works just like a real bush. The one thing I have a problem with is when you carry it off the level. How would I got about having it reset to the level x and y of where it started if it was thrown on a different level?

NPC Code:
// NPC made by Brent
if (created) {
setshape 1,32,32;
this.startx = x;
this.starty = y;
canbecarried;
}
if (wasthrown) {
putleaps 1,x,y;
hidelocal;
dontblock;
sleep 5;
x = this.startx;
y = this.starty;
showlocal;
blockagain;
}



-Brent

Is there not a serverside command for warping npcs to different levels?

DarkHero2002 08-04-2002 10:56 AM

I dunno. That's why I am asking

adam 08-04-2002 11:01 AM

warpto levelname,x,y; (warps a database npc that can warp)


I found this somewhere o.O

CheeToS2 08-04-2002 12:19 PM

canwarp; (serverside command)

Python523 08-04-2002 12:35 PM

Quote:

Originally posted by CheeToS2
canwarp; (serverside command)
that's use for npcs that follow a specific path like manny...
if you want something that moves a lot on the overworld, use canwarp2 (like the ships)

CheeToS2 08-05-2002 12:04 AM

my bad -_-

Andor_RC14 08-06-2002 12:20 AM

Ok so I got something like this from what you guys have said:
NPC Code:
// NPC made by Brent
if (created) {
setshape 1,32,32;
this.startx = x;
this.starty = y;
canbecarried;
canwarp2;
}
if (wasthrown) {
putleaps 1,x,y;
hidelocal;
dontblock;
sleep 5;
warpto this.startl,this.startx,this.starty;
showlocal;
blockagain;
}



It is doing everything right on Bravo (with an npcserver) except it wont warp back

adam 08-06-2002 12:42 AM

Quote:

Originally posted by Andor_RC14
Ok so I got something like this from what you guys have said:
NPC Code:
// NPC made by Brent
if (created) {
setshape 1,32,32;
this.startx = x;
this.starty = y;
canbecarried;
canwarp2;
}
if (wasthrown) {
putleaps 1,x,y;
hidelocal;
dontblock;
sleep 5;
warpto this.startl,this.startx,this.starty;
showlocal;
blockagain;
}




It is doing everything right on Bravo (with an npcserver) except it wont warp back

You need to use some kind of string for the level.

and you never set the level in the npc

[edit].strange....strange...[/edit]

mikepg 08-06-2002 01:43 PM

i had this working today, except triggeraction doesnt seem to work in if (wasthrown) {} clauses. :grrr: :mad: :grrr:

adam 08-06-2002 01:58 PM

Quote:

Originally posted by mikepg
i had this working today, except triggeraction doesnt seem to work in if (wasthrown) {} clauses. :grrr: :mad: :grrr:
triggeraction is funny that way. >.< I just started using it.

an npc weapon I have in my inventory cannot do triggeraction on me and work in another npc in my inventory.

this is on doomsday a non-npcserver server....... aw well. so I can't set myself on fire... big deal right........ o.O there could be other uses I will never be able to try.

Andor_RC14 08-06-2002 07:30 PM

So i need to figure out some other way for wasthrown.. I'll do a function. Will that work? Put a function in the wasthrown {} that will do a triggeraction??

adam 08-06-2002 10:05 PM

Quote:

Originally posted by Andor_RC14
So i need to figure out some other way for wasthrown.. I'll do a function. Will that work? Put a function in the wasthrown {} that will do a triggeraction??
I dunno try it and see... o.O

Andor_RC14 08-06-2002 10:48 PM

I will as soon as the Bravo NPC Server comes back

Rogpog 08-12-2002 07:15 PM

Heh, I made an attempt at this a year ago, but when it needed some help, everyone just made a mockery of it, http://forums.graal2001.com/forums/s...threadid=17326. Since someone else wants to try, maybe times have changed. I tried to make it as close to a real tile bush as possible at the time. Here's where I got to, with some minor bugs in the onwall detection:

NPC Code:

if (created){
drawunderplayer;
this.mode=1;
this.touch={0,-1,-1,0,0,1,1}
canbecarried;
setstring this.bushlvl,#L; this.bushx=x; this.bushy=y;
timeout=0.05;
}
if (timeout){
if (abs(x-(playerx+2*this.touch[2*playerdir]))<1.5&&
abs(y-(playery+2*this.touch[2*playerdir+1]))<1.5) this.mode=1;
else this.mode=0;
if (this.mode==0) dontblock;
else blockagain;
timeout=0.05;
}
if (washit||exploded||wasthrown||carrying){
putleaps 0,x,y;
if (!wasthrown){
bushlay=int(random(0,9));
if (bushlay==0) lay2 heart,x,y;
if (bushlay==1) lay2 bombs,x,y;
if (bushlay==2) lay2 greenrupee,x,y;
if (bushlay==3) lay2 bluerupee,x,y;
}
hide;
sleep 8;
if (!strequals(#L,#s(this.bushlvl))){
deletestring bushlvl,i;
destroy;
}
deletestring bushlvl,i;
x=this.bushx; y=this.bushy; show;
}



The script's supposed to be called using putnpc2, to avoid mishaps in transportation. Everything can be improved with newer commands and serverside (everything here was before setshape :rolleyes: ) but I haven't messed with it since that message. Hope this helps... :)

Rogpog 08-13-2002 05:07 PM

Ok... yeah, I just added that part. ;) :D


All times are GMT +2. The time now is 10:31 PM.

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