Null entity clarification please...

Post your scripting questions / solutions here

Moderator: Moderators

agentmad007
Brigadier General
Posts: 570
Joined: Tue Feb 24, 2004 3:52 pm

Post by agentmad007 »

thank you nuggets ;)

you mean all that answer in mapping and scripting forum i mean you (nuggets tltrude bjarne )and i forgot maybe some other good scripter but i read often your names there lol
never seen so much answer and ask by day in other forum!!!!!!!!!!!!
(i m french so i check all forum :p )

Nice work for all your help!!!!!!!!!!!!!!!!!!! :o
Splaetos
Major General
Posts: 730
Joined: Tue Jan 20, 2004 2:55 pm
Contact:

Post by Splaetos »

This script is based on Bjarne's from canal, which is posted(at least partialy in the new release section(the canal thread =p)

I dont see why it wont be possible to use more then one prison to hold the prisoners(my axis jail is set up with || statements at the moment, but since I havent gotten the single ally jail one to work yet I am not sure of course =) I havent done anything on it today, I think I need to change my trigger. Anywhere here is the entire script.

Code: Select all

main:
	
	//scoreboard
	setcvar "g_obj_alliedtext1" "Kill the Axis!  "
	setcvar "g_obj_alliedtext2" "Release the Allies! "
	setcvar "g_obj_alliedtext3" "0 of 0 Allies jailed"
	setcvar "g_obj_axistext1"   "Kill the Allies! "
	setcvar "g_obj_axistext2"   "Release the Axis! "
	setcvar "g_obj_axistext3"   "0 of 0 Axis jailed  "
	setcvar "g_scoreboardpic" "none"

	level waitTill prespawn

	exec global/dmprecache.scr
	level.script = maps/obj/lib_gefangnis.scr
	exec global/ambient.scr mohdm2
	
	level.dmrespawning = 1 // 1(respawn) or 0(not)
	level.dmroundlimit = 15
	level.clockside = kills //allies, axis, kills or draw

	local.master = spawn ScriptMaster

	local.master aliascache snd_cells sound/mechanics/fence_open.wav soundparms 2.5 0.2 1.0 0.2 200 2000 auto loaded maps "obj dm"
	local.master aliascache snd_triggers sound/item/item_bangaloreassemble_02.wav soundparms 1.0 0.2 1.0 0.2 200 2000 auto loaded maps "obj dm"

	//disable the prison spawns for first spawn.
	$axis_prison_spawn disablespawn
	$allied_prison_spawn disablespawn


	level waitTill spawn
	
	
	//level waitTill roundstart

	thread axis_prison
	thread allied_prison
	thread player_scanner
	
	//enable the prison spawns only for rest of duration.
	wait 10
	$axis_prison_spawn enablespawn
	$allied_prison_spawn enablespawn
	$axis_standard_spawn disablespawn
	$allied_standard_spawn disablespawn


end


//*************************************************
//***             AXIS PRISON LOGIC             ***
//***  Thread Loop for regulating Axis Triggers ***
//*************************************************

axis_prison:
	thread axis_prison_trigger1
	thread axis_prison_trigger2
end


//*************************************************
//***             ALLIED PRISON LOGIC           ***
//***  Thread Loop for regulating Ally Triggers ***
//*************************************************

allied_prison:
	thread allied_prison_trigger1
	thread allied_prison_trigger2
end


//*************************************************
//***             AXIS TRIGGER I                ***
//***Used by ALLIED players to release teamates.***
//*************************************************

axis_prison_trigger1:
	$axis_trigger1 waittill trigger
	if (parm.other.dmteam == allies)
	{
		$axis_trigger1 playsound snd_triggers
		parm.other iprint "Your team has been released!" 0
		$axis_trigger1 nottriggerable
		$axis_trigger2 nottriggerable
		waitthread axis_prison_open
		$axis_trigger2 triggerable
		$axis_trigger1 triggerable
		thread axis_prison
	}
	else
	{
		if(parm.other.dmteam == axis)
		{
			parm.other iprint "Idiot!" 0
			thread axis_prison_trigger1
		}
	}
end	


//*************************************************
//***             AXIS TRIGGER II               ***
//***Used by ALLIED players to release teamates.***
//*************************************************	
axis_prison_trigger2:
	$axis_trigger2 waittill trigger
	if (parm.other.dmteam == allies)
	{
		$axis_trigger2 playsound snd_triggers
		parm.other iprint "Your team has been released!" 0
		$axis_trigger1 nottriggerable
		$axis_trigger2 nottriggerable
		waitthread axis_prison_open
		$axis_trigger2 triggerable
		$axis_trigger1 triggerable
		thread axis_prison
	}
	else
	{
		if(parm.other.dmteam == axis)
		{
			parm.other iprint "Idiot!" 0
			thread axis_prison_trigger2
		}
	}
end



//**********************************************
//***            ALLIED TRIGGER I            ***
//***Used by AXIS players to release teamates***
//**********************************************

allied_prison_trigger1:
	$allied_trigger1 waittill trigger
	if (parm.other.dmteam == axis)
	{
		$allied_trigger1 playsound snd_triggers
		parm.other iprint "Your team has been released!" 0
		$allied_trigger1 nottriggerable
		$allied_trigger2 nottriggerable
		waitthread allied_prison_open
		$allied_trigger1 triggerable
		$allied_trigger2 triggerable
		thread allied_prison
	}
	else
	{
		if(parm.other.dmteam == allies)
		{
			parm.other iprint "Idiot!" 0
			thread allied_prison_trigger1
		}
	}
end



//**********************************************
//***            ALLIED TRIGGER II           ***
//***Used by AXIS players to release teamates***
//**********************************************

allied_prison_trigger2:
	$allied_trigger2 waittill trigger
	if (parm.other.dmteam == axis)
	{
		$allied_trigger2 playsound snd_triggers
		parm.other iprint "Your team has been released!" 0
		$allied_trigger1 nottriggerable
		$allied_trigger2 nottriggerable
		waitthread allied_prison_open
		$allied_trigger1 triggerable
		$allied_trigger2 triggerable
		thread allied_prison
	}
	else
	{
		if(parm.other.dmteam == allies)
		{
			parm.other iprint "Idiot!" 0
			thread allied_prison_trigger2
		}
	}
end


//***************************************
//***     Opens the AXIS Prison       ***
//***     Releases ALLIED Prisoners   ***
//***************************************

axis_prison_open:
	$axis_door1 time 3
	$axis_door2 time 3
	$axis_door3 time 3
	$axis_door4 time 3
	wait 1
	//Open the Cells.
	$axis_door1 movebackward 100
	$axis_door2 moveforward 100
	$axis_door3 moveright 100
	$axis_door4 moveleft 100
	$axis_door1 playsound snd_cells
	$axis_door2 playsound snd_cells
	$axis_door3 playsound snd_cells
	$axis_door4 playsound snd_cells
	$axis_door1 move
	$axis_door2 move
	$axis_door3 move
	$axis_door4 waitmove
	iprintlnbold_noloc "The Allies have been Rescued!"
	wait 10
	//Close the Cells.
	$axis_door1 damage 500
	$axis_door2 damage 500
	$axis_door3 damage 500
	$axis_door4 damage 500
	$axis_door1 moveforward 100
	$axis_door2 movebackward 100
	$axis_door3 moveleft 100
	$axis_door4 moveright 100
	$axis_door1 playsound snd_cells
	$axis_door2 playsound snd_cells
	$axis_door3 playsound snd_cells
	$axis_door4 playsound snd_cells
	$axis_door1 move
	$axis_door2 move
	$axis_door3 move
	$axis_door4 waitmove
end
	


//***************************************
//***     Opens the ALLIED Prison     ***
//***     Releases AXIS Prisoners     ***
//***************************************

allied_prison_open:
	$allied_door1 time 3
	$allied_door2 time 3
	wait 1
	//Open the Cells.
	$allied_door1 moveforward 60
	$allied_door2 movebackward 60
	$allied_door2 playsound snd_cells
	$allied_door1 move
	$allied_door2 waitmove
	iprintlnbold_noloc "The Axis have been Rescued!"
	wait 10
	//Close the Cells.
	$allied_door1 damage 500
	$allied_door2 damage 500
	$allied_door1 movebackward 60
	$allied_door2 moveforward 60
	$allied_door2 playsound snd_cells
	$allied_door1 move
	$allied_door2 waitmove
end


//*************************************************
//***           Keep Track of Players           ***
//***            in Jail or Not                 ***
//*************************************************

player_scanner:
	while (true)
	{
		level.allies_in_game = 0
		level.axis_in_game = 0
		level.allies_in_prison = 0
		level.axis_in_prison = 0
		for(local.i = 1; local.i <= $player.size; local.i++)
		{
			waitthread detect_player_status $player[local.i]
			waitframe
		}
		waitthread test_winning_conditions
		wait 1
	}
end

//*************************************************
//***          Counting of Players              ***
//*************************************************

detect_player_status local.player:
	// Test if the player has spawned into the map, or are still choosing weapon
	local.trigger = spawn trigger_multiple "targetname" "player_position_trigger" setthread player_exists_setthread
	local.trigger.origin = local.player.origin
	waitframe
	waitframe
	waitframe
	$player_position_trigger delete
	if(local.player.activated && isAlive local.player)
	{
		if(local.player.dmteam == allies)
		{
			level.allies_in_game++
			if(local.player istouching $axis_sensor1 || local.player istouching $axis_sensor2 || local.player istouching $axis_sensor3 || local.player istouching $axis_sensor4 || local.player istouching $axis_sensor5 || local.player istouching $axis_sensor6 || local.player istouching $axis_sensor7 || local.player istouching $axis_sensor8 || local.player istouching $axis_sensor9 || local.player istouching $axis_sensor10 || local.player istouching $axis_sensor11)
			{
				println "ally in jail"
				level.allies_in_prison++
			}
		}
		else
		{
			if(local.player.dmteam == axis)
			{
				level.axis_in_game++
				if(local.player istouching $allied_sensor1)
				{
					println "axis in jail"
					level.axis_in_prison++
				}
			}
			else
			{
				if(local.player.dmteam == spectator)
				{
					iprintln "Spectating player detected " local.player.dmteam
					local.player.activated = false
				}
				else
				{
					iprintln "Undefined player detected " local.player.dmteam
					local.player.activated = false
				}
			}
		}
	}
end


player_exists_setthread:
	parm.other.activated = true
end


//*******************************************************************
//***             Monitor prison populations                      ***
//***              Determine Winner                               ***
//*******************************************************************

test_winning_conditions:
	local.temp_string = string(level.axis_in_prison) + " of " + string(level.axis_in_game) + " Axis jailed  "
	setcvar "g_obj_axistext3" local.temp_string
	local.temp_string = string(level.allies_in_prison) + " of " + string(level.allies_in_game) + " Allies jailed"
	setcvar "g_obj_alliedtext3" local.temp_string
	if(level.allies_in_game > 0)
	{
		if(level.allies_in_game == level.allies_in_prison)
		{
			// iprintln "Axis win!"
			//teamwin axis
		}
	}
	if (level.axis_in_game > 0)
	{
		if( level.axis_in_game == level.axis_in_prison)
		{
			// iprintln "Allies win!"
			//teamwin allies
		}
	}
end
again i havent even begun to really check if the multiple prisons will function, but in theory, I dont see why they wouldnt, as long as the triggers properly monitor the spaces that they should.


EDIT ---- Ok it works now, so ill have to see if I can keep it working while making my jail more complicated... and see if I can get the multiple axis cells to work properly as well...
When I am king, you will be first against the wall~
Image
Splaetos
Major General
Posts: 730
Joined: Tue Jan 20, 2004 2:55 pm
Contact:

Post by Splaetos »

agentmad007 wrote:i m doing a lib map too is it possible to have a several jail lol !!!!!
can i have the script plz ? ??? and tell me a bit how it work plz ty

you seems to be good on this forum at scripting!!!!!!

my script is above, it uses two triggers per jail, and several cell areas for the axis jail, which is now working! yay! Least its working for one person running around, each cell picks up prisoners indepenently, have to see later if more players can confuse it but I dont see why they would.

for the multiple cells I used an if statement with 'or' dialogue to read if the allied play is in any of the cells and it seems to work fine.....

if(local.player istouching $axis_sensor1 || local.player istouching $axis_sensor2 || local.player istouching $axis_sensor3 || local.player istouching $axis_sensor4 || local.player istouching $axis_sensor5 || local.player istouching $axis_sensor6 || local.player istouching $axis_sensor7 || local.player istouching $axis_sensor8 || local.player istouching $axis_sensor9 || local.player istouching $axis_sensor10 || local.player istouching $axis_sensor11)


a more 'pure' version of the liberation coding is in 'the cana-liberation' by Bjarne, who I have credited in mine, since I never would ahve attempted this without his model =)

the one problem im aware of right now in my script, is some redundant messages AFTER the first tiem or two the jails are opened, for some reason it will duplicate 'your team ahs been release' or 'the axis have been rescued' more then once, and im not compeltely sure why.
When I am king, you will be first against the wall~
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

I guess you guys have seen this: http://dynamic6.gamespy.com/~rjukanproj ... n+MOH%3AAA ?
Says the same as the script, but with more words :)
Admin .MAP Forums
Image
Head above heels.
Splaetos
Major General
Posts: 730
Joined: Tue Jan 20, 2004 2:55 pm
Contact:

Post by Splaetos »

hadnt seen that, but the legal/moral page was interesting =p

I dont think in america you can legaly copyright a 'game idea' at least not without defining it to the nth degree, but of course im no lawyer. I dont think any could own a copyright on say 'capture the flag' but ea does own the legal rights to everything else associated with thier games im sure, so if they were unpleases at something they could be annoying, but it is unlikely they would bother unless someoen else was making money off it.

Anyway, MOH:BT was not a great product, so as far as moral issues are concerned, I think ea should be down on thier knees, kissing the ass of anyone who is still trying to make moh:AA or SH or BT more appealing until they do release a good product.

BT had some decent aspects, I love smoke grenades, but it also has serious drawbacks, and without MOH:AA backing it up, the MOH series would be severely diminished. Transfering game types between, 'expansions' is overall, probably pretty good for ea's prospects in the long run, since it translates some good ideas, to a broader audience. Especialy at this point, when youd probably have trouble finding any of the games sold individualy folowing the release of 'war chest'.
When I am king, you will be first against the wall~
Image
agentmad007
Brigadier General
Posts: 570
Joined: Tue Feb 24, 2004 3:52 pm

Post by agentmad007 »

thx for the script i read it before on the canal lib bit i didnt think thta was bjarne that made this map very coooooooool!!!!!!!!!!
but it dont work with moh BT coze its a not lib script!

i m bad on scripting but what i understood is that you got several jail openable with a switch and trigger multiple checked if axis and allied are in jail ? ......you made a long script lol nice work

can we confuse the lib script with your script ??????? to make several jails and make the map openable will moh BT in liberation mod !????

TY
Splaetos
Major General
Posts: 730
Joined: Tue Jan 20, 2004 2:55 pm
Contact:

Post by Splaetos »

eh?

you are making a liberation map for BT or for AA?

Bjarne's Canal, and my map are both AA maps... There is a tutorial for liberation breakthroughs on this site though. I know nothing of actualy mapping for BT tho =)

but I assume that it has the same principles, triggers to open the cells, and trigger multiples to count prisoners in jail. BT has alot of other stuff going on in its liberation modes tho, course I found alot of those other things annoying =) For one, the damn siren volume was always way too high =)
When I am king, you will be first against the wall~
Image
agentmad007
Brigadier General
Posts: 570
Joined: Tue Feb 24, 2004 3:52 pm

Post by agentmad007 »

yes true splaetos this ring alarm is very annoying lol but someone will send me a mod to change the bell

and yes i m doing one for breakthrough :( thought you too lol thats why it looked like strange for me to put sevral jail LOL

thx ...
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

After a lot of Liberation talk here in the forum, I picked myself together and completed the Liberation for MOH:AA tutorial. It now actually tells you the details, and allows you to download an example map file and script.

If you find any errors, please fix them yourself or comment the error ( you can because its a Wiki :D ).

And Splaetos, the first error that started this thread is also explained in the tutorial: you are alone in the map and have commented out the line

Code: Select all

level waittill roundstart
making it look like this

Code: Select all

// level waittill roundstart
...right? If so: read the "Script / main method" section :)
Admin .MAP Forums
Image
Head above heels.
Splaetos
Major General
Posts: 730
Joined: Tue Jan 20, 2004 2:55 pm
Contact:

Post by Splaetos »

what is wiki anyway?

but no, I havent yet seen the error you described in the tutorial, perhaps it will not work once roundstanrt is commented back in =p but for now, with roundstart and the win conditions commented out, I can check if all my sensors read my presence. Are you sure that you shouldnt be able to do this with the line commented?

My initial error still boggles my mind, because I cant figure out how I managed to skip naming one of the sensors... I was copying and moving and renaming al lthe while incrementing the name by +1. So I would have understood if I had gave two the same name or what have you, but how I skippe d from 6 to 8 while leabving one blank in between is a mystery to me =)

I posted a couple comments about your tut also in the other thread, cause I dunno what this wiki stuff is all about =)

I did see that null listener console message once, but that was before I had everything set up right....
When I am king, you will be first against the wall~
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Splaetos wrote:what is wiki anyway?
Well, its like any web page, except there is a little button at the botom that says "edit". Anyone can edit the pages, not just administrators. ( Well, actually my wiki requires that you are registerd and logged in, but anyone can register )
Admin .MAP Forums
Image
Head above heels.
dcoshea
Colour Sergeant
Posts: 94
Joined: Thu Mar 04, 2004 3:00 am
Location: Sydney, Australia
Contact:

Post by dcoshea »

Bjarne BZR wrote:
Splaetos wrote:what is wiki anyway?
Well, its like any web page, except there is a little button at the botom that says "edit". Anyone can edit the pages, not just administrators. ( Well, actually my wiki requires that you are registerd and logged in, but anyone can register )
Yeah, Bjarne wrote that whole thing about making a Liberation mode and I added on that legal/moral stuff for some reason, and am quite surprised you read it Splaetos :) I agree that creating a Liberation mode for Allied Assault and/or Spearhead isn't likely to have much of an impact on anyone's decision to buy Breakthrough or any other game they make and I do kind of think that it's a shame that so few people can play Liberation since they didn't buy Breakthrough. Here in Australia, last I checked, there are no Breakthrough servers, so even if I got it, I couldn't play Liberation, so I guess that means these mods could allow people to play Liberation mode on an Australian server that runs AA or Spearhead. However, on the other hand, I guess there would be servers if more people got Breakthrough, and Liberation mode is kind of a good reason to get Breakthrough. Do you suppose I could convince lots of people who play AA or Spearhead to buy Breakthrough because Liberation mode is cool? :)

Sorry this is a bit off-topic!

Regards,
David
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Yeah, but your adding of the legal and moral issues to the tutorial I started is a great example of the use of a Wiki: Everyone can have a direct influence.
Admin .MAP Forums
Image
Head above heels.
Post Reply