Page 1 of 1

level.something commands

Posted: Thu Jul 19, 2007 6:31 pm
by erick
This is kind of continued from the '$targetname in radiant post'
https://map.moh-central.net/forum/viewtopic.php?t=12728
But since this question is about scripting I am making a new post here.
In a simple elevator script the scripter has to state the position of the elevator. I have seen level.elepos in the past but couldn't you have anything like level.elevator or something to store the variable in. All you have to do is state the starting condition. Example: If the elevator starts on the bottom floor then say level.elevator = 0 (or whatever your variable name is) And then when you check to see what state the elevator is in you could this.

Code: Select all

if (level.elevator = 0)
{
goto moveup
}
else 
{
goto movedown
}
end

moveup:
blah blah blah (after all that moving stuff then you would put)
level.elevator = 1
And then the same thing for movedown except level.elevator = 0 at the end
Dont laugh if its wrong :wink:
I am just asking someone who knows this stuff if you could do this. :D

Posted: Thu Jul 19, 2007 6:50 pm
by Condor
Uhm, yes, of course you can... :?:

You also could check the position of the elevator, if it is smaller or greater than x etc.

Posted: Thu Jul 19, 2007 9:09 pm
by erick
Yes I might learn some of these scripting commands after all! :D

Posted: Fri Jul 20, 2007 1:07 am
by bdbodger
if (level.elevator = 0)
(level.elevator = 0) assigns the value 0 to level.elevator

(level.elevator == 0) does a compare to see if the two value are the same and returns true or false . If statements check for true or false expressions .
if (level.elevator == 0)

Posted: Fri Jul 20, 2007 3:39 am
by erick
Oops! I forgot about the '==' and '='. This has helped me learn much.

Re: level.something commands

Posted: Fri Jul 20, 2007 6:01 am
by tltrude
erick wrote: I have seen level.elepos in the past but couldn't you have anything like level.elevator or something to store the variable in.
Sure, you can make up any name you wish for a variable -- except the ones the game uses. But, when your script get longer, its better to use a name that helps you remember what it is for!

Also, don't forget to set a value of your variable, before you use it in a thread.

level waittil prepawn

level.elevator = 0

level waittil spawn

end


It doesn't have to be in prespawn, but it does have to be set somewhere, or you get an error.

Which Variables can I use?

Posted: Fri Jul 20, 2007 2:21 pm
by erick
Yes I am learning after all. :D
Are the variables that the game uses are like level.targets_to_destroy
If they are I will just make sure that the game doesnt use the one I select :twisted:

level.targets_to_destroy

Posted: Sat Jul 21, 2007 7:06 am
by tltrude
Yes, "level.targets_to_destroy" would be an example of one that might be already in use for an objective game.

Posted: Sat Jul 21, 2007 2:47 pm
by erick
Okay that is what I thought. Thanks for all the help! :D