Some one help me with this

Post your scripting questions / solutions here

Moderator: Moderators

LT.BARNES
Major
Posts: 288
Joined: Mon Dec 30, 2002 4:37 pm
Location: london

Some one help me with this

Post by LT.BARNES »

Hi!!

I really need help...

you see i am tryin to get a german hittin an allied soldier, who is sittin on a chair (bein interragated) like in mission 1|2a.

I think it is somethin wrong with my script, or somethin i missed out to put in the map...

The ALLIED SOLDIER WORKS FINE, he will get hit and stand up when i get close and everythin... BUT it is the German that doesn't do nothin...

HERE IS MY SCRIPT..




chairstart:

if (isalive level.friendly5)
level.friendly5 nodamage

local.o = $interchair gettagposition "tag_oss"
level.friendly5.origin = local.o
level.friendly5.angles = $interchair.angles
level.friendly5 exec global/disable_ai.scr

level.friendly5 solid
level.friendly5 waitexec anim/smoking.scr::SmokeRemoveCigarette

local.o = $interchair gettagposition "tag_german"
local.a = $interchair gettagangles "tag_german"


spawn human/German_afrika_private "targetname" "chairenemy"
$chairenemy.angles = $interchair.angles
$chairenemy exec global/disable_ai.scr
$chairenemy threatbias ignoreme
local.a2 = $chairenemy.angles
local.a2[1] = local.a2[1] + 180

$chairenemy.origin = local.o
$chairenemy.angles = local.a2

level.friendly5 gun "none"

$chairenemy gun "Mauser KAR 98K"
$chairenemy holster

local.last = 1
local.randnum = 1


$chairenemy anim_scripted "German_hit_idle"
// level.friendly5 delete

thread chairanim local.o
local.thread = parm.previousthread
thread chairhealth local.thread
end

chairanim local.o:
$chairenemy.no_idle = 1
level.friendly5.no_idle = 1


while (1==1)
{
$chairenemy.origin = local.o

if (randomint(100) > 85)
{
$chairenemy anim_scripted "German_hit_idle"
waitframe
level.friendly5 anim_scripted "OSS_hit_idle"
wait 0.9
// level.friendly5 waittill animdone

}
else
{
while (local.randnum == local.last)
local.randnum = randomint(3) + 1
local.last = local.randnum

$chairenemy anim_scripted ("German_hit_" + local.randnum)
waitframe
level.friendly5 anim_scripted ("OSS_hit_" + local.randnum)
wait 0.25
level.friendly5 waittill animdone
}

}

end

chairsolid:
while ((isalive level.friendly5) && (vector_length (self.origin - level.friendly5.origin) < 100))
wait 0.3

while (vector_length (self.origin - $player.origin) < 100)
wait 0.3

self solid

end

POW_damage:
level.flags[POW_damage] = 1
self delete
end

deathmessage:
self waittill death
iprintlnbold "Private Jury has been killed in action."
end


chairhealth local.thread:
local.health = $chairenemy.health

while ((level.flags[POW_damage] == 0) && ($chairenemy.health == local.health) && (vector_length ($player.origin - $interchair.origin) > 200))
waitframe

local.thread delete
$chairenemy anim stop
level.friendly5 anim stop

$chairenemy unholster

$chairenemy lookat $player
$chairenemy turnto $player
$chairenemy threatbias 1000

$chairenemy exec global/enable_ai.scr

while ((isalive $chairenemy) || (isalive $pow_guard))
{
level.friendly5 anim_scripted "OSS_hit_idle"
level.friendly5 waittill animdone
}
local.dist = 80

$interchair notsolid
// level.friendly5 notsolid

while (vector_length (level.friendly3.origin - $player.origin) < local.dist)
wait 0.4

level.friendly5 anim_noclip oss_getup
level.friendly5 waittill animdone
level.friendly5 lookat $player

/*
while (vector_length (level.friendly3.origin - $player.origin) < local.dist)
wait 0.4

level.friendly5 waitthread global/reach.scr::reach $chairnode
// level.friendly5 runto $chairnode
// level.friendly5 waittill movedone

*/

// level.friendly5 solid
// $chairclip delete
// $interchair solid


level.flags[hostage] = 1
// level.friendly5 american
level.friendly5 thread deathmessage
level.friendly5.friendtype = 1
level.friendly5.olddestination = $player
level.friendly5.destination = $player
level.friendly5.turndoneerror = 5
level.friendly5 turnto $player
level.friendly5 lookat $player
level.friendly5 waittill turndone
level.friendly5 say dfr_M1L2_thankyou
level.friendly5 waittill saydone

while (vector_length (level.friendly5.origin - $player.origin) < local.dist)
wait 0.4

level.friendly5 thread lookpastlow $pow_gun
wait 0.25
level.friendly5 turnto $pow_gun
level.friendly5 runto $pow_node
$interchair thread chairsolid
level.friendly5 waittill movedone
level.friendly5 turnto NULL
level.friendly5 upperanim pickup_obj
wait 0.5
level.friendly5 turnto $player
$pow_gun hide
println "01"
level.friendly5 gun "Mauser KAR 98D Sniper"
level.friendly5 playsound kar98sniper_snd_pickup
println "02"
level.friendly5 threatbias 0
println "03"
level.friendly5 exec global/enable_ai.scr
println "04"
level.friendly5 thread global/friendly.scr::friendlythink
level.friendly5 takedamage

// level.friendly5 item weapons/colt45.tik
println "05"

println "06"
level.friendly5.distance = 150
println "07"
// level.friendly5.leash = 150
println "08"
level.friendly5.no_idle = 0
// level.friendly5 tether $player
wait 2
if (isalive level.friendly5)
level.friendly5 lookat $player
println "09"

// thread lockdown 565
thread PUREfillused 565

println ("friendtype is " + level.friendly5.friendtype)

end




I want this to work for my map! (this script was takin from 1|2a script)
...prepare for your finest hour...
LT.BARNES
Major
Posts: 288
Joined: Mon Dec 30, 2002 4:37 pm
Location: london

Post by LT.BARNES »

i really would love to see wat the prob is so the german will do the animation i want him to do.
but he acts like a german u would jus place in your map.

i have this in my script above....

spawn human/German_afrika_private "targetname" "chairenemy"

but i have also added him myslef with the target name, cause the script don't spawn him for me. that might be a prob.

someone plz help..
...prepare for your finest hour...
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

No spawn

Post by tltrude »

Yeah, take out the ai guy u put in or you'll end up with two.

I'm not great at AI, but here is what I know. You have to name your bsp and script with the word "test" at the start of the name (there is a work around for that, but for now use it). You need this line at the top of the script:

exec global/ai.scr

There should be a trigger to spawn the actors and one to start the action. Good luck.
Tom Trude,

Image
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

using exec global ai is useless for that, for ai to perform certain anims the ai will need to be disabled anyway

the script doesn't spawn him? but your friendly5 chap does everything he's supposed 2? hmmm... remove the guard that you've created and it SHOULD work,

everything in the script seems to be good, but obviously something is amiss

1 thing i've just noticed :D
while (vector_length (level.friendly3.origin - $player.origin) < local.dist)
wait 0.4

level.friendly5 anim_noclip oss_getup
level.friendly5 waittill animdone
level.friendly5 lookat $player

/*
while (vector_length (level.friendly3.origin - $player.origin) < local.dist)
wait 0.4


in the while statments you have 3 instead of 5, that won't solve all ur problems but him following you won't happen properly
hope this helps, prob not cos it's all foreign 2 me :-/
LT.BARNES
Major
Posts: 288
Joined: Mon Dec 30, 2002 4:37 pm
Location: london

Post by LT.BARNES »

hmm... yea soz i fixed the friendly 5 and 3... so that is all ok.

i have global ai at the start.

i removed the german ai that i added.... but when i play the level the german doesn't appear and the friendly ai does his animation, but only once and finishes....

i think it might be something to do with my triggers.

wat triggers do i have to add to make it all work and the ai german ($chairenermy) to spawn and work??
...prepare for your finest hour...
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

do u have spearhead?

just a quick thought i have, but not sure if it'll make much difference...
hope this helps, prob not cos it's all foreign 2 me :-/
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

tag_german

Post by tltrude »

Oh, I see it is triggered by the player getting close to them. Anyway, the germans are spawned and then moved to this location:

local.o = $interchair gettagposition "tag_german"
local.a = $interchair gettagangles "tag_german"

I don't know what "tag_german" is, but it must be a script origin or the targetname of a chair or something. I think you are going to have to decompile the original map to find these things.
Tom Trude,

Image
LT.BARNES
Major
Posts: 288
Joined: Mon Dec 30, 2002 4:37 pm
Location: london

Post by LT.BARNES »

ok i have fixed all the lil errors i had like the friendly 3 and 5...they r all the same now..

the german spawns and he does his animation all fine!

BUT these r the probs i have.

1) the german that spawns is floating! why? it is like he is standin on somethin that aint there.

2) the german doesn't face my allied soldier!!?

plz help
...prepare for your finest hour...
LT.BARNES
Major
Posts: 288
Joined: Mon Dec 30, 2002 4:37 pm
Location: london

Post by LT.BARNES »

ok forget all above

i have it all workin....Well jus one thing i have a prob with......


My german and allie does the animation all right.
and the triggers all work.

the ONLY prob i have is....

1) the german FLOATS about head hight off the ground.
it looks like he is standing on like a clip which isn't there (and i didn't add)

2) and he isn't standing infront of the allie.

i have a script origin with targetname $interchair

and the angle is facing the allie, so the german faces the allie...

hmmmmm

HELP?
...prepare for your finest hour...
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

your chairenemy origin isn't needed, it's just a chair that's using that name, it's finding it's position to spawn from that however:

spawn human/German_afrika_private "targetname" "chairenemy"
$chairenemy.angles = $interchair.angles
$chairenemy exec global/disable_ai.scr
$chairenemy threatbias ignoreme
local.a2 = $chairenemy.angles
local.a2[1] = local.a2[1] + 180 // this line uses the
// array of the chairs positions, x=0,y=1,z=2 so you may find u'll need to
// add a couple of lines in the script and then remove them later... suchas

iprintlnbold $chairenemy.origin "find the 3rd angle -> the Z angle"
//then in your script add
// VVV only activate this line once you have your angle VVV
//local.a2[2] = local.a2[2] - *** //this number will be replaced by the value you found
// ^^^ only activate this line once you have your angle ^^^
$chairenemy.origin = local.o
$chairenemy.angles = local.a2
hope this helps, prob not cos it's all foreign 2 me :-/
LT.BARNES
Major
Posts: 288
Joined: Mon Dec 30, 2002 4:37 pm
Location: london

Post by LT.BARNES »

well i got the script straight from the 1|2a script used for the official game level... and if it works for that, then it should work for mine.

it must be somethin i done wrong in my map
...prepare for your finest hour...
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

it's the height of your script origin you made, changing what i said will sort that out though :D
hope this helps, prob not cos it's all foreign 2 me :-/
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

it could be that if the ai is floating that he is spawning too close to a model move him over a little bit and see it that helps
LT.BARNES
Major
Posts: 288
Joined: Mon Dec 30, 2002 4:37 pm
Location: london

Post by LT.BARNES »

ok nuggets i will go do my script the way u done it. (i don't get some of it....like the VVV bit)

bdbodger i can't move him ova abit cause he aint there..... u see he is only in the script. i done everything in the script like who the german is and targetname and his spawn... and that is all correct. it is jus he floats which is the prob.

i will get bk to u nuggets thanxs man
...prepare for your finest hour...
LT.BARNES
Major
Posts: 288
Joined: Mon Dec 30, 2002 4:37 pm
Location: london

Post by LT.BARNES »

forget the VVV bit i was being so dumb i know wat it is.

ok i am goin to add the bits u done nuggets to see if it works...

but i don't know how i will find angle z

anyone got or know where i can get the decompiler which changes bsp to map. fileplanet aint responding when i download it
...prepare for your finest hour...
Post Reply