PDA

View Full Version : Question about Editor


pete
07-17-2006, 09:26 AM
I am making a new world where I want miniobjectives in certain levels that give you "awards" in a seperate Awards level. An example is in one level you must not lose more than half your life to receive an award, and in another you get an award if you finish in X amount of time. I dont know how to use variables and i couldnt think of a way to do this without variables. if someone could help me it would be great.

Hammered
07-17-2006, 09:37 AM
You will need to use G variables. There is a simpler solution and a more complex solution. Which one I provide depends on how many goals you have. I don't need an exact number, just whether it is 8 or less or 9 or more.

Coolguy
07-17-2006, 09:38 AM
You can easily use variables for that. Variables each store a number. There's eight of them. Specials can change a variable's number. However, normal variables reset each time you restart or quit a level. G-Variables get around this. G-Variables are the same as variables, except they don't reset when you go to different levels. After a player has won a minigoal, have a special use the Set Variable effect. Set G0 to 1. (G0 means "G-Variable 0"). You can switch to G1, G2, G3, etc. all the way up to G7 by left-clicking on the variable name in the special. Right-Click to switch between normal and G variables. After you set G0 to 1, go to your awards level. Make a special that has the Variables trigger. Check if G0 is equal to 1. If it is, give the player their award! Do the same with all the minigoals, except using the six other G-Variables. Be careful not to use the same variable for two different miniobjectives!

EDIT: Whoops, Hammered has it covered! I'll leave my beautiful typing here though.

Hammered
07-17-2006, 09:46 AM
That's the general idea for the solution for 8 or less goals, if you have more than 8, you will need the other solution.

Coolguy
07-17-2006, 09:48 AM
I despise the other solution! :evil: Curse modulus! It takes too long!

Hammered
07-17-2006, 09:49 AM
Modulus is completely unnecessary. The key lies in binary math. :D

Mr.Onion
07-17-2006, 09:51 AM
Very tricky binary math.

Coolguy
07-17-2006, 09:51 AM
Are you talking about the Summer Silliness - MH version?

Hammered
07-17-2006, 09:56 AM
No, I am talking about the binary math operators like | and &.

pete
07-17-2006, 11:14 AM
thx guys. im pretty sure there will only be 5 to 6 awards, not one for every level(around 10 levels). so i use G variables. tell me if this will work:

If player at anywhere has 64 life or more AND
There is 0 of badguy exactly

THEN

Set variable G0 to 1
win level and go to __ at auto
___________

and in Awards it goes somethin like this:

If G0 is 1

THEN

Change single item at _,_ to award(i made this item)

Mr.Onion
07-17-2006, 11:24 AM
When you acheive the thing set G0 to G0+1. When you get the awared Check if G0 is 1 and set it to 2, this ensures they don't get it twice.

pete
07-17-2006, 11:29 AM
well you dont actually get the item it is sort of like in a display case. in some levels you actually receive the award in the level and it gives you coins or somethin, but in the Awards level you do not pick up the award. would i still need to set it to 2?

Hammered
07-17-2006, 12:28 PM
Actually, your code should work fine. It will allow the player to collect the award more than once, but it will only record the collection once, which, as I understand it, is what you are looking for.

Just be sure to use a separate G variable for each goal.

pete
07-18-2006, 07:41 AM
ok it is working good now. im about halfway done with my world, then hopefully wtg will accept it and it can be added onto the add-ons.

Chris Da Lunatic
07-18-2006, 09:29 AM
You can store multiple switches in variables without the tricky stuff. (sort of)

just have a value for each combination of switches in a variable.

Mr.Onion
07-18-2006, 09:43 AM
That gets bigger very quickly.

Hammered
07-18-2006, 11:48 AM
I finally finished the Variable page in THE Guide, which explains the more difficult method for those who would like to attempt a more complex world. Check it out here: http://www.freewebs.com/suppremeplayersguide/variables.html