NOTE: If you don't know how to create swf projects this isn't the guide for you.
IF functions help you trigger events(vars) at a certain time, when a goal is acheived.
e.g
If a quest is completed(goal) then the quest finish screen pops up(event).
So a typical conditional check will look like this:
- Code: Select all
if (objTarget.status == "SUCCESS")
{
_root.character.origStats.intStr = 0;
_root.character.origStats.intInt = 0;
_root.character.origStats.intDex = 0;
_root.character.origStats.intEnd = 0;
_root.character.origStats.intLuk = 0;
_root.character.origStats.intCha = 0;
_root.conn.subtractMoney(2, 1000);
_root.game.player.resetStats();
_root.game.player.refreshStatusBar();
} // end if
This script is saying if you reached the status object SUCCESS then the events below will be triggered.
- Code: Select all
reseting all your stats to 0
subtracts money from your gold amount
refresh your stats
refresh your status bar
as you can see this is the code for untrain all stats
So if you want to put this in a trainer then extract the useful vars:
- Code: Select all
_root.character.origStats.intStr = 0;
_root.character.origStats.intInt = 0;
_root.character.origStats.intDex = 0;
_root.character.origStats.intEnd = 0;
_root.character.origStats.intLuk = 0;
_root.character.origStats.intCha = 0;
remove the _root part and viola, you have just successfully extracted a variable.
But you still need to learn how to use conditional checks, here is the format:
- Code: Select all
if (condition here,trigger)
{
the event here
}// end if(commands end of conditional check)
I use a lot of conditional checks in both PKDF and PKMQ(e.g in the load shop buttons I need to use the conditional check on release) they can prove very useful and will get you VERY far in trainer making.






