Page 1 of 2

? about scripting

Posted: Mon Jul 16, 2007 9:54 pm
by Tazz
i have never scripted before except the little bit u have to deal with making skins.....i was asked to MOD not map a map to put an invisible wall in the using clips.....this is what i was told....."script an invisible wall in the map using clips".....not sure what to do so ANY help would be GREATLY!!!!!!! appreciated.........and plz be gentle i am complete noob when comes to scripting i thought i could just caulk a wall and thats it lol

Posted: Mon Jul 16, 2007 10:09 pm
by ViPER
you will need to get coordinates from your map

in console use

Code: Select all

viewpos
thread this from your main map script (get the maps/dm/gewitter.scr)

Code: Select all

myclip_thread:	
  local.clip = spawn script_object                 
  local.clip.origin = ( x y z ) // set the coords
  local.clip setsize ( x y z )( x y z ) // set the size
  local.clip solid
  local.clip targetname myclip // give it a targetname you can manipulate it in the script
end

Posted: Mon Jul 16, 2007 11:18 pm
by Tazz
like i said im noobish to this scripting stuff but this is what i get out of what u posted....is this anywhere near right?

i want the wall to go from one end of the map to the other and start at ground and be 228 units high...and i have to do that twice so do i just double the script?


Code: Select all

myclip_thread:    
  local.clip = spawn script_object                  
  local.clip.origin = ( -3630 3009 0 ) // set the coords 
  local.clip setsize ( -3630 3009 0 )( -3630 -1051 228 ) // set the size 
  local.clip solid 
  local.clip targetname myclip // give it a targetname you can manipulate it in the script 
end 

Posted: Wed Jul 18, 2007 1:39 am
by Tazz
sry guys for the double post but i think i got it just wanted to make sure....been doing ALOT of reading on tuts and posts about this subject and hopefully its helped some......i want a wall to go from -3630 3048 0 to -3630 -1058 228......so it would have to be 4106 long and 228 high....could anyone check out this script and see if it will work for me?......also could ya tell me if its in the right place?.....ty in advance for all ur help

Code: Select all


main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "Gewitter"
setcvar "g_obj_alliedtext2" "Contest Winner"
setcvar "g_obj_alliedtext3" "By Rungsi"
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "mp_gewitter_dm.tga"

	// call additional stuff for playing this map round based is needed
	if(level.roundbased)
		thread roundbasedthread
		
	level waitTill prespawn

solid_clip1
local.clip = spawn script_object
local.clip.origin = ( -3630 996 0 )
local.clip.angles = ( 0 0 0)
local.clip setsize (-3630 2054 0 ) ( -3630 2054 228 )
local.clip.targetname = "solid_clip1"
local.clip solid
local.clip nodamage



end


Posted: Wed Jul 18, 2007 5:44 am
by ViPER

Code: Select all

main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "Gewitter"
setcvar "g_obj_alliedtext2" "Contest Winner"
setcvar "g_obj_alliedtext3" "By Rungsi"
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "mp_gewitter_dm.tga"

	// call additional stuff for playing this map round based is needed
	if(level.roundbased)
		thread roundbasedthread
		
	level waitTill prespawn

thread mywall

end

mywall:

local.clip = spawn script_object
local.clip.origin = ( -3630 996 0 )
local.clip.angles = ( 0 0 0)
local.clip setsize ( -3630 2054 0 ) ( -3630 2054 228 )
local.clip.targetname = "solid_clip1"
local.clip solid
local.clip nodamage

end
when you add stuff it's good to make a thread

also make sure you have a space before any negatives

(-1) //no

( -1 ) //yes[/code]

Posted: Wed Jul 18, 2007 6:52 am
by wacko
The Showbox Mod by Bodger might be of some help:

http://bodger-mods.com/mohaa_utilities.html

Showbox will draw a box with beams using your coords and u can check out whether it is where u want it to be

solid_clip1

Posted: Wed Jul 18, 2007 7:01 am
by tltrude
You dont need a thread name if its in the main thread, so take out "solid_clip1", or put comment marks "//solid_clip1" in front.

I could give you the right setsize numbers, but it is better to learn how to do it.

Your wall is a 3D box with six sides. The origin coordinate you set is the starting point for "setsize". So, that point on the map is the ( 0 0 0 ) point for your box.

The six numbers of the setsize "( x y z ) ( x y z )" are distance from the origin (from 0 0 0) to each side. These numbers can be positive or negitive depending on which direction the side is from the origin.

Lets make a test box that is 40 unit long, 10 units wide, and 60 unit high. In this case the origin is at the very center of the box.

local.clip setsize ( 20 5 30 ) ( -20 -5 -30 )

Ok, we have a box, but if the map origin is already on the ground (z = 0), the bottom of our box is underground. So, lets adjust the to "z" numbers -- z is the up and down axis.

local.clip setsize ( 20 5 0 ) ( -20 -5 60 )

That's better! Now the origin point of our box is in the center of the bottom side. Lets try turning our long, skinny box sideways.

local.clip setsize ( 5 20 0 ) ( -5 -20 60 )

That was easy, we just switched the "x" and "y" axis numbers.

Well I hope that helps. One thing you have to watch for, as Viper said, is negitive numbers. There has to be a space between a negitive number and the bracket or you'll get an error.

Re: solid_clip1

Posted: Wed Jul 18, 2007 7:24 am
by wacko
tltrude wrote:local.clip setsize ( 20 5 0 ) ( -20 -5 60 )

That's better! Now the origin point of our box is in the center of the bottom side.
I'd say the "...origin point of our map..."

Posted: Wed Jul 18, 2007 11:34 am
by Tazz
Lets make a test box that is 40 unit long, 10 units wide, and 60 unit high. In this case the origin is at the very center of the box.

local.clip setsize ( 20 5 30 ) ( -20 -5 -30 )
so in other words i would just have to say my box is bigger so mine would go to ( 5 2054 0) ( -5 -2054 228)...then if i want it long and skinny change the X and Y to this ( 2054 5 0 ) ( -2054 -5 228 ) and it should extend from one end of map to the other depending if my coords is right?

I think this is what u said.....thx for all the replys just alot to figure out first thing after waking up lol....will look at it more when i get home from work today



oh yeah also since im doing this (if its right) on a stock map how can i test it on my machine to see if the wall works i already set my game to set developer +1 but it didnt show anything when i last done it

Posted: Thu Jul 19, 2007 3:58 am
by tltrude
wacko wrote:The Showbox Mod by Bodger might be of some help:

http://bodger-mods.com/mohaa_utilities.html

Showbox will draw a box with beams using your coords and u can check out whether it is where u want it to be

Posted: Thu Jul 19, 2007 11:32 am
by Tazz
ty i went and got that but it doesnt come with a readme.....where do i put the file and how do i use it?......

Posted: Thu Jul 19, 2007 12:12 pm
by bdbodger
extact the showbox.scr and put it in the main/global directory that is as good as any . In your level script put

exec global/showbox.scr::setsize origin ( coords1 )( coords 2 ) color

change the parts in yellow for your values , coords1 and coords2 are the setsize values you want and color is optional and defaults to 1 1 1 ( white)

Posted: Thu Jul 19, 2007 9:25 pm
by Tazz
kewl man thx alot.....

ok i had to make a global folder in my mainta and i put the showbox there then i put exec global/showbox.scr::setsize -3630 996 0 ( 2054 5 0 )( -2054 -5 228 ) 1 1 1 in my level script and then started a game but still didnt see my box....did i do something wrong?......im hosting a gfame thru my spearhead its not dedicated or anything so does that matter?.....

Posted: Fri Jul 20, 2007 12:59 am
by bdbodger
global in mainta is ok if you are playing spearhead . If you are playing AA then make a new global folder in main .

global/showbox.scr::setsize ( -3630 996 0 ) ( 2054 5 0 )( -2054 -5 228 )

Posted: Fri Jul 20, 2007 11:29 am
by Tazz
ok i gotcha and yes im playing spearhead...forgot to put the () around origin....thx man ill try it again :lol: