Post your scripting questions / solutions here
Moderator: Moderators
blue60007
General
Posts: 1247 Joined: Sun Mar 07, 2004 11:44 pm
Post
by blue60007 » Wed Apr 21, 2004 1:57 am
OK I have 4 ai that I want to spawn, run to a pathnode and then fire. Now I can do that with the targetname enemyspawner, but I need to to check if they are alive in the script, and since that is everyone elses name, that won't work. I've got them set up like normal, connected to a pathnode and all and key/values of:
#set 1400
targetname assault1
and then in my scprit:
Code: Select all
thread global/ai.scr::spawnset 1400 assault1
and that is called by a trigger.
If I can't do it that way, how can I do it so i can still check if they are alive? I may need to do each seperate though, but at least get them spawning first.
Thanks!
kai0ty
Brigadier General
Posts: 507 Joined: Fri Mar 19, 2004 1:45 am
Post
by kai0ty » Wed Apr 21, 2004 2:50 am
did u try the isalive command?
There are only 10 kinds of people in this world; those who know what binary is, and those who don't.
bdbodger
Moderator
Posts: 2596 Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:
Post
by bdbodger » Wed Apr 21, 2004 5:40 am
I am not home now so can't check but I think you can use the key enemy and set it to the targetname you want the ai to have after it is spawned then you can use that . also I think that the global/ai.scr sets level.totalbaddies to the number of alive enemyspawners .
blue60007
General
Posts: 1247 Joined: Sun Mar 07, 2004 11:44 pm
Post
by blue60007 » Wed Apr 21, 2004 10:15 pm
um did you mean using a key/value of enemy/assault1 -->that my targetname I want...?
and that is what I want to do kai0ty, but doing:
Code: Select all
if !(isAlive $enemyspawner)
{
//blah
}
obvisouly wouldn't work...
blue60007
General
Posts: 1247 Joined: Sun Mar 07, 2004 11:44 pm
Post
by blue60007 » Thu Apr 22, 2004 1:05 am
OK folks I have my guys spawning like in m6l3a (the snipers) like so: (it works btw)
Code: Select all
messhallmg42_trigger:
iprintln "The mess hall assault begins!!"
goto assault1
end
thread assault1adie
thread assault1bdie
thread assault1cdie
thread assault1ddie
thread newroundcheck
thread assault1
assault1:
level.messhalldeaths = 0
$assault1a thread assault1adie
$assault1a exec global/disable_ai.scr
$assault1a exec global/runto.scr $t37
$assault1a waittill movedone
$assault1a exec global/enable_ai.scr
$assault1b thread assault1bdie
$assault1b exec global/disable_ai.scr
$assault1b exec global/runto.scr $t38
$assault1b waittill movedone
$assault1b exec global/enable_ai.scr
$assault1c thread assault1cdie
$assault1c exec global/disable_ai.scr
$assault1c exec global/runto.scr $t36
$assault1c waittill movedone
$assault1c exec global/enable_ai.scr
$assault1d thread assault1ddie
$assault1d exec global/disable_ai.scr
$assault1d exec global/runto.scr $t35
$assault1d waittill movedone
$assault1d exec global/enable_ai.scr
goto newroundcheck
end
assault1adie:
self waittill death
iprintln "Assault1a died!"
level.messhalldeaths++
iprintln "There are: "(level.messhalldeaths)" deaths in the mess hall"
end
assault1bdie:
self waittill death
iprintln "Assault1b died!"
level.messhalldeaths++
iprintln "There are: "(level.messhalldeaths)" deaths in the mess hall"
end
assault1cdie:
self waittill death
iprintln "Assault1c died!"
level.messhalldeaths++
iprintln "There are: "(level.messhalldeaths)" deaths in the mess hall"
end
assault1ddie:
self waittill death
iprintln "Assault1d died!"
level.messhalldeaths++
iprintln "There are: "(level.messhalldeaths)" deaths in the mess hall"
end
newroundcheck:
thread spawnnewround
if (level.messhalldeaths == 4)
{
iprintln "Time for a new round!"
goto spawnnewround
}
else
{
goto newroundcheck
}
spawnnewround:
iprintln "New round spawning!"
end
Now as you can see at the bottom I need to respawn these guys.
Should I spawn them like:
Code: Select all
spawn models/human/german_panzer_obershutze"targetname" "assault2a" "type_attack" "turret"
$assault2a.origin = $assault1a.origin
then put that:
Code: Select all
assault2:
level.messhalldeaths = 0
$assault2a thread assault2adie
$assault2a exec global/disable_ai.scr
$assault2a exec global/runto.scr $t37
$assault2a waittill movedone
$assault2a exec global/enable_ai.scr
//blah blah, rest of the ai move/spawn, death checks, and goto newroundspawn yada yada yada...
I would have to do all that 9 more times, to get the 10 waves of ai I want...
I know that
should work, but it won't be effecient. Is there a more effecient way?
blue60007
General
Posts: 1247 Joined: Sun Mar 07, 2004 11:44 pm
Post
by blue60007 » Thu Apr 22, 2004 1:40 am
EDITED:
Code: Select all
messhallmg42_trigger:
iprintln "The mess hall assault begins!!"
goto assault1
end
thread assault1adie
thread assault1bdie
thread assault1cdie
thread assault1ddie
thread newroundcheck
thread assault1
assault1:
level.messhalldeaths = 0
$assault1a thread assault1adie
$assault1a exec global/disable_ai.scr
$assault1a exec global/runto.scr $t37
$assault1a waittill movedone
$assault1a exec global/enable_ai.scr
$assault1b thread assault1bdie
$assault1b exec global/disable_ai.scr
$assault1b exec global/runto.scr $t38
$assault1b waittill movedone
$assault1b exec global/enable_ai.scr
$assault1c thread assault1cdie
$assault1c exec global/disable_ai.scr
$assault1c exec global/runto.scr $t36
$assault1c waittill movedone
$assault1c exec global/enable_ai.scr
$assault1d thread assault1ddie
$assault1d exec global/disable_ai.scr
$assault1d exec global/runto.scr $t35
$assault1d waittill movedone
$assault1d exec global/enable_ai.scr
goto newroundcheck
end
assault1adie:
self waittill death
iprintln "Assault1a died!"
level.messhalldeaths++
iprintln "There are: "(level.messhalldeaths)" deaths in the mess hall"
end
assault1bdie:
self waittill death
iprintln "Assault1b died!"
level.messhalldeaths++
iprintln "There are: "(level.messhalldeaths)" deaths in the mess hall"
end
assault1cdie:
self waittill death
iprintln "Assault1c died!"
level.messhalldeaths++
iprintln "There are: "(level.messhalldeaths)" deaths in the mess hall"
end
assault1ddie:
self waittill death
iprintln "Assault1d died!"
level.messhalldeaths++
iprintln "There are: "(level.messhalldeaths)" deaths in the mess hall"
end
newroundcheck:
thread spawnnewround
while (level.messhalldeaths >= 4)
{
iprintln "Time for a new round!"
goto spawnnewround
end
}
spawnnewround:
iprintln "New round spawning!"
goto assault2
end
//-------------------------ROUND 2---------------------------------------ROUND 2--------------------------------------
thread newroundcheck2
thread assault2
assault2:
level.messhalldeaths2 = 0
spawn models/human/german_panzer_obershutze "targetname" "assault2a" "type_attack" "turret" "gun" "Panzerschrek"
$assault2a.origin = $assaultspawnera.origin
$assault2a thread assault2adie
$assault2a exec global/disable_ai.scr
$assault2a exec global/runto.scr $t37
$assault2a waittill movedone
$assault2a exec global/enable_ai.scr
spawn models/human/german_panzer_obershutze "targetname" "assault2b" "type_attack" "turret" "gun" "Panzerschrek"
$assault2b.origin = $assaultspawnerb.origin
$assault2b thread assault2bdie
$assault2b exec global/disable_ai.scr
$assault2b exec global/runto.scr $t38
$assault2b waittill movedone
$assault2b exec global/enable_ai.scr
spawn models/human/german_panzer_obershutze "targetname" "assault2c" "type_attack" "turret" "gun" "StG44"
$assault2c.origin = $assaultspawnerc.origin
$assault2c thread assault2cdie
$assault2c exec global/disable_ai.scr
$assault2c exec global/runto.scr $t36
$assault2c waittill movedone
$assault2c exec global/enable_ai.scr
spawn models/human/german_panzer_obershutze "targetname" "assault2d" "type_attack" "turret" "gun" "StG44"
$assault2d.origin = $assaultspawnerd.origin
$assault2d thread assault2ddie
$assault2d exec global/disable_ai.scr
$assault2d exec global/runto.scr $t35
$assault2d waittill movedone
$assault2d exec global/enable_ai.scr
goto newroundcheck2
end
assault2adie:
self waittill death
iprintln "Assault2a died!"
level.messhalldeaths2++
iprintln "There are: "(level.messhalldeaths2)" deaths in the mess hall"
end
assault2bdie:
self waittill death
iprintln "Assault2b died!"
level.messhalldeaths2++
iprintln "There are: "(level.messhalldeaths2)" deaths in the mess hall"
end
assault2cdie:
self waittill death
iprintln "Assault2c died!"
level.messhalldeath2s++
iprintln "There are: "(level.messhalldeaths2)" deaths in the mess hall"
end
assault2ddie:
self waittill death
iprintln "Assault2d died!"
level.messhalldeaths2++
iprintln "There are: "(level.messhalldeaths2)" deaths in the mess hall"
end
newroundcheck2:
thread spawnnewround2
while (level.messhalldeaths2 == 4)
{
iprintln "Time for a new round!"
goto spawnnewround2
end
}
spawnnewround2:
iprintln "New round spawning!"
end
That works not too shabby!
Now I'll need to copy it over 8 times to acheive 10 rounds! Thanks!