Difference between revisions of "ChangeOutfit (CMS)"
From The Official Visionaire Studio: Adventure Game Engine Wiki
(Created page with "{| class="wikitable" style="width:100%" |- ! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left" | By |- | changeOutfit("c", "o") || De...") |
m |
||
(7 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | {| class=" | + | {| class="ts" style="width:100%" |
|- | |- | ||
! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left" | By | ! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left" | By | ||
Line 6: | Line 6: | ||
|} | |} | ||
− | This small function allows you to quickly | + | This small function allows you to quickly change the outfit of a character. |
+ | |||
== 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 lang="lua"> |
− | changeOutfit( | + | changeOutfit(nil, "outfit_name") |
</syntaxhighlight> | </syntaxhighlight> | ||
− | 2b. To change outfit of a specific character... | + | 2b. To change the outfit of a specific character... |
− | <syntaxhighlight> | + | <syntaxhighlight lang="lua"> |
changeOutfit("character_name", "outfit_name") | changeOutfit("character_name", "outfit_name") | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 21: | Line 22: | ||
== Main Script == | == Main Script == | ||
− | <syntaxhighlight> | + | <syntaxhighlight lang="lua"> |
function changeOutfit(c, o) | function changeOutfit(c, o) | ||
− | if c = | + | if c == nil then c = game.CurrentCharacter else c = Characters[c] end -- store character |
− | + | c.CurrentOutfit = c.Outfits[o] -- update outfit | |
− | |||
end | end | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
== Syntax Breakdown == | == Syntax Breakdown == | ||
− | {| class=" | + | {| class="ts" style="width:100%" |
|- | |- | ||
! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left;width:80%" | Description | ! style="text-align:left" | Name !! style="text-align:left" | Type !! style="text-align:left;width:80%" | Description | ||
|- | |- | ||
− | | c || "string" || This should be a "string" value containing the name of the character you want to affect; if | + | | c || "string" or nil || This should be a "string" value containing the name of the character you want to affect; if c equals nil then it will default to current character. |
|- | |- | ||
− | | | + | | o || "string" || This should be a "string" value containing the name of the outfit you want to change to. |
− | |} | + | |}{{toc}} |
Latest revision as of 13:53, 23 August 2022
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(nil, "outfit_name")
2b. To change the outfit of a specific character...
changeOutfit("character_name", "outfit_name")
Main Script
function changeOutfit(c, o)
if c == nil then c = game.CurrentCharacter else c = Characters[c] end -- store character
c.CurrentOutfit = c.Outfits[o] -- update outfit
end
Syntax Breakdown
Name | Type | Description |
---|---|---|
c | "string" or nil | This should be a "string" value containing the name of the character you want to affect; if c equals nil then it will default to current character. |
o | "string" | This should be a "string" value containing the name of the outfit you want to change to. |