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-29-2001, 02:30 PM
wetferret1 wetferret1 is offline
Script Cow - MOOO!
wetferret1's Avatar
Join Date: Aug 2001
Location: Oregon, USA
Posts: 1,285
wetferret1 is on a distinguished road
Send a message via AIM to wetferret1
Slideing door

Okay I need a "Kingdome door" When someone has a TAG and the say "Open gate" it slides open and when they say "Close Gate" It slides closed.
__________________
[img]http://s-o.clanpages.com/wet***getlal.png[/img]
Quote:
Originally posted by Loriel
I am not corrupt, and I will ban you if you don't believe that.
(-=Wetferret IceFire=-)
Reply With Quote
  #2  
Old 08-29-2001, 04:08 PM
KJS KJS is offline
The one, The only -
KJS's Avatar
Join Date: Apr 2001
Location: USA, Minnesota
Posts: 1,012
KJS is on a distinguished road
Send a message via AIM to KJS
NPC Code:

if(playerchats){
if(strequals(#c,open doors)
opendoor();
elseif(strequals(#c,close doors)
closedoor();
}
function opendoor(){
for (this.moved=0;this.moved<5;this.moved++)
x--;
}
function closedoor(){
for (this.moved=0;this.moved<5;this.moved++)
x++;
}



well I guess it would probably make it a shorter code if I would have took what is in the functions and like put it in were it calls it but oh well to lazy to do that now (I am pretty sure htis iwll work for an npc server)..

this will make the npc move back and forth 5 tiles (left and right)
__________________
Thanks,
-KJL
Reply With Quote
  #3  
Old 08-29-2001, 06:23 PM
wetferret1 wetferret1 is offline
Script Cow - MOOO!
wetferret1's Avatar
Join Date: Aug 2001
Location: Oregon, USA
Posts: 1,285
wetferret1 is on a distinguished road
Send a message via AIM to wetferret1
Will it work offline? And what about the Kingdome/guild TAG part?
__________________
[img]http://s-o.clanpages.com/wet***getlal.png[/img]
Quote:
Originally posted by Loriel
I am not corrupt, and I will ban you if you don't believe that.
(-=Wetferret IceFire=-)
Reply With Quote
  #4  
Old 08-29-2001, 11:16 PM
KJS KJS is offline
The one, The only -
KJS's Avatar
Join Date: Apr 2001
Location: USA, Minnesota
Posts: 1,012
KJS is on a distinguished road
Send a message via AIM to KJS
NPC Code:

if(playerchats&&strequals(#g,GUILDNAME)){
if(strequals(#c,open door)&&this.open==0){
for (this.moved=0;this.moved<10;this.moved++){
x-=0.5;
sleep 0.1;
}
this.open=1;
}elseif(strequals(#c,close door)&&this.open==1){
for (this.moved=0;this.moved<10;this.moved++){
x+=0.5;
sleep 0.1;
}
this.open=0;
}
}



this one is a lot better then the other one lol (the other one it wouldn't smoothly go over it would just appear there lol so I added a sleep, took out the functions, and made it so they can only open the door if the door is closed)

yes it does work offline... (and pretty sure it works online all the functions look like they will work online)...

only thing you have to edit is the guild name in red
__________________
Thanks,
-KJL
Reply With Quote
  #5  
Old 08-29-2001, 11:24 PM
milotheman milotheman is offline
Banned
milotheman's Avatar
Join Date: Apr 2001
Posts: 0
milotheman is on a distinguished road
wow KJL u r good scripter
Reply With Quote
  #6  
Old 08-29-2001, 11:41 PM
Neoreno Neoreno is offline
Cerebrate
Neoreno's Avatar
Join Date: Aug 2001
Location: England
Posts: 1,663
Neoreno is on a distinguished road
Send a message via AIM to Neoreno
Code

if(playerchats&&strequals(#g,GUILDNAME)){
if(strequals(#c,open door)&&this.open==0){
for (this.moved=0;this.moved<10;this.moved++){
x-=0.5;
sleep 0.1;
}
this.open=1;
}elseif(strequals(#c,close door)&&this.open==1){
for (this.moved=0;this.moved<10;this.moved++){
x+=0.5;
sleep 0.1;
}
this.open=0;
}
}

Will work!!
__________________

Quote:
Exitus Acta Probat: The Outcome Justifies the Deed.
Reply With Quote
  #7  
Old 08-30-2001, 10:24 PM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
NPC Code:

if(playerchats && strequals(#g,GUILDNAME)){
if(strequals(#c,open door)&&dooropen==0){
dooropen=2;
move -5,0,10,0;
sleep 10;
dooropen=1;
}else if(strequals(#c,close door)&&dooropen==1){
dooropen=2;
move 5,0,10,0;
sleep 10;
dooropen=0;
}
}



Why make life harder and lag more?
__________________

subliminal message: 1+1=3
Reply With Quote
  #8  
Old 08-30-2001, 11:00 PM
KJS KJS is offline
The one, The only -
KJS's Avatar
Join Date: Apr 2001
Location: USA, Minnesota
Posts: 1,012
KJS is on a distinguished road
Send a message via AIM to KJS
Quote:
Originally posted by Falcor
NPC Code:

if(playerchats && strequals(#g,GUILDNAME)){
if(strequals(#c,open door)&&dooropen==0){
dooropen=2;
move -5,0,10,0;
sleep 10;
dooropen=1;
}else if(strequals(#c,close door)&&dooropen==1){
dooropen=2;
move 5,0,10,0;
sleep 10;
dooropen=0;
}
}



Why make life harder and lag more?
humm wow I forgot about the move command lol...
__________________
Thanks,
-KJL
Reply With Quote
  #9  
Old 08-30-2001, 11:12 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Yes using the move command is better
Possible improvement: let the door fall down
fast when closed (instead of slowly closing)

A gani would even be better :-)
Reply With Quote
  #10  
Old 08-30-2001, 11:13 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Also don't forget to make the link behind the
door using an npc instead of those yellow links,
because otherwise people could lag into the link
Reply With Quote
  #11  
Old 08-31-2001, 12:44 AM
AlexH AlexH is offline
Have A Drink On Me
AlexH's Avatar
Join Date: Jun 2001
Location: Somewhere In Time
Posts: 7,442
AlexH is on a distinguished road
Send a message via AIM to AlexH Send a message via MSN to AlexH
there is only one problem with the move command
say you have it so when the player says open the door moves 4 tiles to the left then sleeps for 3 the moves back 4
if you say open again when the sleep is being used it will move over another 4 positions again
sosad
__________________
QUICK LOOK BUSY JESUS IS COMING!
Reply With Quote
  #12  
Old 08-31-2001, 12:55 AM
AlexH AlexH is offline
Have A Drink On Me
AlexH's Avatar
Join Date: Jun 2001
Location: Somewhere In Time
Posts: 7,442
AlexH is on a distinguished road
Send a message via AIM to AlexH Send a message via MSN to AlexH
ganis ok
but depending on the way you script it that could also be a problem
like if it was playing the gani and you said open the gani will start playing again from the start
but you could just set a flag then unset it a few secs later
like

if (playersays(open)&&!opening) {
setcharani *whateva,;
set opening;
sleep 5;
unset opening;
}

that should work without problems
but i know Kaimetsu wont like it cause he is anti-flags
__________________
QUICK LOOK BUSY JESUS IS COMING!
Reply With Quote
  #13  
Old 08-31-2001, 12:58 AM
KJS KJS is offline
The one, The only -
KJS's Avatar
Join Date: Apr 2001
Location: USA, Minnesota
Posts: 1,012
KJS is on a distinguished road
Send a message via AIM to KJS
it would be better just to use vars

like

this.opening=1;

and go like

this.opening==0

insted of

!opening
__________________
Thanks,
-KJL
Reply With Quote
  #14  
Old 08-31-2001, 01:04 AM
AlexH AlexH is offline
Have A Drink On Me
AlexH's Avatar
Join Date: Jun 2001
Location: Somewhere In Time
Posts: 7,442
AlexH is on a distinguished road
Send a message via AIM to AlexH Send a message via MSN to AlexH
very sorry
would it be better if i used timeout
__________________
QUICK LOOK BUSY JESUS IS COMING!
Reply With Quote
  #15  
Old 08-31-2001, 01:09 AM
AlexH AlexH is offline
Have A Drink On Me
AlexH's Avatar
Join Date: Jun 2001
Location: Somewhere In Time
Posts: 7,442
AlexH is on a distinguished road
Send a message via AIM to AlexH Send a message via MSN to AlexH
ok timeout it is
if (playersays(open)&&!opening) {
setcharani whateva,;
set opening;
timeout = 3;
}
if (timeout) {
unset opening
}

better?
__________________
QUICK LOOK BUSY JESUS IS COMING!
Reply With Quote
  #16  
Old 08-31-2001, 01:14 AM
AlexH AlexH is offline
Have A Drink On Me
AlexH's Avatar
Join Date: Jun 2001
Location: Somewhere In Time
Posts: 7,442
AlexH is on a distinguished road
Send a message via AIM to AlexH Send a message via MSN to AlexH
o yea
woops 4got bout that
and i got one question
what do you have against flags
__________________
QUICK LOOK BUSY JESUS IS COMING!
Reply With Quote
  #17  
Old 08-31-2001, 02:41 AM
LiquidIce00 LiquidIce00 is offline
RadioActive Monkeeh
LiquidIce00's Avatar
Join Date: Apr 2001
Location: dirty south
Posts: 2,112
LiquidIce00 is on a distinguished road
Send a message via ICQ to LiquidIce00 Send a message via AIM to LiquidIce00 Send a message via Yahoo to LiquidIce00
make a gani of a door going up then do ur script a dontblock and then one of a door closing and do a blockagain
wont lag and will be good
__________________
LiquidIce *Owner* (UnholyNation)
-UN Website
http://www.unholynation.com
-UN Forum
http://forums.unholynation.com
-
-the thinker
-

-
onwall2 for nonp2p (i suck at onwall)
Reply With Quote
  #18  
Old 08-31-2001, 02:47 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
Contreversy. Ganis may be better but they require you to Download it. Id rath script it with move then to make a gani file for it since its such a simple script =\
__________________

subliminal message: 1+1=3
Reply With Quote
  #19  
Old 08-31-2001, 02:50 AM
Guest
Posts: n/a
try this simple one...

NPC Code:

// sliding door by Ice Pick
if (playerenters && players[0].x == 9 && players[0].y == 25){
timereverywhere;
setgifpart ninjidoorleft.gif, 0, 33, 32, 32;
this.mode = 2;
this.open = 33;
timeout = 0.5;
this.start = 0;
}
else if (playerenters) {
setgif ninjidoorleft.gif;
timereverywhere;
this.open = 0;
this.mode = 0;
this.start = 1;
}

if (playertouchsme && (((this.mode == 1 || this.mode == 0) && this.open == 0) || (this.mode == 2 && this.wideopen != 1))) {
this.mode = 1;
play fire.wav;
timeout = 0.1;
this.start = 0;
}

if (timeout && this.start == 1) this.start = 0;
else if (timeout) {
if (this.mode == 1) this.open+=6;
if (this.mode == 2) {
this.open-=2;
this.wideopen = 0;
}
setgifpart ninjidoorleft.gif, 0, this.open, 32, 32;
blockagain;
if ((this.mode == 1 && this.open <= 32) || (this.mode == 2 && this.open >= 0)) timeout = 0.1;
else if (this.mode == 1){
dontblock;
timeout = 2;
this.mode = 2;
this.wideopen = 1;
}
else play arrowon.wav;
}

Reply With Quote
  #20  
Old 08-31-2001, 03:00 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
Simple one. Hahaha that OLD door script. You never even botherd to rename the variables. You bring it apon yourself Ice Pick.
__________________

subliminal message: 1+1=3
Reply With Quote
  #21  
Old 08-31-2001, 03:02 AM
Guest
Posts: n/a
Shut the hell up!:grrr:
Reply With Quote
  #22  
Old 08-31-2001, 03:04 AM
AlexH AlexH is offline
Have A Drink On Me
AlexH's Avatar
Join Date: Jun 2001
Location: Somewhere In Time
Posts: 7,442
AlexH is on a distinguished road
Send a message via AIM to AlexH Send a message via MSN to AlexH
Quote:
Originally posted by Falcor
Simple one. Hahaha that OLD door script. You never even botherd to rename the variables. You bring it apon yourself Ice Pick.
sosad
he will learn one day
__________________
QUICK LOOK BUSY JESUS IS COMING!
Reply With Quote
  #23  
Old 08-31-2001, 03:06 AM
Falcor Falcor is offline
Darth Cucumber
Falcor's Avatar
Join Date: Mar 2001
Location: At School
Posts: 2,874
Falcor is on a distinguished road
Send a message via ICQ to Falcor Send a message via AIM to Falcor Send a message via MSN to Falcor Send a message via Yahoo to Falcor
Ace's Scripting guide is a nice start

the rest is basiclaly done through countless trails and frequent errors.
__________________

subliminal message: 1+1=3
Reply With Quote
  #24  
Old 08-31-2001, 03:26 AM
AlexH AlexH is offline
Have A Drink On Me
AlexH's Avatar
Join Date: Jun 2001
Location: Somewhere In Time
Posts: 7,442
AlexH is on a distinguished road
Send a message via AIM to AlexH Send a message via MSN to AlexH
yes
practice makes perfect
and once your perfect you can show off
so really practice just makes show offs
__________________
QUICK LOOK BUSY JESUS IS COMING!
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 02:04 PM.


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