Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-04-2002, 09:40 AM
DarkHero2002 DarkHero2002 is offline
Registered User
DarkHero2002's Avatar
Join Date: Dec 2001
Posts: 625
DarkHero2002 is on a distinguished road
Send a message via ICQ to DarkHero2002 Send a message via AIM to DarkHero2002
Question 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
__________________

DarkHero
AIM:XxCloud2002xX
ICQ:165561109
E-Mail:[email protected]
Manager Of Colonial Graal

PLEASE DO NOT CLICK HERE!
Reply With Quote
  #2  
Old 08-04-2002, 10:15 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
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?
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #3  
Old 08-04-2002, 10:56 AM
DarkHero2002 DarkHero2002 is offline
Registered User
DarkHero2002's Avatar
Join Date: Dec 2001
Posts: 625
DarkHero2002 is on a distinguished road
Send a message via ICQ to DarkHero2002 Send a message via AIM to DarkHero2002
I dunno. That's why I am asking
__________________

DarkHero
AIM:XxCloud2002xX
ICQ:165561109
E-Mail:[email protected]
Manager Of Colonial Graal

PLEASE DO NOT CLICK HERE!
Reply With Quote
  #4  
Old 08-04-2002, 11:01 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
warpto levelname,x,y; (warps a database npc that can warp)


I found this somewhere o.O
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #5  
Old 08-04-2002, 12:19 PM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
canwarp; (serverside command)
__________________

Reply With Quote
  #6  
Old 08-04-2002, 12:35 PM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
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)
Reply With Quote
  #7  
Old 08-05-2002, 12:04 AM
CheeToS2 CheeToS2 is offline
That Guy
CheeToS2's Avatar
Join Date: Dec 2001
Location: Seattle, WA
Posts: 2,528
CheeToS2 will become famous soon enough
Send a message via AIM to CheeToS2
my bad -_-
__________________

Reply With Quote
  #8  
Old 08-06-2002, 12:20 AM
Andor_RC14 Andor_RC14 is offline
Registered User
Join Date: Jan 2002
Location: U.S.A - Ohio
Posts: 101
Andor_RC14 is on a distinguished road
Send a message via ICQ to Andor_RC14 Send a message via AIM to Andor_RC14 Send a message via Yahoo to 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
__________________


Statistics show that 60% of all statistics are made-up
Manager of Norin.
EX Co-Manager of Bravo Online.
Reply With Quote
  #9  
Old 08-06-2002, 12:42 AM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
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]
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly

Last edited by adam; 08-06-2002 at 01:52 PM..
Reply With Quote
  #10  
Old 08-06-2002, 01:43 PM
mikepg mikepg is offline
Registered User
Join Date: Nov 2001
Location: VA, USA
Posts: 501
mikepg is on a distinguished road
Send a message via AIM to mikepg Send a message via Yahoo to mikepg
i had this working today, except triggeraction doesnt seem to work in if (wasthrown) {} clauses. :grrr: :grrr:
__________________
~War Lord Mpg2
Bravo Online's Asst. Staff Manager

"Sittin by the tree, sippin eggnog, waitin on christmas gifts"
Reply With Quote
  #11  
Old 08-06-2002, 01:58 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
Quote:
Originally posted by mikepg
i had this working today, except triggeraction doesnt seem to work in if (wasthrown) {} clauses. :grrr: :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.
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #12  
Old 08-06-2002, 07:30 PM
Andor_RC14 Andor_RC14 is offline
Registered User
Join Date: Jan 2002
Location: U.S.A - Ohio
Posts: 101
Andor_RC14 is on a distinguished road
Send a message via ICQ to Andor_RC14 Send a message via AIM to Andor_RC14 Send a message via Yahoo to 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??
__________________


Statistics show that 60% of all statistics are made-up
Manager of Norin.
EX Co-Manager of Bravo Online.
Reply With Quote
  #13  
Old 08-06-2002, 10:05 PM
adam adam is offline
http://wiki.graal.us/
adam's Avatar
Join Date: Nov 2001
Posts: 2,247
adam has a spectacular aura aboutadam has a spectacular aura about
Send a message via AIM to adam
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
__________________
Rogue Shadow (TCN)(NAT)(Global Development Team)

For development help, contact the patrons of the #graaldt irc channel below, I am usually there.
Click Here to Join IRC Chat Now! -- irc.freenode.net Channel: #graaldt
Quote:
<Dustyshouri> no, RogueShadow is always talking about scripts lol
<Dustyshouri> in fact, he pretty much brought Graal back as a topic single-handedly
Reply With Quote
  #14  
Old 08-06-2002, 10:48 PM
Andor_RC14 Andor_RC14 is offline
Registered User
Join Date: Jan 2002
Location: U.S.A - Ohio
Posts: 101
Andor_RC14 is on a distinguished road
Send a message via ICQ to Andor_RC14 Send a message via AIM to Andor_RC14 Send a message via Yahoo to Andor_RC14
I will as soon as the Bravo NPC Server comes back
__________________


Statistics show that 60% of all statistics are made-up
Manager of Norin.
EX Co-Manager of Bravo Online.
Reply With Quote
  #15  
Old 08-12-2002, 07:15 PM
Rogpog Rogpog is offline
Registered User
Join Date: May 2002
Posts: 15
Rogpog is on a distinguished road
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 ) but I haven't messed with it since that message. Hope this helps...
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:53 PM.


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