Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Saving Info (https://forums.graalonline.com/forums/showthread.php?t=16060)

Poogle 11-03-2001 10:24 AM

Saving Info
 
(CHRIS: )
I need to know how to save varibles when my car runs out of gas and i need to make it so only ppl who OWN that car can fill it with more fuel to drive it away!!!!!!!!!! HELP !!!

Poogle 11-03-2001 10:38 AM

Post Answers plz!!!
 
I am only writing this to bring it back to the op of list because otherwise you get ignored!!!!!!!! PLZ DONT IGNORE ME I NEED HELP!!!!!!!!!!!

TDO2000 11-03-2001 10:39 AM

wasn't there something like this.strings for P2P Playerworlds?

so i would
use something like this:

if(buying){
sestring this.owner,#a;
}


filling:
(use trigegraction for it)

car:
if(actionefillup){
if(strequals(this.owner,#a)){
this.gas=100; //just for example ;)
}
else {say2 Not Your car;}
}

the refiller

if(weaponfired){
triggeraction playerx+1.5+vecx(playerdir)*2,playery+2+vecy(playe rdir)*2,fillup,#a;
}

don't know if it works...

Poogle 11-03-2001 10:44 AM

Thnx
 
Thnx i wil try it Ur good!
BTW: will that hang on even after they log off?

Poogle 11-03-2001 10:54 AM

i got a better wat to do it
 
i gfot a way to do it but i need to save it like position and stuff so they can come back to it!

Poogle 11-03-2001 11:01 AM

Quote:

Originally posted by TDO2000
wasn't there something like this.strings for P2P Playerworlds?

so i would
use something like this:

if(buying){
sestring this.owner,#a;
}


filling:
(use trigegraction for it)

car:
if(actionefillup){
if(strequals(this.owner,#a)){
this.gas=100; //just for example ;)
}
else {say2 Not Your car;}
}

the refiller

if(weaponfired){
triggeraction playerx+1.5+vecx(playerdir)*2,playery+2+vecy(playe rdir)*2,fillup,#a;
}

don't know if it works...

(Nick:) I would have done it a harder way lol.

Poogle 11-03-2001 11:28 AM

hers the script FILL ME UP DOC!
 
// NPC made by ~|¤Colit¤|~
if (playerenters) {
message BUY ME!;
this.fuel=100;
this.x = x;
this.y = y;
}
if (playertouchsme) {

if (strequals(#c,Get in)){
set incar;
setstring this.owner,#a;
playerx = this.x;
playery = this.y;
hideplayer 1;

} if (strequals(#c,Get in)){
if (this.owner == #a){
set incar;
setstring this.owner,#a;
playerx = this.x;
playery = this.y;
hideplayer 1;
} }}

if (strequals(#c,Exit)) {
enableweapons;
playerdir=2;
playery+=2;
unset incar;
}
while (playerhearts>=0) {
if (incar) {
if (keydown(0)) {
if (!onwall(x+0.5,y-0.5)) {
y-=0.5;
this.fuel = this.fuel-.1;
}
}
if (keydown(1)) {
if (!onwall(x-0.5,y+0.5)) {
x-=0.5;
this.fuel = this.fuel-.1;
}
}
if (keydown(2)) {
if (!onwall(x+0.5,y+2)) {
y+=0.5;
this.fuel = this.fuel-.1;
}
}
if (keydown(3)) {
if (!onwall(x+2,y+0.5)) {
x+=0.5;
this.fuel = this.fuel-.1;
}
}
}}
while (playerhearts>=0) {
if (incar) {
if (keydown(0)) {
if (!onwall(x+0.5,y-0.5)) {
y-=0.5;
this.fuel = this.fuel-.1;
}
this.cardir=0;
}
if (keydown(1)) {
if (!onwall(x-0.5,y+0.5)) {
x-=0.5;
this.fuel = this.fuel-.1;
}
this.cardir=1;
}
if (keydown(2)) {
if (!onwall(x+0.5,y+2)) {
y+=0.5;
this.fuel = this.fuel-.1;
}
this.cardir=2;
}
if (keydown(3)) {
if (!onwall(x+2,y+0.5)) {
x+=0.5;
this.fuel = this.fuel-.1;
}
this.cardir=3;
}
if (exploded) {
this.fuel--;
}
if (this.fuel<=0) {
enableweapons;
unset incar;
}
freezeplayer 0.05;
hideplayer 0.05;
playerx=x-0.5;
playery=y-1;
playerhearts=playerfullhearts;
}
message #v(this.fuel);
sleep 0.05;
}
if (incar){
if (timeout){
message FUEL:#v(this.fuel);
timeout = 1;
}}


now make it so i can fill the tank and save the location when the tank runs out even if they go offline plz help me! i need service stations too (cheaper ten the gas can and faster too!)

Poogle 11-03-2001 11:30 AM

good idea?
 
is this a good idea?

TDO2000 11-03-2001 09:50 PM

Re: hers the script FILL ME UP DOC!
 
first thing:
make a better keydown-routine with for loops

for(this.i=0;this.i<4;this.i++){
if(keydown(this.i)){
if(!onwall(playerx+1.5+vecx(this.i)*.5,playery+2+v ecy(this.i)*.5)){
playerx+=vecx(this.i)*.5;
playery+=vecy(this.i)*.5;
playerdir=this.i;
}
}
}

it's not a good onwall check but I dont want to write too much ;)

I would also use triggeractions for filling up but I think there is a better way then this I think of, if u use NPC-Server...

Poogle 11-03-2001 10:46 PM

No..........
 
Just tell me how i can increase a this. variable with another NPC i could put a value into a temp npc then say that (this.fuel=tempstr)
but i cant place a string ike that!!! HELOP?!?!?!?!

Poogle 11-03-2001 11:42 PM

PLZ hurry
 
PLZ hurry i only got 70 or 80 years left in my life!!!!!!!!!!!!!!!!!!!!!!!



<CHRIS>

Xaviar 11-04-2001 01:54 AM

*blinks* Isn't this the sort of thing the save array is for?

Poogle 11-04-2001 01:55 AM

(Nick: )Umm i think its like save[#] I used it before but didnt really understand it

Xaviar 11-04-2001 01:59 AM

Quote:

Originally posted by Poogle
(Nick: )Umm i think its like save[#] I used it before but didnt really understand it
[sarcasm]
No, the save array is special, you have to put the index before the name of it, and it uses <>'s to mark the subscript instead of []'s
[/sarcasm]

;) Just kidding, I was just wondering why you guys didn't use the save array instead of strings?

Poogle 11-04-2001 08:27 AM

SAVE ARRAY?
 
Well never used it before tell me how and i will use it! Otherwise im not up a crick w/out a paddle im in space without air!!!!

Poogle 11-04-2001 11:22 AM

TELL ME NOW!
 
i am losing my patince tell me how to use the save array plz!?!?!?!


All times are GMT +2. The time now is 01:39 PM.

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