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-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: 818
PrinceOfKenshin 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
  #6  
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
  #7  
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
  #8  
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
  #9  
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
  #10  
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
  #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, 07:15 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 Twinny View Post
I thought NPC-Server would have caused the change: not the language
It was definitely made serverside on the release of the NPC-Server.

I distinctively remember having to trigger to serverside when I scripted warp rings for an old project I was working on BEFORE the release of GS2.
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 06:12 PM.


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