In this topic I will display my method in making a new inventory and passing up the AM inventory though
I did not abandon it completely but I depended on it to make it easy to arrange and write an INI keeping the names of the items, and being the source of them always though I will hide the AM inventory
completely, and you must know that I am not good in explaining though I am not bad in scripting, and
there is another thing that this topic is extruding from my first test in making a game so any one can develop
the work and post his notes and even cancel the AM inventory as a source.
I started in the home this topic by writing the wanted scripts but I couldn't complete it because of the
computer layout so the numbers turned to Arabic numbers and the brackets inverted so I decided to
explain the steps theoretically, and to attach(or upload) a little size project so everyone can copy
and past the scripts wrote in it.
generally:
1- You can use this inventory in the panoramic and 2d frames (this is the most important feature)
2- You can mix items and arrange them as you want as long you are in the inventory frame but they will
be arranged automatically when you return to it.
3- You can use key guard blugin (great thanks to Shadow Hunter) to make the items glow when the
pointer pass over them.
4-You can make a slot containing an item anywhere in the game to use it privately like a frame with an admirer to examine a crime scene , or an adhesive tape to gather a torn paper and so on.
5-You don't need to drag the items because the cursor will change to the item icon.
6-You can make your items by any size you want.
7-You can use any inventory graphic easily (leather, wood or anything else by GIF format).
8-You can display an explain GIF to the items also by key guard.
9-You can use the inventory frame as a HQ to the player so he can go from it to a pause menu
or document or objectives frame.
right click work:
at first I bypassed displaying the original inventory from the project properties and made a start
menu, and wrote a script in the advanced tap to execute a VBScript instead, so the mouse right click
take the player to the inventory and make a non visible picture pox object in any frame in the game and take a snapshot to any frame by the code (Action.CaptureFrame) and load it into this picture pox then save the picture by the code (action.saveAPicture) of course to the external folder, anyone can open the attached or (uploaded)project properties and copy the code.
inventory frame:
I create the hotspot(1) in the inventory frame which its size is the same size of the frame .
my inventory frame is complicated, I made buttons to go from this basic frame to the pause menu and document frames and others.
and of course the player can return easily to the game by the same way he come or by a button.
I create a hotspot(2) to contain the inventory graphic (GIF file) and two other hotspots to contain
two separated slots the first contain the admirer which can discover the items and go to a special
frame to each item and I create in its main hotspot by 3ds MAX program a video display the item turning
so the player can examine it.
the second separate slot used to mix items by a special sub (mix sub) and by (action.RemoveItem) and
(Action.AddItem) I removed the two old items and added a new one.
and the most important thing in this frame that it will load the saved picture to the hotspot(1) every
time it appear from external folder (snap.BMP) by the code :
Hotspot(1).picture=LoadPicture(Action.GetPath+"snap.BMP")
NOTE: anyone interested can use this code for the save and load system as a snap to the saved or loaded
game
items preparation and writing to an INI file:
I made 7 files to each item in the game for example: (knife) and this is the files
1-knife.max (this file will be saved and edited any time).
2-knife.avi (this file will be a forever turning object to be examined).
3-knife.ico (this file will be the new pointer after clicking an item).
4-knifeover.ico (this file will be the glow of the pointer)
5-knife.gif (this file by any size will be displayed in the inventory slots).
6-knifeover.gif (this file will be the glow of the item)
7-knifeexplain.gif (this file will be a GIF coming from a text file which will appear fast with the movement
of the mouse pointer).
in this case it will be easy to use key guard so the script read the INI file which I write in it the names
of the items that exist in the original and hidden inventory(by the has item function : this function used to save the items so I used it to write the names of them to the INI I mentioned before which exist in the external folder), and the script will read the keys one by one :
9-knife
10-DVD
11-matches
12-lamp???..etc
note that I started from 9 because I used many hot spots to the inventory graphic and other things
and the first slot of the items come by this number ,so the script will read the key 9 in the INI
file (for example : the items names written in the section 4 , keys 9 to 35) , after this the script will
load what wrote in key 9 +".gif" ,of course everyone know the code(Action.ReadINI).
finally the key guard will load "key9"+"over"+".gif" and will load in a special hotspot "key9"+"explain"
+".gif" by the code (Action.LoadAPicture) from the area folder.
of course when the player click on an item in the inventory the cursor will change to the item icon
by the code(Acion.ChangeDefaultCursor).
and the script that I wrote in the frame property advanced tap (this frame contain the hotspotwork)
will load over the work hotspot "item icon"+"over"+".ico"
hiding the AM inventory and returning to the main pointer:
when the player click an item he can return to the game by right click or by clicking the button
of returning to the game or by pressing ESC key , so if the item doesn't fit he can do a right
click to return to the main pointer (this due to the variable value witch wrote in all the game
playing frames for example myvar=5 , beside the code(Action.ChangeDefaultCursor) note that in the
inventory frame advanced tap property myvar=9 (for example) so the right click doesn't remove the
item when the player is in this frame.
all this coming from the code I wrote in the project properties window (advanced tap):
if myvar =5 then Action.GoToFrame "inventory1"
if myvar=9 then Action.GoToFrame Action.readINI(snap.replaceme,1,1) and this mean to go to the frame
which the player come from.
because the mouse right click writes to the same INI the name of this frame (Action.WriteINI)
(Action.GetCurrentFrame) of course to a deferent section (1,1).
NOTE: in the 2d frames the player return to the default cursor by right click immediately without
any problem but in a panoramic frame he will need a click after this to activate the frame.
to hide the AM inventory when I take an item from the game (by (Action.AddItem )or (hotspot tap
properties)) I wrote in the advanced tap of the hot spot (that containing the item to take)
(Action.GoToFrame"the same frame which contain the item" ) and in the advanced tap of the
frame (Action.HideInventoryButton) so it's impossible that the AM inventory pop up , beside
this I made a transparent gif button graphic instead of the original.
differences between general items and special items and mixing :
the general items as I said before coming from reading INI which wrote by (has Item function)
so when some item is removed the items places or slots will change and become more close to
the first slot and this will not be good for the steady items like admirer so I wrote a script in the
inventory advanced tap property which write the word "admirer" to the same INI file but to
deferent section in the key 1, (so the appearance of the inventory frame will write and load
the admirer item though it is not exist in the AM inventory.) and the key 2 will receive the name
of the item which put in the mixing slot , but the same script in the advanced tap property will
erase this name so it will be temporary and could be erased by leaving and returning to the inventory
frame (this is unique to this item) and by taking it again from this slot (like any other item).
for this every time the player go to the inventory by mouse right click will see the admirer
but he will not see any item he put in the mixing slot (the item will return to its slot in order to its
number which come from the time of taking it in the game (if the player take the knife before
the DVD so the knife will stay closer to the first slot (Hotspot(9)) to the end of the game unless
they removed)).
NOTE: the slots of the admirer and mixed items come by numbers which doesn't account with
the general items (9-35 as I said in the example before).
the hotspot of items work know if you are carrying an item:
because I wrote in the advanced tap of every hotspot of items work a script tell the hotspot that
if catch1 (a variable turn from 0 to 1 in the advanced tap of every slot in the inventory when you
click on an item, note that when the player do a mouse right click to return from being carry an item
to the main or default cursor this variable will return to 0 ) then if regname (a variant variable coming
from writing to the mentioned INI in a deferent section the name of the item when you click on it of
course in the advanced tap of the slots of the inventory)which=ActionRedadINI (snap.replaceme,7,1) for example then .do something Else (Action.Message"no")
NOTE: you can write INI to one txt file (snap.replaceme) or to many files , for me I put the name of
the current frame in a separate file and all other information about the items in another one together
with information making the player able to start a new game (all the variables=0 and other information
about save and load).
NOTE: the ESC button do the same act of mouse right click
NOTE: I did not mention all the details of the scripts you can download the attached
or (uploaded)project.
suggestions:
1-I suggest any experienced and interested one to depend on an INI contain the names of the
the items he would use in the game and pass up the original inventory completely.
2-right click is removing the item and return to the panoramic frame so I suggest to make
the returning to the frame easier to the player.
3-checking the item must be in a hot spot that enable the player to turn the item up and down
and in all directions (like using a 3d object) with four arrows up, down ,left ,and right
NOTE: I don't know if we can use C++ in our projects.
4-playing when the player carry an item make the item (cursor) disappear on every hot spot has a
deferent cursor (like cursor of going to another frame) so it will be good to keep the carried item
and stop changing to deferent cursors and stop interacting with hot spots while this.
5-finally I used right click and ESC key to go to the inventory frame and then by a button the
player go to the pause menu, so I suggest to make a script take the player with a right click
to the inventory while the ESC key take the player to a pause menu.
NOTE: I didn't have the chance to make all this, may be in the future.
completion :
because I didn't put a work hot spot in the project so make a hot spot in any frame ,
if it was panoramic you must check the option (update 360 degree panorama to
reflect hot spot changes) , then in the advanced properties tap past this code
and you must change it as desired:
- Code: Select all
If catch1=0 Then
Action.message "the vise is ready.."
End If
regname = Action.ReadINI("startnewgame.domozo",109,1)
'-------------------------------------------------------------
'-------------------------------------------------------------
'-------------------------------------------------------------
If catch1=1 and ienteredsafeframe=1 Then
If regname = "sidebar broken" Then
PlaySound GetPath(4) + "box open1.wav",False
Action.ChangeDefaultCursor "main.ico"
Action.CreateTimedEvent 0.2 ,"x=5",False
Action.WriteINI "startnewgame.domozo",109,1,"main"
Action.WriteINI "startnewgame.domozo",110,1,"IhaveNoItemNow"
catch1=0
If sidebarpierced =0 then Action.CreateTimedEvent 0.5, "Action.GoToFrame ""rfrm5-7-1"""
If sidebarpierced =1 then Action.CreateTimedEvent 0.5, "Action.GoToFrame ""rfrm5-7-2"""
End If
If regname = "admirer" then Action.message "the vise is ready.."
If regname = "phone" then Action.message "no..impossible.."
If regname = "sidebar repared" then Action.message "it has been repaired.."
If regname <> "admirer" and regname<> "phone" and regname<> "sidebar repared"_
and regname<> "sidebar broken" then Action.message "no.."
End If
If catch1=1 and ienteredsafeframe=0 Then
If regname = "sidebar broken" Then
Action.message "I don't have a reason to do that..maybe I must call DR.Salem.."
phoneuse2 = 1
End If
If regname = "admirer" then Action.message "the vise is ready.. "
If regname = "phone" then Action.message "of course not.."
If regname = "sidebar repared" then Action.message "it has been repaired.."
If regname <> "admirer" and regname<> "phone" and regname<> "sidebar repared"_
and regname<> "sidebar broken" then Action.message "no.."
End If
of course you must create the wanted graphic to make changes.
then in the advanced tap of the frame witch containing this hot spot past this code:
- Code: Select all
regname = Action.ReadINI("startnewgame.domozo",109,1)
If catch1=0 then
Hotspot(1).MouseIcon = LoadGraphicFile("handtry48.ico")
End If
If catch1=1 then
Hotspot(1).MouseIcon = LoadGraphicFile(regname&"over.ico")
End If
supposing that hot spot(1) is the work hotspot
finally :
I succeed to upload the project and this is the URL
http://www.crocko.com/DB7043C1D73545DBBB22E06BBC031C73/unleashing_inventory.rar
and I hope if there is some question when I have no chance to enter the forums that the experienced
members answer it.
the project name is (unleashing inventory).
the project size is 38.9 M.B , it has no music, and the important thing that it use cylindrical panorama
blugin and key guard blugin so any one can download it from Shadow Hunter's web site.
the uploaded project was made by AM 4.5.2
and it is compatible with Windows XP
please scan it with some antivirus program .
have fun and good luck to everyone.
DOMOZO-SYRIA-LATAKIA.