Blockland Forums > Modification Help

Question(s)

Pages: << < (4/6) > >>

Iban:


--- Quote from: Placid on March 23, 2011, 09:05:07 AM ---Thanks a lot. There's only one problem now; it gives me the gun image, shows that I have it in slot 4, but it doesn't let me use it. If I scroll down from printer, it shows that I have a printer. If I press q while in slot 4, it doesn't show any item.

--- End quote ---
I made a derp.

Replace all instances of %player with %obj.

Placid:


--- Quote from: Iban on March 23, 2011, 02:16:35 PM ---I made a derp.

Replace all instances of %player with %obj.

--- End quote ---
yeah, i fixed it on the plane

thanks anyways.


Placid:

actually, one last question. I'm attempting to make a save/load process, but to no avail. when I'm doing it, I'm using a global variable such as the ones that I was using before. Would this be a good way to go about this or would it be better to make a file in like, config? I've had no good experiences with files before and can't seem to get them working.


--- Code: --- function SaveLoadout(%c) {
if(!isObject(%c)) {
messageClient(%c,'',"\c3You cannot save current loadout - you do not have a client!");
return;
} else {
%maxtools=%c.player.getDatablock().MaxTools;
for(%i=0;%i<%maxTools;%i++) {
$GunMod::Loadout[%c.getBLID] = $GunMod::Loadout[%c.getBLID] + %c.player.tool[%i].getname();
}
}
}

function LoadLoadout(%c) {
%p=%c.player;
%maxtools = %p.getDatablock().maxtools;
if(getWordCount($GunMod::Loadout[%c.getBLID]) > %maxtools) {
messageClient(%c,'',"\c3Your tool loadout has too many tools for your current inventory.");
} else {
for(%i=0;%i<getwordcount($GunMod::Loadout[%c.getBLID]);%i++) {
%player.tool[%i]="";
%player.weaponcount--;
%tool = getWord($GunMod::Loadout[%c.getBLID],%i);
%player.tool[%i] = %tool.getID;
%player.weaponcount++;
messageClient(%c,'MsgItemPickup','',%i,%tool);
}
}
}
--- End code ---
is the code. I don't know why, but it's saving as $GunMod::Loadout[%c.getBLID] instead of a BLID.. would it be taking this literally? It also saves that variable as 0, and I don't know why.

Red_Guy:


--- Quote from: Placid on March 24, 2011, 12:29:03 PM ---is the code. I don't know why, but it's saving as $GunMod::Loadout[%c.getBLID] instead of a BLID.. would it be taking this literally? It also saves that variable as 0, and I don't know why.

--- End quote ---
find out what %c.getBLID is supposed to do and you'll have your answer.

I suspect getBLID is a function, but you wrote it like a variable, so its not working
it could also be %c has no value.

echo() is your friend for stuff like this

Placid:


--- Quote from: Red_Guy on March 24, 2011, 02:13:50 PM ---find out what %c.getBLID is supposed to do and you'll have your answer.

I suspect getBLID is a function, but you wrote it like a variable, so its not working
it could also be %c has no value.

echo() is your friend for stuff like this

--- End quote ---
i did echo this. .getblid works for clients, it's also defined, i've tried those already. gonna try replacing %c.getblid with %id = %c.getblid and then [%id]... i dunno if it'll fix it, but it's worth a try.

Pages: << < (4/6) > >>

Go to full version