Difference between revisions of "ChangeOutfit (CMS)"

From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 10: Line 10:
 
== Instructions ==
 
== Instructions ==
 
1. Add the [[#Main_Script|main script]] to the Visionaire Studio Script Editor & set the script as a definition script.<br/>
 
1. Add the [[#Main_Script|main script]] to the Visionaire Studio Script Editor & set the script as a definition script.<br/>
2a. To change outfit of current character...
+
2a. To change the outfit of the current character...
 
<syntaxhighlight>
 
<syntaxhighlight>
 
changeOutfit("", "outfit_name")
 
changeOutfit("", "outfit_name")
 
</syntaxhighlight>
 
</syntaxhighlight>
2b. To change outfit of a specific character...
+
2b. To change the outfit of a specific character...
 
<syntaxhighlight>
 
<syntaxhighlight>
 
changeOutfit("character_name", "outfit_name")
 
changeOutfit("character_name", "outfit_name")

Revision as of 13:06, 16 August 2014

Name Type By
changeOutfit("c", "o") Definition AFRLme

This small function allows you to quickly change the outfit of a character.

Instructions

1. Add the main script to the Visionaire Studio Script Editor & set the script as a definition script.
2a. To change the outfit of the current character...

changeOutfit("", "outfit_name")

2b. To change the outfit of a specific character...

changeOutfit("character_name", "outfit_name")


Main Script

function changeOutfit(c, o)
 if c = "" then c = game:getLink(VGameCurrentCharacter) else c = getObject("Characters[" .. c .. "]") end
 o = c:getObject(".CharacterOutfits[" .. o .. "]")
 c:setValue(VCharacterCurrentOutfit, o)
end

Syntax Breakdown

Name Type Description
c "string" This should be a "string" value containing the name of the character you want to affect; if string is empty it will default to current character.
t "string" This should be a "string" value containing the name of the outfit you want to change to.