Scripting, Code & Interaction: Difference between revisions
→Changing the names of characters, hotspots, objects, and inventory items in the middle of gameplay
Line 245: | Line 245: | ||
==Changing the names of characters, hotspots, objects, and inventory items in the middle of gameplay== | ==Changing the names of characters, hotspots, objects, and inventory items in the middle of gameplay== | ||
''How would I go about changing the names of characters, hotspots, objects, and inventory items in the middle of gameplay?'' | |||
For those who don't know, this is a very useful way of altering what the player character "knows". For example, if you meet a character for the first time, in your status bar it might just say "maintenance worker". Then, once you talk to him and find out his name, you may want the status text to say "Crewman Johnson". | |||
To change the character's name, you will have to alter the global '''character[CHARNAME].name''' variable. Since this is a string, you cannot simply set its value using the equals ("'''='''") sign. You will have to use the '''StrCopy()''' function like so: | |||
StrCopy(character[WORKER].name, "Crewman Johnson"); | |||
For inventory names, just use the '''SetInvItemName()''' (or '''iCup.SetName()''' for AGS V2.7 and above) function like so: | |||
SetInvItemName(4, "cup of tea"); | |||
OR, if you're using V2.7+: | |||
iCup.SetName("cup of tea"); | |||
As for hotspots and objects, it isn't currently possible to change their names during gameplay. That may change in future versions, however. | |||
==How to play movies and video files (AVI, MPG, WMV, etc.)== | ==How to play movies and video files (AVI, MPG, WMV, etc.)== | ||
[[Category:The AGS Beginners' FAQ]] | [[Category:The AGS Beginners' FAQ]] |