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 09-06-2007, 10:45 PM
Knightmare1 Knightmare1 is offline
Billy Allan
Knightmare1's Avatar
Join Date: Apr 2007
Posts: 804
Knightmare1 can only hope to improve
Spawn Point

like i said, i did gs1, so i still use if (playerdead).
can someone help? heres script.
PHP Code:
//#CLIENTSIDE
function onCreated() {
  if (
playerdead)
    
setlevel2("hospital.nw");
    
sleep(3);

__________________
I am the devil, I am here to do to devils work.
Reply With Quote
  #2  
Old 09-06-2007, 10:53 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by Knightmare1 View Post
like i said, i did gs1, so i still use if (playerdead).
can someone help? heres script.
PHP Code:
//#CLIENTSIDE
function onCreated() {
  if (
playerdead)
    
setlevel2("hospital.nw");
    
sleep(3);

setlevel2(); is clientside.

You should check for the event of when the player's dying. Like onPlayerDies().

Then you should trigger the server to set the level.

Also, setlevel2's syntax is:

setlevel2(level name as String, x as float, y as float);

:P
Reply With Quote
  #3  
Old 09-06-2007, 11:02 PM
Kyranki Kyranki is offline
Freelance Coder
Join Date: Aug 2007
Location: At the end of the rainbow, in the pot of gold.
Posts: 202
Kyranki is on a distinguished road
Send a message via AIM to Kyranki Send a message via MSN to Kyranki
Also, you can't do...

PHP Code:
function onCreated() {
  if (
playerdead// yada yaa

That was a GS1 event, in GS2 it's a null temp variable and won't work that way. Also, setlevel2() is used wrong as well. The first parameters for the function should be the level name and then the x and y to place the player at. It also needs to be serverside. I would suggest reading the wiki to try and find a few good tutorials on scripting as well as trying to findout which functions and things are serverside only as such.
__________________
Stan.
Reply With Quote
  #4  
Old 09-06-2007, 11:22 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Ya...
PHP Code:
function onCreated() {
  if (
playerdead// yada yaa

Would assume the player is dead when the NPC is created. Even in GS1, there is the if (playerdies) event for something like this. Other than what's already been repeated... I can't really see what else there is to add.
I suggest studying up on clientside/serverside as well as what are events, booleans and so on.
Reply With Quote
  #5  
Old 09-07-2007, 02:22 AM
theHAWKER theHAWKER is offline
**FLIP OUT**
theHAWKER's Avatar
Join Date: Mar 2006
Location: canada, vancouver
Posts: 768
theHAWKER is an unknown quantity at this point
Quote:
Originally Posted by DustyPorViva View Post
Ya...
PHP Code:
function onCreated() {
  if (
playerdead// yada yaa

there is a gs2 function for dieing...

function onPlayerDies(){
//this is the gs2 way
}
__________________
**FLIP OUT**
Reply With Quote
  #6  
Old 09-07-2007, 02:39 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by theHAWKER View Post
there is a gs2 function for dieing...

function onPlayerDies(){
//this is the gs2 way
}
I know, hence my comment "event in GS1".
Reply With Quote
  #7  
Old 09-06-2007, 11:57 PM
PrinceOfKenshin PrinceOfKenshin is offline
That guy with a beard
PrinceOfKenshin's Avatar
Join Date: May 2004
Location: Ontario, Canada
Posts: 819
PrinceOfKenshin has a spectacular aura aboutPrinceOfKenshin has a spectacular aura about
PHP Code:
function onCreated(){
if (
player.hp <= ) { 
setlevel2("hospital.nw",x,y);

simple as that.
__________________


Quote:
Game Master (Server): Greetings PrinceOfKenshin, there are new posts on the forums that demand your urgent attention! God speed, the fate of the world is in your hands. If you fail, middle earth will forever be in the darkness and your children will be enslaved by McKain.
Reply With Quote
  #8  
Old 09-07-2007, 12:04 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
No it's not, again, the player has to have already been dead when the NPC is created.
Reply With Quote
  #9  
Old 09-07-2007, 02:05 AM
Knightmare1 Knightmare1 is offline
Billy Allan
Knightmare1's Avatar
Join Date: Apr 2007
Posts: 804
Knightmare1 can only hope to improve
function onCreated(){
if (player.hp <= 0 ) {
setlevel2("hospital.nw",x,y);
}
}
doesnt work
__________________
I am the devil, I am here to do to devils work.
Reply With Quote
  #10  
Old 09-07-2007, 02:23 AM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
PHP Code:
function onCreated()
 
setTimer(0.05);
function 
onTimeOut() {
 if (
player.hearts 0.5) {
  
setlevel2("hospital.nw",30,30);  //syntax: setlevel2(LevelNameInString,x,y);
 
}

That should work without much lag. If there is lag, then use this:
PHP Code:
function onPlayerDies() {  //I don't know if this is a real command, but Codein said there was one.
 
setlevel2("hospital.nw",30,30);  //syntax: setlevel2(LevelNameInString,x,y);

__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #11  
Old 09-07-2007, 02:57 AM
Googi Googi is offline
A Serious Epidemic
Googi's Avatar
Join Date: Oct 2001
Location: Canada
Posts: 18,866
Googi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud ofGoogi has much to be proud of
Send a message via AIM to Googi
Quote:
Originally Posted by Switch View Post
I don't know if this is a real command
http://skyld.vip.graal.net/wikka.php?wakka=onPlayerDies
__________________
Reply With Quote
  #12  
Old 09-08-2007, 04:02 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Okay then, use this on that I posted above xD:

PHP Code:
//#CLIENTSIDE
function onPlayerDies() {  //function for when the player dies
 
setlevel2("hospital.nw",30,30);  //syntax: setlevel2(LevelNameInString,x,y);

__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #13  
Old 09-08-2007, 05:55 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Switch View Post
Okay then, use this on that I posted above xD:

PHP Code:
//#CLIENTSIDE
function onPlayerDies() {  //function for when the player dies
 
setlevel2("hospital.nw",30,30);  //syntax: setlevel2(LevelNameInString,x,y);

setlevel2 won't work on the clientside, it did work before gs2, but no longer..
__________________
Reply With Quote
  #14  
Old 09-08-2007, 06:24 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by Chompy View Post
setlevel2 won't work on the clientside, it did work before gs2, but no longer..
I thought NPC-Server would have caused the change: not the language
Reply With Quote
  #15  
Old 09-08-2007, 09:30 PM
Kyranki Kyranki is offline
Freelance Coder
Join Date: Aug 2007
Location: At the end of the rainbow, in the pot of gold.
Posts: 202
Kyranki is on a distinguished road
Send a message via AIM to Kyranki Send a message via MSN to Kyranki
Quote:
Originally Posted by Switch View Post
PHP Code:
function onCreated()
 
setTimer(0.05);
function 
onTimeOut() {
 if (
player.hearts 0.5) {
  
setlevel2("hospital.nw",30,30);  //syntax: setlevel2(LevelNameInString,x,y);
 
}

That should work without much lag. If there is lag, then use this:
PHP Code:
function onPlayerDies() {  //I don't know if this is a real command, but Codein said there was one.
 
setlevel2("hospital.nw",30,30);  //syntax: setlevel2(LevelNameInString,x,y);

The first one won't work because that's serverside, and usually when a serverside script is initialized it is not in the scope of the player.

Isn't onPlayerDies clientside only? If it is that won't work either becauset setlevel2() is serverside only.
__________________
Stan.
Reply With Quote
  #16  
Old 09-08-2007, 09:45 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
PHP Code:
function onActionServerSide() {
  switch (
params[0]) {
    case 
"dead":
      
setlevel2(level,x,y);
    break;
  }
}
function 
onCreated()
  
setshape(1,32,32);
//#CLIENTSIDE
function onCreated() {
  
setshape(1,32,32);
  
dontblock();
  
onTimeOut();
}
function 
onTimeOut() {
  if (
player.hearts .5)
    
triggeraction(1,1,"serverside","dead");

  
setTimer(.05);

Not tested, don't hurt me if it doesnt work ;[
Reply With Quote
  #17  
Old 09-09-2007, 12:51 AM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by Kyranki View Post
The first one won't work because that's serverside, and usually when a serverside script is initialized it is not in the scope of the player.

Isn't onPlayerDies clientside only? If it is that won't work either becauset setlevel2() is serverside only.
onPlayerDies is both, however, they act differently.

On clientside, it triggers when the actual player dies. On serverside, it triggers when anybody dies :P

It'll set the level but I doubt you want to go to the hospital when someone else dies.

As I said, check for when the player dies, trigger to serverside and then set the level.
Reply With Quote
  #18  
Old 10-08-2007, 12:05 AM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by Kyranki View Post
The first one won't work because that's serverside, and usually when a serverside script is initialized it is not in the scope of the player.

Isn't onPlayerDies clientside only? If it is that won't work either becauset setlevel2() is serverside only.
Looking back at this thread since the recent posts.
I forgot to use //#CLIENTSIDE stuff xD Also I recently, like, 2 weeks ago found out setlevel2() was serverside I R STOOPID.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #19  
Old 10-07-2007, 03:21 AM
Mog Mog is offline
Banned
Join Date: Jan 2007
Location: at Sammy's house
Posts: 33
Mog is on a distinguished road
if you're creating the script on a single level, that's fine. if you want to automatically warp the player to the hospital whenever he/she dies in any level, one way of doing this is by adding it to players as a weapon script, which is added to all players when they log in.

how i'd personally do this is incorporate it inside a weapon script file. basically what i have is a custom GUI and it handles 3 things: updating GUI, checking player's heart count and warp them to OSL if their heart count is 0 and display event warper when an event is going on.
Reply With Quote
  #20  
Old 10-15-2007, 04:51 PM
johny023 johny023 is offline
Registered User
Join Date: Dec 2006
Posts: 36
johny023 is on a distinguished road
if (playerenters) {
toweapons -spawn;
}

if (playerdies){
sleep 0.1;
setlevel2 levelname.nw,x,y;
}

that's what i use for re spawning but my world is offline and i don't have a npc server so it may not work for you
Reply With Quote
  #21  
Old 10-15-2007, 10:28 PM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by johny023 View Post
if (playerenters) {
toweapons -spawn;
}

if (playerdies){
sleep 0.1;
setlevel2 levelname.nw,x,y;
}

that's what i use for re spawning but my world is offline and i don't have a npc server so it may not work for you
1) That isn't setup right.
2) There's no distinct client/server side to this script.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #22  
Old 10-15-2007, 11:15 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Switch View Post
1) That isn't setup right.
2) There's no distinct client/server side to this script.
He said he is using it offline...
Reply With Quote
  #23  
Old 10-16-2007, 01:08 AM
Switch Switch is offline
o.o
Switch's Avatar
Join Date: Jan 2007
Location: Philadelphia
Posts: 3,038
Switch has a spectacular aura about
Send a message via MSN to Switch
Quote:
Originally Posted by Crow View Post
He said he is using it offline...
Oh I didn't see that...

Edit:
No, he said his SERVER is offline and has no NPC Control. He said he USES it.
__________________
Oh squiggly line in my eye fluid. I see you lurking there on the peripheral of my vision.
But when I try to look at you, you scurry away.
Are you shy, squiggly line?
Why only when I ignore you, do you return to the center of my eye?
Oh, squiggly line, it's alright, you are forgiven.
Reply With Quote
  #24  
Old 10-16-2007, 01:35 AM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Switch View Post
No, he said his SERVER is offline and has no NPC Control. He said he USES it.
Quote:
Originally Posted by johny023 View Post
that's what i use for re spawning but my world is offline and i don't have a npc server so it may not work for you
Quote:
Originally Posted by Crow View Post
He said he is using it offline...
Ok Switch, again, slowly, just for you. He said his world is offline. He also said he doesnt have an npc server. So if you add those two, what does that mean? Right! He has no playerworld, he makes things offline, in the editor! I never said he doesnt use it btw...
Reply With Quote
  #25  
Old 10-15-2007, 07:25 PM
xAndrewx xAndrewx is offline
Registered User
xAndrewx's Avatar
Join Date: Sep 2004
Posts: 5,260
xAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud ofxAndrewx has much to be proud of
yes @ crow
__________________
Reply With Quote
  #26  
Old 10-15-2007, 08:11 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Hah, I so knew it
Reply With Quote
  #27  
Old 10-15-2007, 11:28 PM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
Quote:
Originally Posted by Crow View Post
Hah, I so knew it
triggeraction(x + 0.5, y + 0.5, "Died", null);

sorry
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #28  
Old 10-15-2007, 11:35 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
Quote:
Originally Posted by Tigairius View Post
triggeraction(x + 0.5, y + 0.5, "Died", null);

sorry
You dont have to be sorry, that happens alot :o
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 04:58 AM.


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