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 01-06-2005, 01:44 AM
Zickle Zickle is offline
Awesome
Zickle's Avatar
Join Date: Dec 2002
Posts: 121
Zickle is on a distinguished road
Send a message via ICQ to Zickle Send a message via AIM to Zickle Send a message via MSN to Zickle Send a message via Yahoo to Zickle
Warp Player and Max Heart Problem

2 Questions:

1) How do you warp a player in a while (visible) {if (mousedown) {WARP PLAYER} } (Thats not the full code but thats how its done, sorta. Setlevel2 isnt working. But it works in a simple if (playerchats&&strequeals(#c,)) {} script.

2) I got a server, how do I make it so that people start off with 5 hearts instead of 3?
__________________
Reply With Quote
  #2  
Old 01-06-2005, 01:46 AM
Evil_Trunks Evil_Trunks is offline
Evil
Evil_Trunks's Avatar
Join Date: Dec 2004
Posts: 391
Evil_Trunks is on a distinguished road
Quote:
Originally Posted by Zickle
while (visible) {if (mousedown) {WARP PLAYER} }
Ahhhhhhhhhhhh!

Quote:
2) I got a server, how do I make it so that people start off with 5 hearts instead of 3?
actionplayeronline, set a flag once you initialize their stats
__________________

Reply With Quote
  #3  
Old 01-06-2005, 02:09 AM
ZeroTrack ZeroTrack is offline
G2K1 Developer
ZeroTrack's Avatar
Join Date: Apr 2004
Location: LongIsland, NY
Posts: 402
ZeroTrack is on a distinguished road
Send a message via AIM to ZeroTrack
Quote:
Originally Posted by Zickle
1) How do you warp a player in a while (visible) {if (mousedown) {WARP PLAYER} } (Thats not the full code but thats how its done, sorta.
for the love of your nc dont do that!
Quote:
Originally Posted by Zickle
Setlevel2 isnt working. But it works in a simple if (playerchats&&strequeals(#c,)) {} script.
setlevel2 is serverside just making sure you know this
Quote:
2) I got a server, how do I make it so that people start off with 5 hearts instead of 3?
most widely use with actionplayeronline in the control npc like trunks said, but using the graal default hp system is not recommended , at least not by me
__________________

Reply With Quote
  #4  
Old 01-06-2005, 02:16 AM
Polo Polo is offline
Classic Systems Admin
Join Date: Sep 2002
Location: Vancouver, Canada
Posts: 735
Polo is on a distinguished road
Send a message via AIM to Polo
Quote:
Originally Posted by ZeroTrack
...using the graal default hp system is not recommended , at least not by me
I emulated all of classic movement and hit detection because I agree with this... it was painful though, a small part of me died.
__________________
Be good little players, or Master Storm will ban you!



Proof that the staff are crazy..
*Ghost Pirate: I'm a little teacup short and stubbe here is my raygun here is my butt
DragonX: Jumping jack rabbits Batman! Our eggo waffles have been stolen! To the batmobile Robin!
X-Mann (RC): I have a head ache
Reply With Quote
  #5  
Old 01-06-2005, 02:22 AM
Zickle Zickle is offline
Awesome
Zickle's Avatar
Join Date: Dec 2002
Posts: 121
Zickle is on a distinguished road
Send a message via ICQ to Zickle Send a message via AIM to Zickle Send a message via MSN to Zickle Send a message via Yahoo to Zickle
Okay well look heres my code:
NPC Code:

removed, see newer code.


Works offline, not online.
__________________

Last edited by Zickle; 01-06-2005 at 06:28 AM..
Reply With Quote
  #6  
Old 01-06-2005, 05:05 AM
xManiamaNx xManiamaNx is offline
Supreme Dictator
xManiamaNx's Avatar
Join Date: Nov 2002
Location: 127.0.0.1
Posts: 385
xManiamaNx is on a distinguished road
Send a message via MSN to xManiamaNx Send a message via Yahoo to xManiamaNx
AAahh dont use while loops for something like that. Use a timeout instead.

Why are there multiple instances of //#CLIENTSIDE?
__________________
Maniaman

Play Maloria Now: [2.3] [3]
Maloria Website

Reply With Quote
  #7  
Old 01-06-2005, 05:13 AM
Zickle Zickle is offline
Awesome
Zickle's Avatar
Join Date: Dec 2002
Posts: 121
Zickle is on a distinguished road
Send a message via ICQ to Zickle Send a message via AIM to Zickle Send a message via MSN to Zickle Send a message via Yahoo to Zickle
Quote:
Originally Posted by xManiamaNx
AAahh dont use while loops for something like that. Use a timeout instead.
Is there a difference?
Quote:
Originally Posted by xManiamaNx
Why are there multiple instances of //#CLIENTSIDE?
SHHH! You see nothing.
__________________
Reply With Quote
  #8  
Old 01-06-2005, 05:37 AM
Tolnaftate2004 Tolnaftate2004 is offline
penguin.
Join Date: Jul 2004
Location: Berkeley, CA
Posts: 534
Tolnaftate2004 is a jewel in the roughTolnaftate2004 is a jewel in the rough
Send a message via AIM to Tolnaftate2004
setlevel2 must be serverside.
Reply With Quote
  #9  
Old 01-06-2005, 06:26 AM
Zickle Zickle is offline
Awesome
Zickle's Avatar
Join Date: Dec 2002
Posts: 121
Zickle is on a distinguished road
Send a message via ICQ to Zickle Send a message via AIM to Zickle Send a message via MSN to Zickle Send a message via Yahoo to Zickle
Okay! I got it down to a simple:
NPC Code:
// NPC made by ZicklePop
while (visible) {
if (client.statsgender=boy) {
setlevel2 zercha-start-boy.nw,30,32.5;
}
if (client.statsgender=girl) {
setlevel2 zercha-start-girl.nw,30,32.5;
}
sleep 0.1;
}


Whats wrong with it?
__________________
Reply With Quote
  #10  
Old 01-06-2005, 06:30 AM
Evil_Trunks Evil_Trunks is offline
Evil
Evil_Trunks's Avatar
Join Date: Dec 2004
Posts: 391
Evil_Trunks is on a distinguished road
that's a completely terrible script

I will tell you why

first of all, you are doing a 0.1 second loop serverside, which is the worst idea ever if you can at all avoid it

you are comparing strings wrong

NPC Code:
if (strequals(#s(this.string),some text)) {



that is the kind of format you must use in GScript

third you are doing your loop using while and sleep, that's a horrible idea
use timeout for loops

fourth, this kind of thing should be integrated into whatever system you have for picking the gender in the first place

good luck with improving your scripting abilities, we all have to start from somewhere
__________________

Reply With Quote
  #11  
Old 01-06-2005, 06:42 AM
Slash-P2P Slash-P2P is offline
Banned
Join Date: May 2004
Location: Burning Blade
Posts: 941
Slash-P2P is on a distinguished road
NPC Code:

// NPC made by ZicklePop
while (visible) {
if (client.statsgender=boy) {
setlevel2 zercha-start-boy.nw,30,32.5;
}
if (client.statsgender=girl) {
setlevel2 zercha-start-girl.nw,30,32.5;
}
sleep 0.1;
}



For the love of Govannon, don't use 'while'.

Your mouse stuff is clientside. Your setlevel stuff is serverside.
Practice using triggeraction to call serverside stuff for warping.
Reply With Quote
  #12  
Old 01-06-2005, 06:46 AM
Sildae Sildae is offline
Elven sorceress!
Sildae's Avatar
Join Date: Dec 2001
Location: Lothlòrien
Posts: 159
Sildae is on a distinguished road
Quote:
Originally Posted by Evil_Trunks
actionplayeronline, set a flag once you initialize their stats
What a waste of a perfectly fine flag! if (playerfullhearts < 5) playerfullhearts = 5; and be done with it!

Quote:
Originally Posted by Slash-P2P
Your mouse stuff is clientside. Your setlevel stuff is serverside.
Practice using triggeraction to call serverside stuff for warping.
Why could I not move the mouse stuff to the server side instead?
__________________
"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man."
-- George Bernard Shaw
Reply With Quote
  #13  
Old 01-06-2005, 06:47 AM
Zickle Zickle is offline
Awesome
Zickle's Avatar
Join Date: Dec 2002
Posts: 121
Zickle is on a distinguished road
Send a message via ICQ to Zickle Send a message via AIM to Zickle Send a message via MSN to Zickle Send a message via Yahoo to Zickle
But doesnt it have to be in its own NPC because of Serverside and Clientside?
__________________
Reply With Quote
  #14  
Old 01-06-2005, 06:58 AM
Zickle Zickle is offline
Awesome
Zickle's Avatar
Join Date: Dec 2002
Posts: 121
Zickle is on a distinguished road
Send a message via ICQ to Zickle Send a message via AIM to Zickle Send a message via MSN to Zickle Send a message via Yahoo to Zickle
NPC Code:

// NPC made by ZicklePop
if (created) setshape 1,1,1;
if (actionplayerboy) setlevel2 zercha-start-boy.nw,30,32.5;
if (actionplayergirl) setlevel2 zercha-start-girl.nw,30,32.5;
//#CLIENTSIDE
if (strequals(#s(client.statsgender),boy)) {
sleep 0.1;
triggeraction x,y,playerboy,;
}
if (strequals(#s(client.statsgender),girl)) {
sleep 0.1;
triggeraction x,y,playergirl,;
}


Thats my current code, but it only works on update level (or level refresh wahtever you call it)
__________________
Reply With Quote
  #15  
Old 01-06-2005, 07:08 AM
Evil_Trunks Evil_Trunks is offline
Evil
Evil_Trunks's Avatar
Join Date: Dec 2004
Posts: 391
Evil_Trunks is on a distinguished road
where is client.statsgender being set?

that's where you should be calling the level switch

(as a side note: client. flags are insecure and are able to be edited clientside by malicious players using certain programs)
__________________

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:09 PM.


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