Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   playing with inventory (https://forums.graalonline.com/forums/showthread.php?t=11537)

ownerofbabylon 09-10-2001 04:48 AM

playing with inventory
 
Im trying to make somthing to do with inventory. How would I do this. I want to have NPCs that the player gets and every time they get them i want it to add 1 to the inventory but also to a string or somthing. This way they can get 3 of the NPC and it shows 3 in the inventory but wont allow them to get more until they go to some place and use it up. For example:

On bread baking on 2001, say you could carry 3 things of wheat. It showed 3 wheat symbols in the inventory. Then they had to carry it back to the bread place and they would walk to a table and 1 one disappear from the inventory leaving 2 wheat icons. Then the actions would happen. After making the first bread they had 2 wheats left. They can either go get another to make 3 there or just use up the other 2. How would this work. I dont know how to make it take 1 away from the inventory.

Shard_IceFire 09-10-2001 04:52 AM

Well, you could do it so everytime a person gets wheat (or whatever else) it adds to a string.
NPC Code:

this.wheatplus=strtofloat(#s(wheatammt))+1;
setstring wheatammt,#v(this.wheatplus);


Then to read the string you could make it like when you touch an NPC he does this:
NPC Code:

message Your wheat: #s(wheatammt);


I hope that helps =)
If it doesn't IM me, I can help you work it out.

BocoC 09-10-2001 09:03 AM

toinventory flag; is pretty buggy. I wouldn't recommend using it. First off, if you disconnect then reconnect your items don't show up again in your inventory place. Second off, once you unset flag, all the items in your inventory under that flag go bye bye.

entravial 09-10-2001 10:10 AM

~AlphaFlame~

If you want it to show up multiple times... do like this

toweapons /the-weapon-name;

I believe that works ;)

ownerofbabylon 09-10-2001 10:16 AM

i think i will just go with shard's idea and use a string and not inventory. The only reason i wanted to use inventory is cuz it actually shows an image of what the player has.

BocoC 09-10-2001 10:26 AM

You could program your own inventory script...

entravial 09-11-2001 12:43 PM

~AlphaFlame~

While in essence making your own inventory script is good, it's not preferable... if it's simply multiple of an item you want, just use toweapons /(item name);

Using that, the item will more or less go to the inventory under the same name multiple times. Handy for stuff like potions...

joseyisleet 09-11-2001 12:53 PM

or...
 
i was thinkin, i may be wrong but, you could use the set command and while command.
if (playerenters){toweapons test;set 1;}
while (1){setimg 1.gif;}
theres one npc
if (playerenters&&1){toweapons test; set 2; unset 1;}
while (2){setimg 2.gif;}
second one.
and so on and so on.
im half awake so if this doesnt work dont b*tch at me. :rolleyes:

SSj_Link 09-15-2001 04:42 AM

Hmmm
Use flags,
and the toinventory \thing

Like

if (wheat&&!wheat1) {
towhatever \whaterver;
}



I know that probly confused

-Freaky-

entravial 09-15-2001 04:58 AM

~AlphaFlame~

DO NOT USE FLAGS!
NO NO NO PERIOD!

If you have to use flags for that, then shoot yourself, and stop scripting.

if (playertouchsme){
if (!hasweapon(Wheat 1) && !hasweapon(Wheat 2) && !hasweapon(Wheat 3)){
toweapons Wheat 1;
break;
}
if (hasweapon(Wheat 1)){
toweapons Wheat 2;
break;
}
if (hasweapon(Wheat 2)){
toweapons Wheat 3;
break;
}
}

Would be more efficient than the flags. And that's not much better.

And besides, the toweapons / will add that NPC MULTIPLE times to your inventory ANYWAY.


All times are GMT +2. The time now is 08:40 PM.

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