wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Tutorials > Trigger (GUI)/ AI editor Tutorials
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 01-07-2006, 08:17 PM   #1
johnfn
Taur is... MY SISTER!!!


Respected User
 
Join Date: Jan 2004
Posts: 1,633

Submissions (3)

johnfn has a spectacular aura about (129)

Send a message via AIM to johnfn
Default Save and Load Code Tutorial

Man, I wrote this thing so long ago, I can hardly believe it exists. Anyways, I dug it up from the ashes, gave it a quick grammar and understandability (is that a word?) edit, and put it up here.


I attached a map, it's a little different then the code I put here (think of this code as concept, the map actually gets the job done - rather sloppily I might add). I explained why it was different on a post on the second page.




(What is it? A save and load code tutorial, you know, the things that you can save heroes across games with)






The actual tutorial:




Most things from the tutorial were lost because of a terrible forum disaster :P This is all that I could recover, because I had to format my computer a while ago.


Please post feedback (on the thread)! It takes time to write this! Lots of time!

What is a save/load password system, anyway? If you haven’t played an RPG where they have one, then you probably don’t know, but then again, why are you here? It’s a complex series of numbers and letters that you can save a hero from an RPG with. Most codes save the level of the hero, some items, and maybe some gold.


Part 1: Setting up the trigger.

Most games will have you type in a command like "-save" or something similar to save your hero, so we need to have an event reading in the command:

Trigger:
Player - Player 1 (Red) types a chat message containing -save as An exact match

And that’s all you need for the event part of the password system. Not hard? Good.

Part 2: Setting up the variables.

Oh no!! Variables! Actually, I don’t understand why everyone thinks variables are so confusing. It’s just a way of holding some data. I could write a tutorial about variables... except I'm already writing this tutorial...

Anyway what we need is different strings to hold different parts of the password. So lets make a array variable called PasswordParts. I'm gonna make this variable because I want to store separate parts of the password. For example, I'll store gold in one part, wood in another, experience in a third, and so on. (An array, very simply put, is like many variables combined together, all that can be accessed by a number – you might wanna read about it somewhere else though) So, assuming your still in the trigger window, do the following:
  1. Hit ctrl+B
  2. Press the green X on the toolbar
  3. For variable name, type in PasswordParts
  4. For variable type, select string.
  5. Click on the array checkbox.
  6. Type in 6 for array elements.
  7. Press OK.

I am going to list all the variables you need now, as another suggestion from linkmaster23: (this also includes load code variables)

Variable Type : Variable Name


current_pswd_part : Integer
final_password : String
hero_of_player_1 : Unit
loadstring : String
oldstop : Integer
Password_before_encrypt_1 : String
Password_before_encrypt_2 : String
Passwordparts : String Array (6)
temporary_password_string : String
Unencrypt1 : String
Unencrypt2 : String



Done? Yes its a lot of work, but its easier then doing it as you go.


Anyway... Now you need to find your trigger where you create a hero for the player and have the game recognize him as the right hero. If you just created a hero for player 1 in your trigger, then do something like this

Trigger:
Set Hero_of_player_1 to (Last Created Unit)

So now you have a variable containing the hero of player 1. If he already exists, it might looks something like this:


Trigger:
Set Hero_of_player_1 to Paladin 0000 <gen>


Part 3: Getting the stats of the hero and entering them in.

Now that we have the hero in a variable, we can fill up that variable we made earlier, PasswordParts, with things related to the hero or player that we want to save till the next game. Here is how we get the experience of the hero:



Trigger:
---------P.S. These are all conversions from integer to string.---------
Set PasswordParts[1] = (String((Hero experience of Hero_of_player_1)))
---------And here is how we get the gold of that player and store it:--------
Set PasswordParts[2] = (String((Player 1 (Red) Current gold)))
---------And wood:---------
Set PasswordParts[3] = (String((Player 1 (Red) Current wood)))
---------And where he is (In X and Y):---------
---------(These are conversions from real to integer to string)---------
Set PasswordParts[4] = (String((Integer(X of (Position of Hero_of_player_1 )))))
Set PasswordParts[5] = (String((Integer(Y of (Position of Hero_of_player_1 )))))

P.S.S.S. If you have an RPG where you buy tomes, you will need three more spots in your passwordparts array to hold the unit's stats.

Part 4: Getting the Hero and entering him in.

You will need a different number for each hero you have. If you have only 10 (or less) heroes, your in luck, and only need 1 number. However, if you have at least 11 or more, you will need 2 numbers to represent them. This is because you can use numbers to represent heroes. For example, the numbers 0123456789 could all represent a separate hero. But once you get past 9 you need two digits to store the hero: 10,11,12 and so on.

We already have a variable for the hero of player 1, so we can use it to get the hero's information.

So anyway, let me show you some of the trigger. You'll have to write the whole thing out; I'll just demonstrate a part of it.

Trigger:
If (Unit Type of(Hero_of_player_1)) equal to Blood Mage then PasswordParts(6) = 1 Else Do Nothing
If (Unit Type of(Hero_of_player_1)) equal to Paladin then PasswordParts(6) = 2 Else Do Nothing
If (Unit Type of(Hero_of_player_1)) equal to Blademaster then PasswordParts(6) = 3 Else Do Nothing
If (Unit Type of(Hero_of_player_1)) equal to Mass Devastator then PasswordParts(6) = 4 Else Do Nothing
--------and continue on like this.--------

Part 5: Combining the parts into a password.
Now we need to combine these array elements into a password. You might be thinking i am just going to concatenate these strings into a password. This would be a terrible idea, because it would be incredibly easy to crack.

My idea, be it not too complex, is to first reverse the entire string, then use a rather simple encryption to encode it (in fact, extremely simple). Here is how I will do it:



Trigger:
For each (Integer A) from 1 to 6, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Integer A) Equal to 6
Collapse Then - Actions
Set Password_before_encrypt_1 = (Password_before_encrypt_1 + (PasswordParts[(Integer A)] + <Empty String>))
Collapse Else - Actions
Set Password_before_encrypt_1 = (Password_before_encrypt_1 + (PasswordParts[(Integer A)] + -))

What does this do?

We take our variable, Password_before_encrypt_1, and then we go through each array element of passwordparts[] and we add it on to the variable Password_before_encrypt_1, with a dash to separate them, except the last one (#6), which doesn't need to be seperated. So if we have 66 for one and 33 for another, we get 66-33. The dash will be more important later.


Trigger:
For each (Integer A) from 0 to ((Length of Password_before_encrypt_1) - 1), do (Actions)
Collapse Loop - Actions
Set Password_before_encrypt_2 = (Password_before_encrypt_2 + (Substring(Password_before_encrypt_1, ((Length of Password_before_encrypt_1) - (Integer A)), (((Length of Password_before_encrypt_1) - (Integer A))))))

What does that do?

It reverses the string.


HOW?!? HOW DOES THAT WORK??
Guess I better explain it.

The meat of the code is at
(Substring(Password_before_encrypt_1, ((Length of Password_before_encrypt_1) - (Integer A)), (((Length of Password_before_encrypt_1) - (Integer A))))))

If your anything like me you get freaked out by long pieces of confusing code, but this is pretty simple. This means to use Password_before_encrypt_1 as the substring string. That parts easy enough. But what is ((Length of Password_before_encrypt_1) - (Integer A))? I could say its a tried and true reverse algorithm. In fact, I could say this whole thing is. But, what that does is it takes the length of the string, and subtracts it from the Integer A. This basically reverses the value of integer A with respect to the length of the string. I'm sure that made no sense, consider this. If you reverse Int. A with a str. length of 8, and Int. A is 0, it will come out as 8.

So for instance say you have a 3 letter string "cat". The value of Integer A would be 0. Three (length of "cat") minus Zero gives... 3, meaning to use the third character. That just happens to be the last character. So good so far. Then it goes on. 3 - 1 gives two, the second to last character. And 3-2 gives 1, the location of the first character. Notice that I say
For each (Integer A) from 0 to ((Length of Password_before_encrypt_1) - 1),...

It needs to start at zero to get the character right. Now you know why.


Writing the code backwards is practically the easiest to break encryption. Remember that I wrote this save/load for the concepts, not the incredibly hard to crack encryption.


And then to the actual encryption:

Trigger:
For each (Integer A) from 1 to (Length of Password_before_encrypt_2), do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Substring(Password_before_encrypt_2, (Integer A), (Integer A))) Not equal to -
Collapse Then - Actions
Set final_password = (final_password + (String((9 - (Integer((Substring(Password_before_encrypt_2, (Integer A), (Integer A)))))))))
Collapse Else - Actions
Set final_password = (final_password + -)
What does that do? Here goes: Say you take a number, like 7. subtract that number from 9. you get 2 (9-7). Just like if you take 4, 9-4 gives 5. Thats what I do to each number in the password. Easy to break, yes. Easy to guess, yes. Teach you what to do, yes. (That last one is the only important one)


Now how does that WORK?
Whatever that is, it needs to stop, it's annoying. Anyway, on to code dissecting.

Set final_password = (final_password + (String((9 - (Integer((Substring(Password_before_encrypt_2, (Integer A), (Integer A)))))))))

Seems to be the most confusing part. What this does , in reality, is simple. Take the character. (we already made sure it wasn't a dash in the if/then/else) take 9 minus that character (the character is turned into an integer to make that possible). Then we turn that back into a string, and add it on to the final password. It inst really that confusing, it's just long. Just subtract nine, and done.


And don't forget the best part!

Trigger:
Game - Display to (All players) for 30.00 seconds the text: (final_password + Is your password.)

I hope you knew that that displays the text to the player.


I know that that is an INCREDIBLY easy code, and also pretty easy to hack. This tutorial is just for showing people how to do it. It is not for the big, impossible to hack code.

Part 6: The end of the Save Code…

I only left out one thing. Its pretty advanced, and the other reason I left it out is it pertains to your rpg more then just some generic one.

That would be the items. My idea is that you give each item it's own letter/number/symbol. So perhaps a potion of healing would get an H, where a mask of death a %. Then you could just put these symbols in the code, somewhere. Since there are (I think) 95 keys on the keyboard, you shouldn’t run out unless you have a HUGE rpg. (Then just use two keys!!)


Part 8: Load code
Ok, this isn’t that hard. What we have to do is basically reverse everything we did to encrypt and concatenate it.

Well, here goes.



Trigger:
Load
Collapse Events
Player - Player 1 (Red) types a chat message containing -load as A substring
Conditions
Collapse Actions
Set final_password = <Empty String>
-------- So that if we load twice, we don't overwrite the old string --------
Set loadstring = (Substring((Entered chat string), 6, (Length of (Entered chat string))))
-------- 6 characters in would be -load and a space --------
Collapse For each (Integer A) from 0 to ((Length of loadstring) - 1), do (Actions)
Collapse Loop - Actions
-------- I'll just reverse everything right here. --------
Set unencrypt2 = (unencrypt2 + (Substring(loadstring, ((Length of loadstring) - (Integer A)), (((Length of loadstring) - (Integer A)) + 0))))
Collapse For each (Integer A) from 1 to ((Length of unencrypt2) - 1), do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Substring(unencrypt2, (Integer A), (Integer A))) Not equal to -
Collapse Then - Actions
-------- This decodes the whole code by subtracting 9 from each digit. --------
-------- The dash means that we've found a seperator, so we don't need to decode it. --------
Set final_password = (final_password + (String((9 - (Integer((Substring(unencrypt2, (Integer A), (Integer A)))))))))
Collapse Else - Actions
Set final_password = (final_password + -)
Collapse For each (Integer A) from 1 to (Length of unencrypt2), do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
Collapse And - All (Conditions) are true
Collapse Conditions
(Substring(final_password, (Integer A), (Integer A))) Equal to -
(Substring(final_password, ((Integer A) + 1), ((Integer A) + 1))) Not equal to -
(Integer A) Equal to (Length of unencrypt2)
Collapse Then - Actions
-------- The conditions mean this: either A) we've found a dash, and there isn't another dash in front of it (a double dash) --------
-------- or B) we've reached the end of the string --------
Set current_pswd_part = (current_pswd_part + 1)
Set PasswordParts[current_pswd_part] = (Substring(final_password, oldstop, (Integer A)))
-------- okay; we've found out the exact value of the password part now that we've decoded it and seperated it. Now lets put it in the corresponding variable. --------
Set oldstop = (Integer A)
-------- we will start where the old password part ended --------
Else - Actions
Collapse For each (Integer A) from 1 to 6, do (Actions)
Collapse Loop - Actions
Collapse For each (Integer B) from 1 to (Length of PasswordParts[(Integer A)]), do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Substring(PasswordParts[(Integer B)], (Integer B), (Integer B))) Equal to -
Then - Actions
Collapse Else - Actions
-------- Gets rid of a dash in the string --------
Set temporary_password_string = (temporary_password_string + (Substring(PasswordParts[(Integer A)], (Integer B), (Integer B))))
Set PasswordParts[(Integer B)] = temporary_password_string
Set temporary_password_string = <Empty String>
-------- I have to admit looking over this, it looks a little convoluted although it's barely understandable. I'm sure there's a better way, however. --------
-------- You would interpret that section of password parts to be whichever hero it was here --------
Unit - Create 1 Blood Mage for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
-------- This all, however, stays the same --------
Unit - Move (Last created unit) instantly to (Point(((Real(PasswordParts[4])) + 0.00), (Real(PasswordParts[5]))))
Hero - Set (Last created unit) experience to (Integer(PasswordParts[1])), Hide level-up graphics
Player - Set Player 1 (Red) Current gold to (Integer(PasswordParts[2]))
Player - Set Player 1 (Red) Current lumber to (Integer(PasswordParts[3]))



Optional Part 9: It’s not over yet!

Now that you have your password system up + running, let’s make it a bit tougher to break. (Also, let’s see if I really do know what I'm talking about)

It’s called an optional section because you can opt not to do it, but I recommend you do for difficulty of cracking the code.
Part 9, subsection 1: Checksums
Eh? What’s a checksum?
Part 9, subsection 1, subsubsection 1: What is a checksum?
A checksum is a type of number that you can use to check to see if the whole thing’s in order. It’s not only used for password systems, people also use it for things like downloaded applications to check if the app downloaded right.

Part 9, subsection 2: My Idea

After thinking this through, I think a good way to do it would be to add the first + second digits, then subtract the third. Add that to the fourth, and then subtract that from the fifth… and so on (it’s not advanced or anything, but I believe that even in its simplicity it will delay the average cracker). If you end up with a negative number, make it positive. If you get a number that has more then one digit, then add the digits together. Then put all these numbers together and put them into the 7th (is it actually the 7th?) passwordpart. (for the paranoid, you could do the same thing for the checksum passwordpart and add that on as the last digit :p)

Part 9, subsection 3: Implementation

(Implementation means the code)

Part 9, subsection 3, subsubsection 1: Variables

New variables because this is an optional section. (Yup, that’s my excuse)
Here we go again…
Variable name
Variable Type
Add : Boolean
CurrentChecksumValue : Integer

Part 9, subsection 3, subsubsection 1, subsubsubsection 1: What is a Boolean?

If you don’t know what a Boolean is, don’t panic. Actually do panic. But it wont help you. A Boolean is a variable that can either store true or false. In this case I will set it to true if you are adding numbers and false if you are subtracting.
Part 9, subsection 3, subsubsection 2: The code

I’m using the same method of writing code as previously. Where you want to put this function is after storing all the password parts, but before encrypting them.


(I've lost the actual code for this, so you'll have to deal with poor formatting. :p)
Code:
For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions For each passwordpart. 
For each (Integer B) from 1 to (Length of PasswordParts[(Integer A)]), do (Actions) For each letter in the passwordparts(for loop integer A) value 
If (Add Equal to True) then do (Set Add = False) else do (Set Add = True) Toggle the value of Add 
If (Add Equal to True) then do CurrentChecksumValue = CurrentChecksumValue + substring(PasswordParts[(Integer A)], Integer B, 1) else do CurrentChecksumValue = CurrentChecksumValue - substring(PasswordParts[(Integer A)], Integer B, 1) If add is true, then add. Otherwise, subtract.
If CurrentChecksumValue Less Than or Equal To 0 Then do CurrentChecksumValue = Abs(CurrentChecksumValue) Make the value positive if it’s negative.
If (CurrentChecksumValue Greater than or equal to 10) then do (Set CurrentChecksumValue = (Integer((Substring((String(CurrentChecksumValue)), 1, 1))))) else do (Do nothing) Take only the first number if its more then one digit.


What you need to do to check the checksum is do the exact same thing you did here (except you don’t store the number in passwordparts.) Then check each number individually to see if it matches up with the typed in code. If it doesn’t, no hero! What this does is make experimentation with the code difficult (because you cant change one number because then the ultimate checksum isn’t changed, so you will need to change the checksum as well, and then if you followed my paranoid advice you would have to change the third digit as well.










Last update 01/15/06

-johnfn
Attached Files
File Type: zip Save+Load.zip (15.0 KB, 261 views)
File Type: w3x thisSaveCodeWorks.w3x (16.8 KB, 405 views)
__________________
Zone Control. Give it a try!

Taur: btw dun tell anyone but I bribed the wc3c admins with a life supply of packaged peanuts to host UL ^^

Taur | Unsung Legends says:
guess what blade?
Blade.dk says:
JOHN IS YO BRO!


johnfn is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 01-07-2006, 08:30 PM   #2
Zoxc
( ~)>
 
Zoxc's Avatar


Respected User
 
Join Date: Feb 2005
Posts: 959

Submissions (9)

Zoxc is just really nice (312)Zoxc is just really nice (312)Zoxc is just really nice (312)

Default

Ah great ^^ the big tutorial I downloaded, but didn't read is back online :)
__________________
Zoxc is offline   Reply With Quote
Old 01-08-2006, 01:35 AM   #3
johnfn
Taur is... MY SISTER!!!


Respected User
 
Join Date: Jan 2004
Posts: 1,633

Submissions (3)

johnfn has a spectacular aura about (129)

Send a message via AIM to johnfn
Default

Quote:
Originally Posted by Zoxc
Ah great ^^ the big tutorial I downloaded, but didn't read is back online :)

Haha. Why so it is :P
__________________
Zone Control. Give it a try!

Taur: btw dun tell anyone but I bribed the wc3c admins with a life supply of packaged peanuts to host UL ^^

Taur | Unsung Legends says:
guess what blade?
Blade.dk says:
JOHN IS YO BRO!


johnfn is offline   Reply With Quote
Old 01-08-2006, 01:51 AM   #4
Deitri
User
 
Join Date: Jan 2006
Posts: 136

Submissions (4)

Deitri is on a distinguished road (14)

Send a message via MSN to Deitri
Default

Woa!
Thanks!
I was searching for an Good Save/Load system!
Reputation for you! ;)
Deitri is offline   Reply With Quote
Old 01-13-2006, 01:56 AM   #5
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

could you try make it bbcode based or would you let me to do the conversion? I don't want the tutorial to be downloadable but just readable that's it. mostly cause it is too much of a problem and the contents of the tutorial don't get indexed in the search engine
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 01-15-2006, 09:20 PM   #6
johnfn
Taur is... MY SISTER!!!


Respected User
 
Join Date: Jan 2004
Posts: 1,633

Submissions (3)

johnfn has a spectacular aura about (129)

Send a message via AIM to johnfn
Default

I can do that. I was getting to work on it before and I was trying to make the trigger tags work and it was too much trouble and then turned my computer off forgetting about it.
__________________
Zone Control. Give it a try!

Taur: btw dun tell anyone but I bribed the wc3c admins with a life supply of packaged peanuts to host UL ^^

Taur | Unsung Legends says:
guess what blade?
Blade.dk says:
JOHN IS YO BRO!


johnfn is offline   Reply With Quote
Old 01-15-2006, 09:21 PM   #7
Vexorian
Free Software Terrorist
 
Vexorian's Avatar


Technical Director
 
Join Date: Apr 2003
Posts: 14,898

Submissions (37)

Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)Vexorian has a reputation beyond repute (1062)

Hero Contest #3 - 2nd Place

Default

trigger tags just require to use Copy As text in the editor nothing more
__________________
Zoom (requires log in)Wc3 map optimizer 5.0
Someone should fix .wav sound in this thing.
Zoom (requires log in)JassHelper 0.A.2.A
Turns your simple code into something that is complicated enough to work.
Faster != more useful
Vexorian is offline   Reply With Quote
Old 01-15-2006, 09:54 PM   #8
johnfn
Taur is... MY SISTER!!!


Respected User
 
Join Date: Jan 2004
Posts: 1,633

Submissions (3)

johnfn has a spectacular aura about (129)

Send a message via AIM to johnfn
Default

Yeah but I thought I had lost the triggers until just now when miraculously I found them. Everything seems to be in working order now.
__________________
Zone Control. Give it a try!

Taur: btw dun tell anyone but I bribed the wc3c admins with a life supply of packaged peanuts to host UL ^^

Taur | Unsung Legends says:
guess what blade?
Blade.dk says:
JOHN IS YO BRO!


johnfn is offline   Reply With Quote
Old 01-16-2006, 03:44 PM   #9
Thunder_Eye
Lol I got a custom title!
 
Thunder_Eye's Avatar
 
Join Date: Aug 2004
Posts: 1,236

Thunder_Eye has a spectacular aura about (92)Thunder_Eye has a spectacular aura about (92)Thunder_Eye has a spectacular aura about (92)Thunder_Eye has a spectacular aura about (92)

Default

Ok I got the code to work, though the hero spawns in the middle and also the code mostly looks like:

990--9-9-9--82--9-9Is

Very much - in it. Is it supposed to be like that or did I do something wrong?
Can post the trigger if you want to take a look at it

BTW. really nice tutorial, tried to get it after the site moved though the link was gone then, really needed this tutorial!
rep.
__________________
Thunder_Eye is offline   Reply With Quote
Old 01-16-2006, 04:02 PM   #10
johnfn
Taur is... MY SISTER!!!


Respected User
 
Join Date: Jan 2004
Posts: 1,633

Submissions (3)

johnfn has a spectacular aura about (129)

Send a message via AIM to johnfn
Default

Post the trigger. A lot of people had problems with 9s last time but I was too lazy to check it out, lets see if I can't figure out what happened here. It sounds to me like somehow none of the indicies of the PasswordParts variable were filled to me.
__________________
Zone Control. Give it a try!

Taur: btw dun tell anyone but I bribed the wc3c admins with a life supply of packaged peanuts to host UL ^^

Taur | Unsung Legends says:
guess what blade?
Blade.dk says:
JOHN IS YO BRO!


johnfn is offline   Reply With Quote
Old 01-16-2006, 04:23 PM   #11
Thunder_Eye
Lol I got a custom title!
 
Thunder_Eye's Avatar
 
Join Date: Aug 2004
Posts: 1,236

Thunder_Eye has a spectacular aura about (92)Thunder_Eye has a spectacular aura about (92)Thunder_Eye has a spectacular aura about (92)Thunder_Eye has a spectacular aura about (92)

Default

Trigger:
save
Collapse Events
Player - Player 1 (Red) types a chat message containing -save as An exact match
Conditions
Collapse Actions
Set Passwordparts[1] = (String((Hero experience of hero_of_player_1)))
Set Passwordparts[2] = (String((Player 1 (Red) Current gold)))
Set Passwordparts[3] = (String((Player 1 (Red) Current lumber)))
Set Passwordparts[4] = (String((Integer((X of (Position of hero_of_player_1))))))
Set Passwordparts[5] = (String((Integer((Y of (Position of hero_of_player_1))))))
If ((Unit-type of hero_of_player_1) Equal to Paladin) then do (Set Passwordparts[6] = 1) else do (Do nothing)
If ((Unit-type of hero_of_player_1) Equal to Archmage) then do (Set Passwordparts[6] = 2) else do (Do nothing)
If ((Unit-type of hero_of_player_1) Equal to Mountain King) then do (Set Passwordparts[6] = 3) else do (Do nothing)
Collapse For each (Integer A) from 1 to 6, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Integer A) Equal to 6
Collapse Then - Actions
Set Password_before_encrypt_1 = (Password_before_encrypt_1 + (Passwordparts[(Integer A)] + <Empty String>))
Collapse Else - Actions
Set Password_before_encrypt_1 = (Password_before_encrypt_1 + (Passwordparts[(Integer A)] + -))
Collapse For each (Integer A) from 0 to ((Length of Password_before_encrypt_1) - 1), do (Actions)
Collapse Loop - Actions
Set Password_before_encrypt_2 = (Password_before_encrypt_2 + (Substring(Password_before_encrypt_1, ((Length of Password_before_encrypt_1) - (Integer A)), ((Length of Password_before_encrypt_1) - (Integer A)))))
Collapse For each (Integer A) from 1 to (Length of Password_before_encrypt_2), do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Substring(Password_before_encrypt_2, (Integer A), (Integer A))) Not equal to -
Collapse Then - Actions
Set final_password = (final_password + (String((9 - (Integer((Substring(Password_before_encrypt_2, (Integer A), (Integer A)))))))))
Collapse Else - Actions
Set final_password = (final_password + -)
Game - Display to (All players) for 0.00 seconds the text: (final_password + Is your password.)

Trigger:
load
Collapse Events
Player - Player 1 (Red) types a chat message containing -load as A substring
Conditions
Collapse Actions
Set final_password = <Empty String>
Set loadstring = (Substring((Entered chat string), 6, (Length of (Entered chat string))))
Collapse For each (Integer A) from 0 to ((Length of loadstring) - 1), do (Actions)
Collapse Loop - Actions
Set unencrypt2 = (unencrypt2 + (Substring(loadstring, ((Length of loadstring) - (Integer A)), (((Length of loadstring) - (Integer A)) + 0))))
Collapse For each (Integer A) from 1 to ((Length of unencrypt2) - 1), do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Substring(unencrypt2, (Integer A), (Integer A))) Not equal to -
Collapse Then - Actions
Set final_password = (final_password + (String((9 - (Integer((Substring(unencrypt2, (Integer A), (Integer A)))))))))
Collapse Else - Actions
Set final_password = (final_password + -)
Collapse For each (Integer A) from 1 to (Length of unencrypt2), do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
Collapse And - All (Conditions) are true
Collapse Conditions
(Substring(final_password, (Integer A), (Integer A))) Equal to -
(Substring(final_password, ((Integer A) + 1), ((Integer A) + 1))) Not equal to -
(Integer A) Equal to (Length of unencrypt2)
Collapse Then - Actions
Set current_pswd_part = (current_pswd_part + 1)
Set Passwordparts[current_pswd_part] = (Substring(final_password, oldstop, (Integer A)))
Set oldstop = (Integer A)
Collapse Else - Actions
Do nothing
Collapse For each (Integer A) from 1 to 6, do (Actions)
Collapse Loop - Actions
Collapse For each (Integer B) from 1 to (Length of Passwordparts[(Integer A)]), do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Substring(Passwordparts[(Integer A)], (Integer B), (Integer B))) Equal to -
Then - Actions
Collapse Else - Actions
Set temporary_password_string = (temporary_password_string + (Substring(Passwordparts[(Integer A)], (Integer B), (Integer B))))
Set Passwordparts[(Integer A)] = temporary_password_string
Set temporary_password_string = <Empty String>
If (Passwordparts[6] Equal to 1) then do (Unit - Create 1 Paladin for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees) else do (Do nothing)
If (Passwordparts[6] Equal to 2) then do (Unit - Create 1 Archmage for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees) else do (Do nothing)
If (Passwordparts[6] Equal to 3) then do (Unit - Create 1 Mountain King for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees) else do (Do nothing)
Unit - Move (Last created unit) instantly to (Point(((Real(Passwordparts[4])) + 0.00), (Real(Passwordparts[5]))))
Hero - Set (Last created unit) experience to (Integer(Passwordparts[1])), Hide level-up graphics
Player - Set Player 1 (Red) Current gold to (Integer(Passwordparts[2]))
Player - Set Player 1 (Red) Current lumber to (Integer(Passwordparts[3]))

and oh for your information, I did set the hero_of_player_1 to a paladin.
A thing that was unclear to me was where I should put
Trigger:
(Integer A) Equal to (Length of unencrypt2) Alternatively, check to see if its the last one, then automatically end the passwordpart.
in the
Trigger:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
Collapse And - All (Conditions) are true
Collapse Conditions
(Substring(final_password, (Integer A), (Integer A))) Equal to -
(Substring(final_password, ((Integer A) + 1), ((Integer A) + 1))) Not equal to -
Collapse Then - Actions
Set current_pswd_part = (current_pswd_part + 1)
Set Passwordparts[current_pswd_part] = (Substring(final_password, oldstop, (Integer A)))
Set oldstop = (Integer A)
Collapse Else - Actions
Do nothing


And well the one I just showed was maybe a little exaggerated. but atleast 50% or more of the numbers are 9.
But the real thing that bothers me is why it is so many -'s, doesnt look very pretty with
990--9-9-9--82--9-9Is

When I read the tutorial I hoped it would be something like
4215-1235-2364
or maybe because the trigger contained so many Integer A X - 6
134613-164123

(mark that I didn't fully understand the whole thing. Though the most of it. Maybe if I would be more concentrated I would be now as I only wanted to test it I wasn't)

btw. sry for long post :P
__________________

Last edited by Thunder_Eye : 01-16-2006 at 04:38 PM.
Thunder_Eye is offline   Reply With Quote
Old 01-16-2006, 04:28 PM   #12
johnfn
Taur is... MY SISTER!!!


Respected User
 
Join Date: Jan 2004
Posts: 1,633

Submissions (3)

johnfn has a spectacular aura about (129)

Send a message via AIM to johnfn
Default

I'm sorry about this, but would you mind sending the map? It'd be a lot easier if I could debug as I went along.
__________________
Zone Control. Give it a try!

Taur: btw dun tell anyone but I bribed the wc3c admins with a life supply of packaged peanuts to host UL ^^

Taur | Unsung Legends says:
guess what blade?
Blade.dk says:
JOHN IS YO BRO!


johnfn is offline   Reply With Quote
Old 01-16-2006, 04:39 PM   #13
Thunder_Eye
Lol I got a custom title!
 
Thunder_Eye's Avatar
 
Join Date: Aug 2004
Posts: 1,236

Thunder_Eye has a spectacular aura about (92)Thunder_Eye has a spectacular aura about (92)Thunder_Eye has a spectacular aura about (92)Thunder_Eye has a spectacular aura about (92)

Default

here it is

Can you mind reading the
"(Integer A) Equal to (Length of unencrypt2) Alternatively, check to see if its the last one, then automatically end the passwordpart."
part?
I edited the previous post.

If i cant get this to work in the way I want it I guess I will have to do my own code :P
which will probably just be something like
Paladin = ah
Mountain King = ea

and so one, very easy to crack in other words.
Still.. the map Im making is mostly for LAN party's,

I dont really mind if someone figures out the code and make a uber hero. I'll just feel sorry for him to miss the whole game, I dont think they will think its fun for to long to run around with uber stuff.
Attached Files
File Type: w3x Save Code.w3x (16.3 KB, 48 views)
__________________
Thunder_Eye is offline   Reply With Quote
Old 01-16-2006, 05:20 PM   #14
johnfn
Taur is... MY SISTER!!!


Respected User
 
Join Date: Jan 2004
Posts: 1,633

Submissions (3)

johnfn has a spectacular aura about (129)

Send a message via AIM to johnfn
Default

It turns out that that hero save and load system there works fine. It's just that since your gold, wood, experiance, and hero level were all 0, 9-0 is 0 and it comes out with a lot of 9s. As for the dashes I think thats what happens when a 0 gets turned into a string, it just turns into "" and then the two dashes get stuck together. I'd say to just keep it like that for now. It'll look better when you have tons of gold and stuff :D
__________________
Zone Control. Give it a try!

Taur: btw dun tell anyone but I bribed the wc3c admins with a life supply of packaged peanuts to host UL ^^

Taur | Unsung Legends says:
guess what blade?
Blade.dk says:
JOHN IS YO BRO!


johnfn is offline   Reply With Quote
Old 01-16-2006, 05:54 PM   #15
Thunder_Eye
Lol I got a custom title!
 
Thunder_Eye's Avatar
 
Join Date: Aug 2004
Posts: 1,236

Thunder_Eye has a spectacular aura about (92)Thunder_Eye has a spectacular aura about (92)Thunder_Eye has a spectacular aura about (92)Thunder_Eye has a spectacular aura about (92)

Default

ok, I'll test it in a normal map later : P

EDIT: I dont think the triggers work.
I made a test map with tomes and leveled the hero to lvl 6.
when I loaded I got a lvl 1 paladin.

Also, wtf is up with this code I got??
0-0-0-190-0-0-1750-0-0-10-0-0-18-9-9-98-9-9-98-9-9-9428-9-9-97-9-9-9948-9-9-9428-9-9-9

(its a lvl 3 archmage)
__________________

Last edited by Thunder_Eye : 01-16-2006 at 06:13 PM.
Thunder_Eye is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 09:14 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services