ID:155747
 
I was curious how to code a itemshop, but more so on the level of a shopkeeper. As in you click/double click the shop keeper and a list of items appear for purchase. How would i go about doing that. Also i wanted to know how to make customizable mobs, do i have to icon every mob with all the different skin types, hair/eye color and color clothing? Thx in advance
Snyperwolf wrote:
Also i wanted to know how to make customizable mobs, do i have to icon every mob with all the different skin types, hair/eye color and color clothing? Thx in advance


hair color and clothing color a merely overlays by changing it you can remove the old overlay and replace it with the new
So lets say i wanna make a mob with a shirt and sword, the shirt would be overlay 1 and th sword overlay 2? I ask because i was wondering if it was possible to have a sword on the back of the shirt when unequipped(only shows from the back of the mob) and in the mobs hand when equipped.
In response to Snyperwolf
remember you have icon_states. so you can have 2 character icons, one with a sword in hand and one with the sword on his/her back. 2 different icon_state's

For example (very rough, Im also kinda new)
verb/equip_sword() //equip/unequip sword verb 
var/equipped
//verb riff raff will be here
if(equipped = 1)
icon = 'icons.dmi'
icon_state = "player_with_sword"

if(equipped = 0)
icon = 'icons.dmi'
icon_state = "player_sword_on_back"


So it depends. If you decide the mob/usr will look different after a procedure or whatnot, then you should change the icon state as shown above.

I'm fairly new so if anyone wants to correct me then go ahead :)
In response to Saladon
Ok i can understand that, but im trying to figure out is it possible to have for example 3 icon states. 1 with no weapon 2 with weapon brought but unequipped(on back)and 3. when equipped holds the sword. Also i still trying to figure out how would i start coding a shopkeeper npc. That where u click him/her items appear and u click the items to buy(if they had enough money)
In response to Snyperwolf
Edit: Ignore the paragraph I deleted. I was wrong

for coding a shopkeeper, thats a little more tricky. I'm not very experienced but I am busy trying to code a basic shopkeeper myself. But you need to try it for yourself so that you can learn things as you go. It's alot more complicated than it sounds and I don't think someone is going to give you their shopkeeper code. :) But if you try it yourself and ask questions as you go along, you will get it done eventually

In response to Saladon
I know nobody is giving away codes im just confused where i start.Like i have the icon and the building i want them to be in i just dont know what i do next
In response to Snyperwolf
Sorry to be that guy, but it sounds like you need to read some of the guide.

http://www.byond.com/docs/guide/
In response to OrangeWeapons
I did the tutorial twice all 233,and it doesnt explain itemshop codes
In response to Saladon
Correcting you, =P

Inside parenthesis, comparisons need to be made by using ==,||,&&, not =,|, or &.

For making, and having a variable be true and false, instead of using 1 and zero, do it like this:

var/finished //automatic null
var/finished = 1 //make true


(changing inside a verb
finished = !finished //makes finished null
finished = 1 //make finished true

So, basically True and False(null)


(Ps:Higher-ups, please don't try to correct me on some trivial matter such as a mis-guided term, etc...)
mob/ShopKeeper
Click()
switch(input("What do you want?")in list("Sword","Leave"))
if("Sword")
var/obj/X = new/obj/Sword
X.loc = usr

In response to Warriormax
Thank you i appreciate the help
In response to Snyperwolf
Is there a way to have 3 icon states for mobs?
In response to Snyperwolf
You can have as many icon states as you want.
In response to Saladon
This is has more to do with my swordman, so i can have an icon state for equipped items?
In response to Snyperwolf
You just set his icon_state when something happens..

obj/sword
verb/PickUp()
src.loc=usr
usr.Icon_state="2"
In response to Kylemark
No Homo but i appreciate you guys, im glad ya'll was able 2 help me. Btw the reason i asked so many questions was because i am making, iconning, coding and programming a Naruto fan game from the ground up. Its a big project in my head i want it as close to the manga as humanly possbile because Goa rips and Log training rips have so much unused potential.Either way again thanks everyone for the speedy and indepth help
In response to OrangeWeapons
OrangeWeapons wrote:
(changing inside a verb
finished = !finished //makes finished null
finished = 1 //make finished true

So, basically True and False(null)

Don't correct others without willing to be corrected yourself.

Doing finished = !finished does NOT automatically make it null. Doing finish = !finished gives it the opposite value of what it already had. If it was true, doing that would make it false. If it was false, doing that would make it true.

So if your goal is to make a verb that just switches finished off and on, you would only need that one line: finished = !finished.
In response to Spunky_Girl
Lol, I'm really **tarded lately. XD