Scipting objects problem!

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Scipting objects problem!

Post by Master-Of-Fungus-Foo-D »

Here is my "MODDED" algeirs script!

Code: Select all

// NORTH AFRIKA
// ARCHITECTURE: NED, POWZER
// SCRIPTING: POWZER
main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "Algiers"
setcvar "g_obj_alliedtext2" "Sweet!"
setcvar "g_obj_alliedtext3" "I added Fog!"
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "mohdm7"

exec global/friendly.scr

level waitTill prespawn

//*** Precache Dm Stuff
exec global/DMprecache.scr

level.script = maps/dm/terrain2.scr
exec global/ambient.scr terrain2

$world farplane_color "0.011765 0.254902 0.494118" //The color you want your fog! A good way to get this is to go //in MOHRadiant and hit "k" an pic a color, it will give you the 3 numbers u need!
level.fogplane = 6500 //Just tells how far u'r guy can see. The lower the thicker the fog is, the higher the less //fog there is!
$world farplane level.fogplane// <---Just lets MOH know u have fog haha!

spawn_a_flak88: 
  // Spawn a script model and give it a targetname 
  local.flak = spawn script_model "targetname" "flak88" 
  // Set the model to be drawn/used 
  local.flak model "statweapons/flak88turret.tik" 
  // Set where it should be 
  local.flak.origin = ( -2941.84 1739.59 284.13 ) 
  // Set where it should point at 
  local.flak.angles = ( 0.47 89.99 0.00 ) 
  // Set how big it should be 
  local.flak.scale = 0.50 

  // Create the trigger and give it a targetname 
  local.trigger = spawn trigger_use "setthread" "fire_flak88" 
  // Set where it should be 
  local.trigger.origin = ( -2947.92 1656.96 284.13 ) 
  // Set the size of it 
  local.trigger setsize ( -100 -100 -100 ) ( 100 100 100 ) 
end

spawn_a_stuka:
  local.stuka = spawn script_model
  //hmm i hope this works
  local.stuka model "vehicles/stuka-desert.tik"
  //spawning stuff
  local.stuka.origin = ( -2920.51 2759.36 537.12 )
  //painting places hehehe
  local.stuka.angles = ( 8.31 -92.38 0.00 )
  //size aint everything but this is supersized
  local.stuka.scale = 2.0
end

	// call additional stuff for playing this map round based is needed
	if(level.roundbased)
		thread roundbasedthread
		
		exec global/door_locked.scr::lock
		level.script = maps/dm/mohdm7.scr
		exec global/ambient.scr mohdm7
	
	level waittill spawn

end

//-----------------------------------------------------------------------------

roundbasedthread:

	// Can specify different scoreboard messages for round based games here.

	level waitTill prespawn

	level waittill spawn

		// set the parameters for this round based match
		level.dmrespawning = 0 // 1 or 0
		level.dmroundlimit = 5 // round time limit in minutes
		level.clockside = kills // set to axis, allies, kills, or draw

	level waittill roundstart

end
well, i just cant spawn the flak88 and stuka at the same time. If i moved the stuka part the STUKA wouldnt show up but the flak WOULD show up but if i moved the flak88 part the stuka would APPEAR and the FLAK88 would go BYE BYE! i am so confused! somebody help me plz!
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

end

Post by tltrude »

"end" makes it stop reading lines.

Those two theads should be moved to the very bottom of the script. Then add these lines to start them under level waittill spawn.

level waittill spawn

thread spawn_a_flak88
thread spawn_a_stuka


end // <------This ends of "main:" thread.
Tom Trude,

Image
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post by Master-Of-Fungus-Foo-D »

ooooohhhhhhhhh. i was just putting in

spawn_a_flak88
blah blah text stuff
.........................
............................
.............................
..........................
..........................

spawn_a_stuka
......................
.......................
.....................
.....................



ok so your saying that i sould move it to the bottom of the script, put in the "level waittil prespawn" and then type in "thread spawn_a_flak88
.................................................................thread spawn_a_stuka

just like that?

and then put the spawning stuff in underneath the thread start?


now youve shown me the light!
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

no, scripts are made up of threads, little bits of code that are run when someone hits a trigger or are called by another thread.
in this case, you'll want

thread spawn_a_flak88

then after that at the bottom of the script


spawn_a_flak88:

//spawn stuff

end

and the same for stuka. :wink:
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post by Master-Of-Fungus-Foo-D »

is a func--->teledest an entity?
because i want to put 1 in algeirs and dunno how
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
blue60007
General
Posts: 1247
Joined: Sun Mar 07, 2004 11:44 pm

Post by blue60007 »

master-of-fungus-foo-d wrote:is a func--->teledest an entity?
because i want to put 1 in algeirs and dunno how
I honestly don't know what the heck that is. :oops:

I think you meant teleportdest.

Wait I think if you put a trigger > teleport and have that target the func>teleportdest and that is the teleport's destination...
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

teleport

Post by tltrude »

Here is a teleporter that will send players to two different spots, depending on which team they are on.

Code: Select all

teleport:  //Teleport Player

	local.tele = spawn trigger_multiple targetname "tele_trigger" 
	local.tele.origin = ( -8 -896 -56 ) 
	local.tele setsize ( -32.00 -32.00 -4.00 ) ( 32.00 32.00 8.00 )
  
 while (1)
	{
	$tele_trigger waittill trigger
	local.player = parm.other 
		if (local.player.dmteam == "allies") 
		{ 
		local.player tele $teled1 
		} 
		if (local.player.dmteam == "axis")  
		{ 
		local.player tele $teled2  
		}
		if (local.player.dmteam == "spectate")  
		{
		end  
		}
	wait .1
	} 
end 

tele1:      //Teleport dest 1 Allies 

	local.teledest = spawn func_teleportdest targetname "teled1" 
	local.teledest.origin = ( 416 32 -56 ) 
	local.teledest setsize ( -32.00 -32.00 -4.00 ) ( 32.00 32.00 8.00 ) 
end 

tele2:      //Teleport dest 2 Axis
 
	local.teledest = spawn func_teleportdest targetname "teled2"
	local.teledest.origin = ( -416 32 -56 ) 
	local.teledest setsize ( -32.00 -32.00 -4.00 ) ( 32.00 32.00 8.00 ) 
end
You need to change the coordinates to use it. Also, place these lines under level waittill prespawn.

thread tele1
thread tele2
thread teleport
Tom Trude,

Image
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post by Master-Of-Fungus-Foo-D »

ok thanx but now i have another question and i dont want to have to make another post so ill just ask it itn this 1...

Well it is a stupid noob question, but how do you script something more than 1 key/value? thanx in advance :D
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

no problem, just do this....

$thing.origin = 0 0 0
$thing.target = $thingtwo

of course you don't need to do those two in particular, just keep adding things like that until you're done.
etc, you can even make your own key/values based on the need....

$thing.type = axis

it's really handy, especially in sp maps. :wink:
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post by Master-Of-Fungus-Foo-D »

so it would b like

$miscobj.color = *"0000000.0000 000000.000000 00000.000000"*

* means ------>with quotes or without?
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
Post Reply