Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-28-2007, 11:53 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
Quick help please

Ok i'm trying to fix this script but i am having a problem.
NPC Code:
  this.hosplvls = {"mafia_hospital-room1.nw","mafia_hospital-room2.nw","mafia_hospital-room3.nw","mafia_hospital-room4.nw","mafia_hospital-room5.nw","mafia_hospital-room6.nw","mafia_hospital-room7.nw","mafia_hospital-room8.nw","mafia_hospital-room9.nw","mafia_hospital-room10.nw","mafia_hospital-room11.nw","mafia_hospital-room12.nw","mafia_hospital-room13.nw","mafia_hospital-room14.nw"}; 
this.coords0 = {{28.75,44.5},{42.5,45.5}};
this.coords1 = {{24,15.5},{45.125,15.5},{57.75,15.5},{10.25,43.5} ,{40.25,47.5}};
this.coords2 = {{29.1875,43.5},{42.6875,43.75}};
this.coords3 = {{29.25,43},{42.6875,43.6875}};
this.coords4 = {{28.5625,44.25},{42.9375,44.25}};
this.coords5 = {{28.9375,44.0625},{42.6875,44.0625}};
this.coords6 = {{29,44.5},{42.6875,44.5}};
this.coords7 = {{28.5,44.25},{42.75,44.5}};
this.coords8 = {{28.5625,44.25},{42.4375,44.5}};
this.coords9 = {{29.0625,44.25},{42.5625,44.25}};
this.coords10 = {{28.9375,44.25},{42.4375,44.5}};
this.coords11 = {{28.9375,44.5},{42.9375,44.5}};
this.coords12 = {{28.9375,44.25},{44.5,44.125}};
this.coords13 = {{28.5625,44.25},{42.6875,44.5}};
this.warplvl = int(random(0,1));
this.warpxy = int(random(0,5));
setlevel2(this.hosplvls[this.warplvl],makevar("this.coords" @ this.warplvl)[this.warpxy][0],makevar("this.coords" @ this.warplvl)[this.warpxy][1]);




What it is for is when you die you get randomly warped to a hospital room. But it warps the player to the corner of the level not where the cord is. Can Someone help me?
__________________


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
  #2  
Old 05-29-2007, 12:13 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Are you checking for the condition that the random index is 3 and yet you have only two coordinate sets for that level? And please use PHP tags next time ^_^
__________________
Reply With Quote
  #3  
Old 05-29-2007, 12:41 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Try something like this ... I didn't really understand what you were doing in your code.

PHP Code:
function warpToHosptial()
{
  
this.locations = {
                          { 
"level1.nw"x},
                          { 
"level2.nw"x},
                          { 
"level3.nw"x}
                        };
  
temp.ran random0this.locations.size() );
  
temp.coords this.locations[temp.ran];
  
player.setlevel2temp.coords[0], temp.coords[1], temp.coords[2] );

__________________
Reply With Quote
  #4  
Old 05-29-2007, 12:41 AM
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
Quote:
Originally Posted by Inverness View Post
Are you checking for the condition that the random index is 3 and yet you have only two coordinate sets for that level? And please use PHP tags next time ^_^
i just don't know what to do lol i'm still new to scripting
__________________


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
  #5  
Old 05-29-2007, 12:43 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Read my post above, in case you didn't see it ... You posted several seconds after I did.
__________________
Reply With Quote
  #6  
Old 05-29-2007, 12:50 AM
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
Quote:
Originally Posted by cbkbud View Post
Try something like this ... I didn't really understand what you were doing in your code.

PHP Code:
function warpToHosptial()
{
  
this.locations = {
                          { 
"level1.nw"x},
                          { 
"level2.nw"x},
                          { 
"level3.nw"x}
                        };
  
temp.ran random0this.locations.size() );
  
temp.coords this.locations[temp.ran];
  
player.setlevel2temp.coords[0], temp.coords[1], temp.coords[2] );

ok you are just putting the levels and x,y's in one flag so that it's easier to call them randomly?
__________________


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
  #7  
Old 05-29-2007, 12:52 AM
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
but i have more than one x,y for the level
__________________


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 05-29-2007, 01:01 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
Why do you have multiple sets of coordinates per each this.coords*?
Are they all the possible warp coordinates for each hospital warp level?

Try this:
PHP Code:
this.hosplvls = {"mafia_hospital-room1.nw","mafia_hospital-room2.nw","mafia_hospital-room3.nw","mafia_hospital-room4.nw","mafia_hospital-room5.nw","mafia_hospital-room6.nw","mafia_hospital-room7.nw","mafia_hospital-room8.nw","mafia_hospital-room9.nw","mafia_hospital-room10.nw","mafia_hospital-room11.nw","mafia_hospital-room12.nw","mafia_hospital-room13.nw","mafia_hospital-room14.nw"}; 
this.coords0 = {{28.75,44.5},{42.5,45.5}}; 
this.coords1 = {{24,15.5},{45.125,15.5},{57.75,15.5},{10.25,43.5} ,{40.25,47.5}}; 
this.coords2 = {{29.1875,43.5},{42.6875,43.75}};
this.coords3 = {{29.25,43},{42.6875,43.6875}};
this.coords4 = {{28.5625,44.25},{42.9375,44.25}};
this.coords5 = {{28.9375,44.0625},{42.6875,44.0625}};
this.coords6 = {{29,44.5},{42.6875,44.5}};
this.coords7 = {{28.5,44.25},{42.75,44.5}};
this.coords8 = {{28.5625,44.25},{42.4375,44.5}};
this.coords9 = {{29.0625,44.25},{42.5625,44.25}};
this.coords10 = {{28.9375,44.25},{42.4375,44.5}};
this.coords11 = {{28.9375,44.5},{42.9375,44.5}};
this.coords12 = {{28.9375,44.25},{44.5,44.125}};
this.coords13 = {{28.5625,44.25},{42.6875,44.5}};
this.warplvl int(random(0,this.hosplvls.length()));
this.newcoords "this.coords" this.warplvl;
this.warpxy int(random(0,this.newcoords.length()));
setlevel2(this.hosplvls[this.warplvl],this.newcoords[this.warpxy][0],this.newcoords[this.warpxy][1]); 
Reply With Quote
  #9  
Old 05-29-2007, 01:10 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by PrinceOfKenshin View Post
but i have more than one x,y for the level
Then add the level more than once ...

PHP Code:
function warpToHosptial()
{
  
this.locations = {
                          { 
"level1.nw"1012 },
                          { 
"level1.nw"2056 },
                          { 
"level1.nw"3019 },
                          { 
"level1.nw"4023 },
                          { 
"level1.nw"5015 }
                        };
  
temp.ran random0this.locations.size() );
  
temp.coords this.locations[temp.ran];
  
player.setlevel2temp.coords[0], temp.coords[1], temp.coords[2] );

__________________
Reply With Quote
  #10  
Old 05-29-2007, 01:15 AM
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
It still does the same thing it warps the player to the corner of the level
__________________


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
  #11  
Old 05-29-2007, 01:21 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
Well that means it's returning 0's for the coordinates, so something must be in getting the numbers from the arrays.

I think cbkbud's is the best way to go, and a lot easier for adding/removing levels/coordinates.
Reply With Quote
  #12  
Old 05-29-2007, 01:22 AM
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
Could i just put all the coords in this.coords0 and this.coords1?
__________________


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
  #13  
Old 05-29-2007, 01:32 AM
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
xD wow i'm stupid i found the problem thanks for your guys help
__________________


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
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 05:22 PM.


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