level.something commands

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
erick
Major
Posts: 280
Joined: Wed May 30, 2007 1:14 am
Location: USA

level.something commands

Post 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
Condor
Colour Sergeant
Posts: 82
Joined: Mon Apr 09, 2007 3:19 pm
Location: Bavaria (Germany)

Post 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.
User avatar
erick
Major
Posts: 280
Joined: Wed May 30, 2007 1:14 am
Location: USA

Post by erick »

Yes I might learn some of these scripting commands after all! :D
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post 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)
Image
User avatar
erick
Major
Posts: 280
Joined: Wed May 30, 2007 1:14 am
Location: USA

Post by erick »

Oops! I forgot about the '==' and '='. This has helped me learn much.
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Re: level.something commands

Post 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.
Tom Trude,

Image
User avatar
erick
Major
Posts: 280
Joined: Wed May 30, 2007 1:14 am
Location: USA

Which Variables can I use?

Post 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:
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

level.targets_to_destroy

Post by tltrude »

Yes, "level.targets_to_destroy" would be an example of one that might be already in use for an objective game.
Tom Trude,

Image
User avatar
erick
Major
Posts: 280
Joined: Wed May 30, 2007 1:14 am
Location: USA

Post by erick »

Okay that is what I thought. Thanks for all the help! :D
Post Reply