there are 2 ways to do this.
1. you can make your own code-system that generates a code but this is hard because you must encode it yourself and then decode it with another trigger... very complex.
2. You can use Gamecache for saving your Hero. Its saver and easier to do i think.
Here is an example for such a Save-System:
First you must copy this function in the Header of the Map:
Quote:
//Get Generated Code
function GetGeneratedCode takes integer Length returns string
local integer I0
local integer RandomNumber
local string CodeWords
local string EndCode
set CodeWords = "0123456789abcdefghijklmnopqrstuvwxyzßABCDEFGHIJKLMNOPQRSTUVWXYZ"
set I0 = 0
loop
exitwhen(I0 > Length)
set RandomNumber = GetRandomInt(0, StringLength(CodeWords))
set EndCode = (EndCode + SubString(CodeWords, RandomNumber, (RandomNumber + 1)))
set I0 = (I0 + 1)
endloop
return EndCode
endfunction
Then you create a Trigger called "Save":
Quote:
Save
Events
Player - Player 1 (Red) types a chat message containing -save as An exact match
Player - Player 2 (Blue) types a chat message containing -save as An exact match
Player - Player 3 (Teal) types a chat message containing -save as An exact match
Player - Player 4 (Purple) types a chat message containing -save as An exact match
Player - Player 5 (Yellow) types a chat message containing -save as An exact match
Player - Player 6 (Orange) types a chat message containing -save as An exact match
Player - Player 7 (Green) types a chat message containing -save as An exact match
Player - Player 8 (Pink) types a chat message containing -save as An exact match
Player - Player 9 (Gray) types a chat message containing -save as An exact match
Player - Player 10 (Light Blue) types a chat message containing -save as An exact match
Conditions
Actions
Custom script: local string GameCacheName = GetGeneratedCode( 5 )
Custom script: call InitGameCache( GameCacheName + GetPlayerName( GetTriggerPlayer() ) + "2-3 Letters you've choosen. Example: xyz" + ".w3v" )
Custom script: call DisplayTimedTextToPlayer(GetTriggerPlayer(), 0.00, 0.00, 30.00, GameCacheName)
Game Cache - Store your Hero as Hero of Heros in (Last created game cache)
Game Cache - Save (Last created game cache)
Then you need a Load-Trigger:
Quote:
Load
Events
Player - Player 1 (Red) types a chat message containing -load as A substring
Player - Player 2 (Blue) types a chat message containing -load as A substring
Player - Player 3 (Teal) types a chat message containing -load as A substring
Player - Player 4 (Purple) types a chat message containing -load as A substring
Player - Player 5 (Yellow) types a chat message containing -load as A substring
Player - Player 6 (Orange) types a chat message containing -load as A substring
Player - Player 7 (Green) types a chat message containing -load as A substring
Player - Player 8 (Pink) types a chat message containing -load as A substring
Player - Player 9 (Gray) types a chat message containing -load as A substring
Player - Player 10 (Light Blue) types a chat message containing -load as A substring
Conditions
Actions
Game Cache - Create a game cache from ((Substring((Entered chat string), 7, 11)) + ((Name of (Triggering player)) + your 3 Letters! + .w3v))
Game Cache - Restore Hero of Heros from (Last created game cache) for (Triggering player) at your Area facing (Random angle)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Last restored unit) Not equal to No unit
Then - Actions
Want do you want to do with the Hero. Perhaps you want to display that its the Right Code or something like that...
Else - Actions
Game - Display to (Player group((Triggering player))) for 10.00 seconds the text: |c00FF0000Invalid Code!
I hope you understand this