Newbie needs help

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
Ulf Söderhjälm
Corporal
Posts: 45
Joined: Tue Oct 02, 2007 8:27 am

Newbie needs help

Post by Ulf Söderhjälm »

Hello every one! :D

I'm new here in the mapping/scripting stuff.

I'm currently trying to put together a (at least) 5 evel SP campaign for MoH AA called " Hedgegrow Hell", its going to concern the Landing at Omaha and the fighting inland (d-day to d-day+4 maybe)

Now, in the first mission, the player starts otside a bunker on the beach.
The objectives are to kill an officer directing artillery in a bunker, destroy a 15 cm Coastal gun, a 8.8 cm Flak canon and a 2 cm Flak gun.

Now thes obejctives concerns assasination and destroy, but i don't know how to make this work on the map and in the .scr file.
And how would the .scr file look?

Can anny one help me with this? :?: :?: :?:


PLEASE OBSERVE!!! ( Also Warning ) :shock:
Cince this is just one of my many problems, you are going to hear a lot more from me.
:twisted:
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

First I would like to say Welcome to .map for mohaa :)

Well you are right it won't be easy to tell you what to do

To start with
The objectives are to kill an officer directing artillery in a bunker
Look at the tutorials page and learn to create an objective and possibly how to setup an ai on patrol

/tutorials.php?category=Single

Your script for the first objective might look like this
main:

< objective code here >

while(isalive $bunkerguy)
{
waitframe
}

iprintln "A new objective has been added " // Tell player to look at objectives

< change objective here and mark first objective as done >

Thats one way to pause the script until the first guy is dead . When he is dead the next part of the script will change the objective and mark this one as done . The are other ways to go about it too that is one suggestion . I don't know there is so much to cover really like explosions and ai running at the player and spawning ai and a lot of other things . I guess get in your mind how you want it to look like . Act 1 part 1 Act 1 part 2 etc etc like you are making a movie . Describe the scene and maybe we can help with each part one at a time .
Image
User avatar
Ulf Söderhjälm
Corporal
Posts: 45
Joined: Tue Oct 02, 2007 8:27 am

Post by Ulf Söderhjälm »

Sounds really nice, and i apriciate every way of help, cause i need it!!!!

Hmmm...describe it.....OK! :D

You start on a small patch of beach ( going to change it later into a much bigger one, and the bunkers on a small height)
As only cover there is hedgehogs.
You don't have any weapons ( lost in the beach landing)
But there is a lot of guns and grenades to loot from dead bodies!
In front of you is a concrete bunker ( square formed)
There is 2 MG42 sticking out of 2 small gunports.( this is located in the front center of the bunker)
On the MG's left ( right side, from the way you begin)is an entrance. The entrance is guarded by an other MG42 that is located on the entrances right side.
And on the right of the bunker is a small room with an periscop on the roof! (range finder, im maybe going to make it usable to call artillery on the germans!)
In that room is an Werhmacht soldier and an Officer.
The room is small and it contains:
2 tables, 3 phones, 2 radios and 1 cordination calculator ( or something) and the other end of the range finder.
The room is between the twin MG42 room and the sleeping quarters of the bunker. The sleeping quarter contain 4 soldiers and 2 shelves.
In the 1:st shelve is 3 Mauser rifles, a P38, 24 pistol rounds, 12 grenades and lot of Rifle rounds. In the room is also a door to get to the out side( also used to reach the other part of the level. Is locked until officer is dead)

There is 2 more parts of the level, but lets start with the first one, ok?

Well i have made so that killing the officer is an WORKING objective now.
But the level ends when that is done. ( i copied the .scr from the tutorial index). I think i know now how to change this. But i still don't know how the .scr should look when there is several objectives. Tried once, didn't work at all, it even removed the Offixer killing objective!

If its any help, the level is named: test_m1l1

Everything in my head is spining :roll:
User avatar
erick
Major
Posts: 280
Joined: Wed May 30, 2007 1:14 am
Location: USA

Post by erick »

Welcome!

To script multiple objectives you need to have your objectives stated.

main:
level waittill spawn

thread objectives

end

objectives:

waitthread global/objectives.scr::add_objectives 1 2 "Kill the officer." $officer.origin

waitthread global/objectives.scr::add_objectives 2 1 "Bomb this thing." $bomb.origin //to see meaning of what 1 2 and 2 1 mean look in the global/objectives.scr script for a little help with objectives.

end

I think you know how to script the objectives so... ask if you need help. Btw I have seen tons of SP maps with just assassination for the objective. Please be more creative and have lots of objectives. It makes the map funner to play and is way better.
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

I don't know how much work you want to put into this but maybe take a step back and start with the beach scene . The ai animations are defined in a file called models/human/new_generic_human.tik . Part of that file

Code: Select all

//-------------------------------------
	// Mission 3
	//-------------------------------------

	// DDay landing (Benson)
	includes m3l1a
	{
		$include models/human/animation/human_grenade.tik
		$include models/human/animation/human_bar.tik
		$include models/human/animation/human_thompson.tik
		$include models/human/animation/human_pistol.tik
		$include models/human/animation/human_rifle.tik
		$include models/human/animation/human_mp40.tik
		$include models/human/animation/human_mg42.tik
		$include models/human/animation/human_unarmed.tik

		// Level-specific scripted animations
		$include models/human/animation/scripted/level_m3l1.tik

		// More scripted animations
		$include models/human/animation/scripted/fallen.tik
	}
	includes m3l1b
	{
		$include models/human/animation/human_grenade.tik
		$include models/human/animation/human_bar.tik
		$include models/human/animation/human_thompson.tik
		$include models/human/animation/human_pistol.tik
		$include models/human/animation/human_rifle.tik
		$include models/human/animation/human_mp40.tik
		$include models/human/animation/human_mg42.tik
		$include models/human/animation/human_unarmed.tik
	}
That enables the ai animation for that level .

$include models/human/animation/scripted/level_m3l1.tik

In that file it has

Code: Select all

$mapspec m3l1a test/move_test_rifle test/move_test gallery
What that line does is to only enable the beach animation you seen in the Dday mission in that map m3l1 . It would be nice if your map had those but to do it you would need to mod the ai to use a custom new_generic_human.tik and a modded models/human/animation/scripted/level_m3l1.tik and models/human/animation/scripted/fallen.tik then write in your script the commands to have the ai do the animations .

But lets say you don't want to go that far have you setup your mg guns yet ? If you look at the m3l1.scr in pak5.pk3 you will see a lot of mg threads some use the global/mg42_active.scr you may want to do some mg effects setting aimtargets that move or like that map zones where the guns will aim at the player if he is in the open . What about random explosion on the beach ? Do you have those scripted ? What I am saying is before you worry about a second objective make the first one as good as you can . To get the ai animations working you will have to mod some ai's even if you don't use the beach animations. At the bottom of the new_generic_human.tik are the animations that work all of the time so there are some but not enough . So where do you want to start :) you probably can see why not too many ppl do single player maps .
Image
User avatar
Ulf Söderhjälm
Corporal
Posts: 45
Joined: Tue Oct 02, 2007 8:27 am

Post by Ulf Söderhjälm »

Hmm... sounds a bit complicated...but i will never give up! :D

Well i can promise that the objectives through out the campaign won't just be assasination and blowing up stuff.
And in level 4 there is an unusual objective: Find and shut down an annoying propaganda speaker!!!
Thats the 1st objective, in the same time the player finds a document indicating bla bla bla and so on.

BUT back to the first level.
For the moment, i haven't made any scrpting for it.
I did one for killing the Officer, but as i stated further back, the level ended. And when i tried to add more objectives the whole level went nuts!

I have added a couple of MGs to the level, but only 4 points at the beach.
And they dont even have a line of fire on the beach!
(going o change that this weekend)

Well random explosions on the beach would be great!
Just don't know how to do that.

The player directly begins in a higgins LCVP with a squad.
No LCVP moving in to the beach scene, sorry.
There is a small cliff in front of the player that you have to cross to get to dryer ground.
Now there is alot beach and hedgehogs to take cover behind.
The player have to get to the far left of the map to get in to the bunker with the officer.

This bit; from starting in the landing craft and get to the bunker, should be priority 1.

Fixing some fog, Allied AI's moving up the beach, die, shout, take cover and so on..
Random explosions on the beach.
MG's firing at AI and Player.
Fixing mine fields.
AND fix an working Medic :D
Perhaps even add an objective : "Reach the first bunker" or "Obtain new orders"

Does this sounds reasonable?
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Here is a thread on random explosions that may help it is for MP but you can change that or I can do that later . Look for my post . I don't have time right now to give you more . Later I guess

/forum/viewtopic.php?t=6998&highlight=random+explosion
Image
User avatar
Ulf Söderhjälm
Corporal
Posts: 45
Joined: Tue Oct 02, 2007 8:27 am

Post by Ulf Söderhjälm »

Nice! :D

I will try with the Kabooms on the beach today :D
If it doesn't work i will ask you again.

Besides, do you have MSN :?:
It can be very handy right now for easy comminucaton
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

So hows it going?
Image
User avatar
Ulf Söderhjälm
Corporal
Posts: 45
Joined: Tue Oct 02, 2007 8:27 am

Post by Ulf Söderhjälm »

Got it working the first try! :D

Thanks for the help. :D
Im currently "maping" nice kill zones with the mortars right now.
Trying to get a good distance from player and explosion.
And also player and AI area damage
User avatar
Ulf Söderhjälm
Corporal
Posts: 45
Joined: Tue Oct 02, 2007 8:27 am

Post by Ulf Söderhjälm »

Hmmm
need some help with damage player and AI with the random explosions.
My scr currently look like this:


for(local.i=1;local.i<=$mortar.size;local.i++)
$mortar[local.i] thread mortar_active

end

start_sound:

wait 1
$fire_speaker loopsound fire_med
$river_speaker loopsound river


mortar_active:

while(1)
{

radiusdamage $random_explode 256 384
}

for(local.i=1;local.i<=$player.size;local.i++)
{
if(vector_length ( $player[local.i].origin - self.origin) < 500)
{
exec global/model.scr self.origin

if(self.target)
(self.target) delete

wait (randomint( 8)+2)
}
}
waitframe
}
end




exec global/model.scr $mything.origin models/emitters/explosion_mine.tik 2





what is missing/wrong ?
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

If it is for single player the script should be adjusted for single player so you won't need to go through each player with
for(local.i=1;local.i<=$player.size;local.i++)
because there is only one player in that case just use $player .
while(1)
{

radiusdamage $random_explode 256 384
}
That is an endless loop with no exit nothing after that will run becasue the script never gets that far . I know you are just new to this but I can't see why you don't see that . The placement of where you are doing the damage does not make sence . If you read the thread that you took this from then you would have read that
exec global/model.scr self.origin
creates an explosion at the origin of the mortar so a good place to do some damage would be just after that line . The start_sound: thread looks suspicious too is it called somewhere before this thread ? In any case the start_sound: thread needs to have the word end at the end of it or the script will read past the end into the mortar_active: thread causing it to run twice . Try this I added a thread as an example of what you can do . It does random explosions all over the map as long as the mortar_guy is still alive so when you kill him the explosions stop . ( change the targetname of the guy to the one you are using ) The thread you are using is good also it does explosions near the player the new thread adds more farther away for effect .
main:

thread start_sound

for(local.i=1;local.i<=$mortar.size;local.i++)
{
$mortar[local.i] thread mortar_active
$mortar[local.i] thread mortar_guy
}

end

start_sound:

wait 1
$fire_speaker loopsound fire_med
$river_speaker loopsound river

end

mortar_active:

while(1)
{
if(vector_length ( $player.origin - self.origin) < 500)
{
exec global/model.scr self.origin

//radiusdamage( Vector origin, Float damage, Float radius, Integer constant_damage )

radiusdamage self.origin 256 384

if(self.target)
(self.target) delete

wait (randomint( 8)+2)
}

waitframe

}
end

mortar_guy:

while(isalive $mortar_officer)
{

wait (randomint( 10)+10)

exec global/model.scr self.origin

//radiusdamage( Vector origin, Float damage, Float radius, Integer constant_damage )

radiusdamage self.origin 256 384

if(self.target)
(self.target) delete
}
end
You will notice the word self used alot . Self is the entity that started the thread
$mortar[local.i] thread mortar_active
In that instance of the thread self would be equall to $mortar[local.i] and in each new instance of the thread self would be the one mortar that called the thread . Just a tip just in case .
Image
User avatar
Ulf Söderhjälm
Corporal
Posts: 45
Joined: Tue Oct 02, 2007 8:27 am

Post by Ulf Söderhjälm »

Ok

If i name the artillery officer mortar_officer, who also is tagged as an objective, would that be nice?

When he dies the mortar stops.
The battery gets no cordinates.
Objective complete.

Sounds good to me.
Going to test the stuff now.
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

If i name the artillery officer mortar_officer, who also is tagged as an objective, would that be nice?
Yes that was my point also you can do the same with the mortar_active thread to stop all mortars but they probably won't go off again unless you go back on the beach . Maybe next we can setup the mg guns if you have not done that already .
Image
User avatar
Ulf Söderhjälm
Corporal
Posts: 45
Joined: Tue Oct 02, 2007 8:27 am

Post by Ulf Söderhjälm »

Sounds nice. :D


There is lot of MGs on this mission
4 in the first bunker
1 MG on heavy tripod between the MG bunker and the 15cm bunker
1 between the 15cm and 8.8cm bunker
and 5 MG in the 8.8cm bunker.
Most of these have bipods

There is also at least one man ready to man the MGs
Just need help to make them man them.
Post Reply