ohhh yes the famous dog script

please keep scripting in here only

Moderators: Q-dad~TAG, EXP STAFF, Moderator

ohhh yes the famous dog script

Postby loa » 01-06-2007 01:21 PM

now this is a sweet script and i can not take full credit for it.. credits to HkySk8r187 and Vonderbakluft for helping me figure this mess out.


// map name LoA_New Town
// mapped by Life Of Agony AkA LoA
// Scripted Life
// FiFi scripted by Vonderbakluft
// AI Obj scripted by HkySk8r187 visit http://www.3dchad.com


////////////////////////////////////////////////
//THE FOLLOWING IS FOR THE OPERATION OF THE DOG!
////////////////////////////////////////////////
fifisetup:
thread fifi-triggersetup
level.spawneddogs = 0
level.aggressive = 0
if ($dogpos == NULL)
{
level.dogposs = 0
println "*** ERROR no spawnpoints - "
println "Make spawnpoints with script_origins"
println "with $targetname/dogpos"
}
else
{
level.dogposs = $dogpos.size
}

if (level.dogposs > 0)
{
level.dogpos = exec global/makearray.scr $dogpos
}
//local.origin1 = (0 80 17)
println " fifi inititialized"
while (1)
//iprintlnbold "fifi setup while-loop"
{
println "fifi idle loop "
if (level.spawneddogs < 1)
{
level.aggressive = 0
if ( randomint (20) < 1)
{
iprintlnbold " "
level.fifihungry = 1
}
//iprintlnbold "No fifi's - now spawning"
wait 5
local.ent = spawn animal/german_shepherd.tik "targetname" "spawned_dog"
local.r = randomint ($dogpos.size) + 1
println "local.r=" local.r
local.ent.origin = ($dogpos[local.r].origin)
local.ent.angle = ($dogpos[local.r].angle)

local.ent.health = 200
local.ent.sound_awareness = 100
local.ent.noticescale = 50
local.ent.fov = 180
local.ent.hearing = 1600
local.ent.accuracy = 100
local.ent.sight = 4000
local.ent.leash = 10000
if (level.fifihungry == 1)
local.ent.health += 100
level.spawneddogs++
level.dog = local.ent
//iprintlnbold level.dog
println "fifi spawned waiting for victim - still in mainloop sapwnddogs>0"

println "Fifi spawned - triggered victim = " local.victim.origin
println "Fifi spawned waiting for trigger - subloop halted"
local.ent thread fifi-die

//$fifitrigger waittill trigger
//println "Fifi spawned - triggered"


//println "Fifi awake - triggered victim = " local.victim.origin
//local.ent thread fifi-attack



}
wait 15
}
end

fifi-triggersetup:
for (local.i = 1 ; local.i <fifitrigger> 0 && level.aggressive < 1 )
{
//iprintlnbold "triggered aggressive"
level.dog thread fifi-attack
}
wait 15
}
end

fifi-attack:
level.aggressive = 1
self.enemy = parm.other
self forceactivate
while (isalive self)
{


self thread fifi-bite

wait .1

}
end

fifi-die:
println "deadthread waiting..."
self waittill death
//iprintlnbold "fifi died aggressive = 0 "
level.aggressive = 0
level.spawneddogs--
println "Fifi died - spawnddog should be zero"
wait 5
self delete
println "Dead Fifi removed from thread"

end

fifi-bite:

if (isalive self.enemy == 1)
{

if ( self istouching self.enemy == 1)

//bite!!
{

self setmotionanim dog_bite_leg
if ( self . enemy != $player )
{

self.enemy damage self 75 self (0 0 0) (0 0 0) (0 0 0) 1 9 0 0;
self.enemy damage $world 75 $world (0 0 0) (0 0 0) (0 0 0) 1 24 24 0;

self.health += 15
}
else
{
local . dir = $player . origin - self . origin;
if (level.fifihungry == 1)
{
//EXTRA STRONG !!:-)
self.enemy damage self.enemy 140 $world (0 0 0) local . dir (0 0 0) 1 2 0 0;
}
else
{
self.enemy damage self.enemy 75 $world (0 0 0) local . dir (0 0 0) 1 2 0 0;
}

//fifi eated some of your meat and will become stronger
self.health += 15
}

self waittill flaggedanimdone

}
else
{
//chase enemy
self setmotionanim dog_run
self waittill flaggedanimdone
}

}
end
////////////////////////////////////////////////
//END OF DOG OPERATIONS!------------------------
////////////////////////////////////////////////
User avatar
loa
Administrator
 
Posts: 1133
Joined: 03-06-2004 01:54 PM

Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron