Page 1 of 1

Making paint - script help

PostPosted: Sun Aug 09, 2009 1:37 am
by Nicholas
Once again, I am stuck on a script for my new mod idea :P

Basically I am making a little workshop belonging to an artist NPC, who has a "paintmaker". If the player has the right ingredients, he/she can make pots of paint with them. For this I have attached a script to the paintmaker, but am having problems getting it working. With the needed ingredients in my characters inventory, it still doesn't give me the paint.. here is what I have:

begin aiy_makepaintshort controlvarshort buttonshort objectcountif ( MenuMode == 1 )	returnendifif ( controlvar == 1 )	set button to GetButtonPressed	if ( button == 3 )		return	elseif ( button == 0 )		if ( GetItemCount "ingred_stoneflower_petals_01" >=1 )			player->additem "aiy_paint_blue" 1			player->removeitem "ingred_stoneflower_petals_01" 1			set controlvar to 0		else			return			set controlvar to 0		endif	elseif ( button == 1 )		if ( GetItemCount "ingred_gold_kanet_01" >=1 )			player->additem "aiy_paint_yellow" 1			player->removeitem "ingred_gold_kanet_01" 1			set controlvar to 0		else			return			set controlvar to 0		endif	elseif ( button == 2 )		if (GetItemCount "ingred_fire_petal_01" >=1 )			player->additem "aiy_paint_red" 1			player->removeitem "ingred_fire_petal_01" 1			set controlvar to 0		else			return			set controlvar to 0		endif	else		set controlvar to 0		return	endifelse	if ( onactivate ) 		MessageBox "Proceed in making paint?", "Blue", "Yellow", "Red", "None"		set controlvar to 1	endifendifend


I am also unsure if the little "else return setcontrolvar to 0 endif" parts after each paintmaking part are necessary.

I would also like to expand the script and, on successful paintmaking, let one hour pass and a messagebox come up saying "You have created [colour] paint."
I don't know what action should happen if the player clicks a colour button and doesn't have the ingredients - at the moment the dialogue box just goes away (I think), maybe a message box should come up there too? Or should it be written so that, if clicked, the dialogue box remains (so you'd have to press "none" to exit)?

Making paint - script help

PostPosted: Sun Aug 09, 2009 6:42 am
by victoria gillis
Your count and method are a little different than what I would use, but that''s okay.. lots of people have different styles and ways of doing things.

I do notice one thing that is probably making it fail, though. On your GetItemCount, if the script is attached to the NPC, GetItemCount will be looking in his inventory for the ingredient instead of the PCs inventory.

So, if you make those read:

  if ( Player->GetItemCount "ingred_stoneflower_petals_01" >=1 )        player->additem "aiy_paint_blue" 1	player->removeitem 


It'll probably work.

Making paint - script help

PostPosted: Sun Aug 09, 2009 6:18 am
by lauraa
Your count and method are a little different than what I would use, but that''s okay.. lots of people have different styles and ways of doing things.

I do notice one thing that is probably making it fail, though. On your GetItemCount, if the script is attached to the NPC, GetItemCount will be looking in his inventory for the ingredient instead of the PCs inventory.

So, if you make those read:

  if ( Player->GetItemCount "ingred_stoneflower_petals_01" >=1 )        player->additem "aiy_paint_blue" 1	player->removeitem 


It'll probably work.


Aahh, silly me :facepalm: Thanks, that worked :D

Also added the message boxes on creation of the paints. Now just to find out how to make an hour pass :dance:

Making paint - script help

PostPosted: Sun Aug 09, 2009 4:02 am
by Neliel Kudoh
At the point where your script has accepted the conditions as you want, you can use:

set GameHour to ( GameHour + 1 )

And an hour of gametime will pass,.. but I'm uncertain whether it will make it 25 o'clock if you happen to set that at midnight. If it does you will need to add if statement something like this:

If ( controlvar == whatever )       set GameHour to ( GameHour + 1 )    If ( GameHour > 24 )           set GameHour to ( GameHour - 24 )    endIfendIf


EDIT: to remove brain flatulence...

Making paint - script help

PostPosted: Sun Aug 09, 2009 11:53 am
by Rob
Ah yeh, I found the GameHour command in the Scripting For Dummies guide. I'll do some testing regarding the 24 hour + 1 thing.

As not to make a new thread.. can anyone point me towards a good tutorial for adding images to books/scrolls/paper? Only one I found so far seems to be a broken link. I don't know how to do it at all so a detailed one would be nice :D (Including things like image size etc.)
Also like to know how to make images appear on the object as it is placed in the game, i.e. if you lay a paper down on a table, you can see a little image on it, and not just the paper. I suppose this will be something to do with a retexture/repaint of the paper texture on the mesh?

Making paint - script help

PostPosted: Sun Aug 09, 2009 12:11 am
by Trey Johnson
I can't think of a tutorial on that just now, but there is a thread wandering around here with a lot of info on putting pics in books. One of the easiest ways to see how it's done is to just open a book that has images in the CS. Abot has some good images in his water life book, and while I haven't got nor can give any permission, he probably wouldn't mind if you looked at it to see the tags and image size.

As to images on paper that's laying around, you're right... that's just a matter of retexturing.

Here's a thread that gives some info on http://www.gamesas.com/index.php?/topic/1086735-how-to-display-an-image-on-a-scroll/.

Making paint - script help

PostPosted: Sat Aug 08, 2009 9:34 pm
by Adrian Powers
I can't think of a tutorial on that just now, but there is a thread wandering around here with a lot of info on putting pics in books. One of the easiest ways to see how it's done is to just open a book that has images in the CS. Abot has some good images in his water life book, and while I haven't got nor can give any permission, he probably wouldn't mind if you looked at it to see the tags and image size.

As to images on paper that's laying around, you're right... that's just a matter of retexturing.

Here's a thread that gives some info on http://www.gamesas.com/index.php?/topic/1086735-how-to-display-an-image-on-a-scroll/.


Right, thanks. I remembered one Morrowind book that has images in it too, so I'll check that out and see if I can figure it out.