- Joined
- Dec 29, 2009
- Messages
- 931
CREATING CUSTOM ERROR MESSAGES |
~Created by Archange1
|
REQUIREMENTS:
- A medium-level understanding of the World Editor
- Understanding variables and their use
- The ability to read and process information
CREDITS:
- Vexorian
- PurgeandFire111
METHOD ONE |
- Not recommended - use method two if possible
- Harder to use; more annoying than method two
To start off, you're going to want to make three variables.
These three variables will be used in method two as well, so you might as well make them now.
Name | Type | Array |
ErrorSound | Sound | No |
ErrorMessage | String | No |
ErrorPlayer | Player | No |
- The string variable is the message displayed when you tell it to appear.
- The player variable is the player that the message is shown to.
Step Two:
Next you're going to find where you want your custom error message - what trigger you're going to use it for.
Then copy this:
-
YourTrigger
- Events
- Conditions
-
Actions
- Custom script: if udg_ErrorSound == null then
- Custom script: set udg_ErrorSound = CreateSoundFromLabel( "InterfaceError",false,false,false,10,10)
- Custom script: endif
- Set ErrorMessage = YourMessage
- Set ErrorPlayer = YourPlayer
- Custom script: if GetLocalPlayer() == udg_ErrorPlayer then
- Custom script: call ClearTextMessages()
- Custom script: call DisplayTimedTextToPlayer( udg_ErrorPlayer, 0.52, 0.96, 2.00, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+udg_ErrorMessage+"|r" )
- Custom script: call StartSound(udg_ErrorSound)
- Custom script: endif
Now you're going to fill in those variables if you haven't already.
Once again;
- ErrorMessage is the message displayed when you tell it to appear.
- ErrorPlayer is the player that the message is shown to.
Once you have all that completed, you're done!
METHOD TWO |
- Recommended method
- Quick and simple to do
- Doesn't tie up a lot of space in the trigger's actions
If you haven't already, make the variables listed in method one.
Step Two:
In the trigger editor, go to your map header and enter the following code:
JASS:
function ErrorMessage takes string error, player whichPlayer returns nothing
if udg_ErrorSound == null then
set udg_ErrorSound = CreateSoundFromLabel("InterfaceError",false,false,false,10,10)
endif
set error = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00"+error+"|r"
if GetLocalPlayer()==whichPlayer then
call ClearTextMessages()
call DisplayTimedTextToPlayer(whichPlayer,0.52,0.96,2,error)
call StartSound(udg_ErrorSound)
endif
endfunction
Step Three:
Next you're going to find where you want your custom error message - what trigger you're going to use it for.
Then copy this:
-
YourTrigger
- Events
- Conditions
-
Actions
- Set ErrorMessage = YourMessage
- Set ErrorPlayer = YourPlayer
- Custom script: call ErrorMessage(udg_ErrorMessage,udg_ErrorPlayer)
Now you're going to fill in those variables if you haven't already.
Once again;
- ErrorMessage is the message displayed when you tell it to appear.
- ErrorPlayer is the player that the message is shown to.
Once you have all that completed, you're done!
ADDITIONALLY |
- You can find the full version of Vexorian's SimError here : Vexorian's SimError
- If you need to keep track of any messages for debugging try Almia's DebugLog here : http://www.hiveworkshop.com/forums/...-2-a-228919/?prev=search=debuglog&d=list&r=20
Last edited: