dogs

Post your scripting questions / solutions here

Moderator: Moderators

goanyx
Private
Posts: 8
Joined: Wed Feb 12, 2003 10:15 pm
Location: belgium
Contact:

dogs

Post by goanyx »

i want to have 3 dogs in my SP map
what do i have to ad in the script ?
they should die and not respawn .

At this moment, the dogs can kill you , they don't bark ( no sound ) and if you kill the dogs the game returns to the main menu .

can someone help me with this ?
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

Roger that.
Live to map, not map to live.
-mohaa_rox, .map
moderator
Angex
Major
Posts: 293
Joined: Mon Dec 30, 2002 1:23 pm
Contact:

Post by Angex »

Try implementing them just like any other AI actor. Just follow the spawning enemy AI tutorial, but use AI->German->Hund->dog-real.

It might work.

As for no sound, if you're not using the "test" prefix, check your console for errors, it should highlight any problems with your TIKI.
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

I don't think with that the dog might charge at you. There's a tut over at MoH in a Bagel.
Live to map, not map to live.
-mohaa_rox, .map
moderator
goanyx
Private
Posts: 8
Joined: Wed Feb 12, 2003 10:15 pm
Location: belgium
Contact:

Post by goanyx »

tryed al those dogs
some attack
some don't
none of them bark
all of them make the level crash when you kill em

there has to be some script loaded i think but wich one ?

apart from that, the first levels of moh:x are ready and although my mapping sucks , i think i can say the AI is doing verry well

www.angelfire.com/rnb/goanyx/goanyx/screenshots.html for screenshots ( or screenshot.html forgot wich one )
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Image
goanyx
Private
Posts: 8
Joined: Wed Feb 12, 2003 10:15 pm
Location: belgium
Contact:

Post by goanyx »

this one is for mp's
but i ll try it for my SP level also

the other problem is the barking sound, what would i have to do ( someting with ubersound ? )
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

Don't make an ubersound.scr, make a tiki.
Live to map, not map to live.
-mohaa_rox, .map
moderator
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

See ubersound work-around in tutorials section. :wink:
Image
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

It helps a lot.
Live to map, not map to live.
-mohaa_rox, .map
moderator
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

dogs

Post by bdbodger »

this script works in mp I remove the dog before he dies to keep the server from crashing . It isn't perfect the dog uses player origins for spawn locations and if the player stays still too long can spawn inside player . spawning by coordinates would be better but I wanted a script that I could use in any map . inspired by an early ver of the fifi script I haven't seen that script lately so don't know how it is now , may be better or worse don't know . the dog makes a bee line for the player works in maps with no pathnodes like the mohaa mp maps . I have a tiki that I use to add the dog sounds look in this forum for the ubersounds work around .
or I can send it to you . bdbodger@hotmail.com


//////////////////////////////////////////////////////////////////////////

dog_spawn:

wait 30
thread scriptorg

if ($dog1.size < 1)
{
spawn models/animal/german_shepherd "targetname" ("dog1")"type_idle" "dog_idle" "type_attack" "dog_attack"

// Set the AI properties

//switch ((randomint 4)+1)
//{
//case 1:
// $dog1.origin = ( -977.48 -1404.28 -39.99) //place the dog in the correct spot by coordinates
// break
//case 2:
// $dog1.origin = ( -3368.60 -1562.27 -28.57)
// break
//case 3:
// $dog1.origin = ( -2447.87 -471.22 16.13)
// break
//case 4:
// $dog1.origin = ( -1631.67 1408.06 70.65)
// break
//
// }
$dog1.origin =level.dogorigin // replaced dog origin routine for this
$dog1.mindist = 128
$dog1.maxdist = 512
$dog1.leash = 24096
$dog1.fixedleash = 0
$dog1.sight = 1000
$dog1.health = 1000
$dog1.noticescale = 4000
$dog1.enemysharerange = 2048
$dog1.hearing = 4000
//$dog1.enemy = $player
$dog1 immune explosion
$dog1 immune grenade

level.dogalive = 1

$dog1 thread doginit
$dog1 thread dog_death

iprintln "********* acktun H?ir gunt?r hund *********"
}

end
//////////////////////////////////////////////////////////////////////////

doginit:
self forceactivate
wait 5
while ( isalive self )
{
if ( level.dogalive != 1)
break

println ("dog is at " + self.origin + " with thinkstate " + self.thinkstate + " and health " + self.health )
println ("self normal health " + self.normal_health )

switch (self.thinkstate)
{
attack:
waitthread dog_run
break
curious:
waitthread dog_curious
break
pain:
waitthread dog_pain
break
idle:
waitthread dog_idle
break
default:
waitthread dog_idle
break
}

wait 2

}
println "loop broken"
end
////////////////////////////////////////////////////////////////////////////////

dog_pain:

while (self.thinkstate == "pain")
{
println "dog felt pain"
switch (( randomint 3)+1)
{
case 1:
self.blendtime = 0.25
self setmotionanim dog_pain_head
self waittill flaggedanimdone
break
case 2:
self.blendtime = 0.25
self setmotionanim dog_pain_front
self waittill flaggedanimdone
break
case 3:
self.blendtime = 0.25
self setmotionanim dog_pain_back
self waittill flaggedanimdone
break
}
wait .5
}
end
///////////////////////////////////////////////////////////////////////////////////

dog_curious:
while (self.thinkstate == "curious")
{
self setmotionanim dog_stand_curious
self waittill flaggedanimdone

self.blendtime = 0.25
self setmotionanim dog_bark
self waittill flaggedanimdone

self.blendtime = 0.25
self setmotionanim dog_bark
self waittill flaggedanimdone

self.blendtime = 0.25
self setmotionanim dog_bark
self waittill flaggedanimdone
}
end
//////////////////////////////////////////////////////////////////////////////////

dog_idle:
while (self.thinkstate == "idle")
{
switch ((randomint 10)+1)
{
case 1:
self.blendtime = 0.25
self setmotionanim dog_rest
self waittill flaggedanimdone
self.blendtime = 0.25
self setmotionanim dog_standup
self waittill flaggedanimdone
break
case 2:
self.blendtime = 0.25
self setmotionanim dog_stand_idle
self waittill flaggedanimdone
break
case 3:
self.blendtime = 0.25
self setmotionanim dog_sniff
self waittill flaggedanimdone
break
case 4:
self.blendtime = 0.25
self setmotionanim dog_sniff_turn_left
self waittill flaggedanimdone
break
case 5:
self.blendtime = 0.25
self setmotionanim dog_sniff_turn_right
self waittill flaggedanimdone
break
case 6:
self.blendtime = 0.25
self setmotionanim dog_stand_turn_right
self waittill flaggedanimdone
break
case 7:
self.blendtime = 0.25
self setmotionanim dog_stand_turn_left
self waittill flaggedanimdone
break
case 8:
self.blendtime = 0.25
self setmotionanim dog_walk_bored
self waittill flaggedanimdone
break
case 9:
self.blendtime = 0.25
self setmotionanim dog_walk_turn_right
self waittill flaggedanimdone
break
case 10:
self.blendtime = 0.25
self setmotionanim dog_walk_turn_left
self waittill flaggedanimdone
break
}

self.blendtime = 0.25
self setmotionanim dog_bark
self waittill flaggedanimdone

self.blendtime = 0.25
self setmotionanim dog_bark
self waittill flaggedanimdone

self.blendtime = 0.25
self setmotionanim dog_bark
self waittill flaggedanimdone
}
end
/////////////////////////////////////////////////////////////////////////

dog_run:
while (self.thinkstate == "attack" )
{
self setmotionanim dog_run
wait .3
if ( self istouching self.enemy )
{
thread dog_bite
break
}
}

end
/////////////////////////////////////////////////////////////////////////////

dog_bite:
switch ((randomint 2)+1)
{
case 1:
self.blendtime = 0.25
self setmotionanim dog_bite_leg
self waittill flaggedanimdone
break
case 2:
self.blendtime = 0.25
self setmotionanim dog_bite_face
self waittill flaggedanimdone
break

}

wait .1

//bite enemy

iprintln "dog is attacking"

//local . dir = $player . origin - self . origin;
local . dir = (self.enemy). origin - self . origin;
self.enemy damage self 15 self (0 0 0) local . dir (0 0 0) 1 9 0 0;// 15 was 75
//}
end
/////////////////////////////////////////////////////////////////////////

dog_death:
while (1)
{
if ( self.normal_health <= 50 ) // have to remove dog before he dies or server crashes
{

iprintln " dog has been killed "

self notsolid

level.dogalive = 0

self setmotionanim dog_death_run

self waittill flaggedanimdone

self delete
break
}
wait .1
}
wait 20
thread dog_spawn
end
///////////////////////////////////////////////////////////////////////////////

//spawn scipt origin

scriptorg:

level.dogorigin = spawn script_origin

while(1)
{
if ( $player.size > 1 )
local.p = randomint (($player.size ) + 1 )
else
local.p = 1

while (local.p == 0)
local.p = randomint (($player.size ) + 1 )

println (" number of players " + $player.size)
println (" random player is player " + local.p)

level.dogorigin.origin = $player[local.p].origin

println ( " origin position is " + (level.dogorigin.origin))

wait 60

}

end
Belsen
Private
Posts: 2
Joined: Mon Mar 03, 2003 8:32 pm
Location: Sydney(AUSTRALIA)
Contact:

Post by Belsen »

I think snowcamp needs dog bots all camp maps in multiplayer please guys :D
Geficht i own u!
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

ok I found out why the game crashes with dogs . what i did was run $dog1 exec anim/dog_inihandler.scr which reads

// dog_inithandler.scr

self.painhandler = anim/dog_pain.scr

self.deathhandler = anim/dog_killed.scr

I put that in a map and dog died ok no problem

I guess you could just put those two lines in your script self being the targetname of your dog
goanyx
Private
Posts: 8
Joined: Wed Feb 12, 2003 10:15 pm
Location: belgium
Contact:

Post by goanyx »

tnx
at least one wich is for SP :-)
king_of_hi_ping
Corporal
Posts: 30
Joined: Wed Feb 05, 2003 7:17 pm

need help

Post by king_of_hi_ping »

this is a great script ... and i got it working on our server... but after a day it just froze up ..

it still works on my own machine but the server dog died..

if you shoot at him he begins to move or should i say switch postitions.. then freezes again... also the sound in console goes crazy.. playing everyting at one time...

the only errors i get when he first spawns is this in regards to the dog.
Script Error: unknown animation 'dog_walk_turn_left' in 'models/animal/german_shepherd.tik'

and also two more.. but i dont know if they are dog related

^~^~^ Script Error: Cannot cast 'NIL' to vector


also i did make a new tiki for sound but it is not working .. whats yours look like??
Post Reply