PDA

View Full Version : why does this happen?


johny023
09-05-2008, 02:59 AM
i built a refrigerator for my offline world, it's basically just stores food so you don't have to clutter your inventory or if you just don't feel like getting food you can take some of the food you stored in the refrigerator.

i made it and it worked fine for a while, but then it started making graal crash when you took something out, and it doesn't happen every time but it does happen a lot. when graal crashes it just freezes and if i press F4 to go back to the editor mode it only half opens it and that also freezes, but i get a error message that says

" Access violation at address 00402FCO in module "GraalEditor.exe', Read of address 40EFE3FC " why does this happen? this is how i scripted it..

this part of the script is in the refrigerator

if (actionapressed) {
sleep 0.1;
foodselect = 3;
disableweapons;
timeout = 0.05;
}

" foodselect = 3; " opens 2 menus that show what's in your invitory and what's in the refrigerator. then i click on the item on the menu i want

if (actionleftmouse){
triggeraction fridgex+1,fridgey+1,tsoda,soda;
putnpc block.gif,frigesoda.txt,x,y;
}

that places the weapon that goes to your invitory then sends a triggeraction to the refrigerator saying that you took 1 soda out

refrigerator's script

if (actiontsoda){
foodselect = 0;
sleep 0.2;
this.soda -= 1;
foodselect = 3;
timeout = 0.05;
}

weapon's script
// NPC made by john
if (created) {
}

if (playerenters && !isweapon){
toweapons /Coke;
if (!isweapon) destroy;
}

if (weaponfired){
setani drink_potion,soda1.gif;
playerhealth += 30;
stamina += 50;
playerfood += 30;
destroy;
}

if (isweapon){
setimg soda1.gif;
}

it was working for a day or two.. but now it randomly freezes when i use it. there's more script in the npcs but that's the script that's being used.

i know that won't work online.. it's a offline world, but i would like to know why this happens and how to fix it?

Tigairius
09-05-2008, 03:11 AM
Probably something to do with putnpc.

johny023
09-05-2008, 03:19 AM
is putnpc glitched or something? because i use that a lot.... and never really had a problem with it... i had to stop using the "playertouchsme" trigger because that was freezing it to...

LoneAngelIbesu
09-05-2008, 05:39 AM
if (playerenters && !isweapon){
toweapons /Coke;
if (!isweapon) destroy;
}
When a player enters, you're checking to see if the NPC is not a weapon. If it's not a weapon, you add it. Then, you destroy it. What's the purpose of that?

xXziroXx
09-05-2008, 02:06 PM
When a player enters, you're checking to see if the NPC is not a weapon. If it's not a weapon, you add it. Then, you destroy it. What's the purpose of that?

Since it's offline, scripts doesn't differ client/serverside - so playerenters is triggered "serversided" in weapon NPC's as well, so he's dodging that by checking it's not already a weapon.

I remember doing that a lot for my offline playerworld(s) in the past. ^^