ENEMY SPAWNING

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
UBER_SOLDAT
Warrant Officer
Posts: 127
Joined: Wed Aug 07, 2002 7:44 pm
Location: ENGLAND
Contact:

ENEMY SPAWNING

Post by UBER_SOLDAT »

http://www.modtheater.com/forum/showthr ... eadid=1175

i posted the same thing on TMT but no one knows the answer. Ive put the script and part of the .map file there. Can someone please help me with this problem. Its the last thing i need to complete this map.
Mirek
Colour Sergeant
Posts: 77
Joined: Mon Jul 08, 2002 2:12 am
Location: Melbourne, Australia
Contact:

Post by Mirek »

Uber_Soldat,

I had a look at your files and the reason why it won't work is due to some script errors which are in the AI spawning section -
original lines in green, the fix in yellow.




//*** Spawn 3 enemy soldiers in a wave

spawn models/human/german_waffenss_nco "targetname" (local.enemy_charge_ai_name1) "type_attack" "cover"

$(local.enemy_charge_ai_name1).origin = local.org1 //place the guy in the correct spot
level.enemy_charge_currentalive ++ //increment the max allowed alive at any given time
level.enemy_charge_teamvalue ++ //track the scene's enemy population
$(local.enemy_charge_ai_name1) thread enemy_charge_detect_death //call a waittill death thread
$(local.enemy_charge_ai_name1) thread enemy_charge_ai_navigate1 //call navigation thread

$(local.enemy_charge_ai_name1).mindist = 128
$(local.enemy_charge_ai_name1).maxdist = 1800
$(local.enemy_charge_ai_name1).leash = 10000
$(local.enemy_charge_ai_name1).fixedleash = 0
$(local.enemy_charge_ai_name1).sight = 4000
$(local.enemy_charge_ai_name1).noticescale = 1


$(local.enemy_charge_ai_name1).hearing = 4000
$(local.enemy_charge_ai_name1).interval = 256
$(local.enemy_charge_ai_name1) gun "MP40"

$(local.enemy_charge_ai_name1) dontdropweapons


//---------------------------------------------------------------------------------------------------------


spawn models/human/german_waffenss_shutze "targetname" (local.scene3_spawn1_ai_name2) "type_attack" "cover"

should be - spawn models/human/german_waffenss_shutze "targetname" (local.enemy_charge_ai_name2) "type_attack" "cover"

$(local.enemy_charge_ai_name2).origin = local.org2 //place the guy in the correct spot
level.enemy_charge_currentalive ++ //increment the max allowed alive at any given time
level.enemy_charge_teamvalue ++
$(local.enemy_charge_ai_name2) thread scene3_spawn1_detect_death //call a waittill death thread
$(local.enemy_charge_ai_name2) thread scene3_spawn1_ai_navigate2 //call navigation thread


should be - $(local.enemy_charge_ai_name2) thread enemy_charge_detect_death //call a waittill death thread
$(local.enemy_charge_ai_name2) enemy_charge_ai_navigate2 //call navigation thread


$(local.enemy_charge_ai_name2) gun "mp40"

$(local.enemy_charge_ai_name2).mindist = 128
$(local.enemy_charge_ai_name2).maxdist = 1800
$(local.enemy_charge_ai_name2).leash = 10000
$(local.enemy_charge_ai_name2).fixedleash = 0
$(local.enemy_charge_ai_name2).sight = 4000
$(local.enemy_charge_ai_name2).noticescale = 1


$(local.enemy_charge_ai_name2).hearing = 4000
$(local.enemy_charge_ai_name2).interval = 256
$(local.enemy_charge_ai_name2).ammo_grenade = 2

$(local.enemy_charge_ai_name2) dontdropweapons


//-----------------------------------------------------------------------------------------------------------


spawn models/human/german_waffenss_shutze "targetname" (local.enemy_charge_ai_name3) "type_attack" "cover"

$(local.enemy_charge_ai_name3).origin = local.org3 //place the guy in the correct spot
level.enemy_charge_currentalive ++ //increment the max allowed alive at any given time
level.enemy_charge_teamvalue ++

and also local. is missing below -
$(local.enemy_charge_ai_name3) thread enemy_charge_detect_death //call a waittill death thread
$(local.enemy_charge_ai_name3) thread enemy_charge_ai_navigate3 //call navigation thread

$(local.enemy_charge_ai_name3).mindist = 128
$(local.enemy_charge_ai_name3).maxdist = 1800
$(local.enemy_charge_ai_name3).leash = 10000
$(local.enemy_charge_ai_name3).fixedleash = 0
$(local.enemy_charge_ai_name3).sight = 4000
$(local.enemy_charge_ai_name3).noticescale = 1


$(local.enemy_charge_ai_name3).hearing = 4000
$(local.enemy_charge_ai_name3).interval = 256
$(local.enemy_charge_ai_name3).ammo_grenade = 2

// centerprint(enemy_charge_currentalive + "<" + level.enemy_charge_currentalivemax + "\n" + level.enemy_charge_deactivator + "=" + level.enemy_charge_deactivator+ "\n" + level.enemy_charge_teamvalue + "<" + level.enemy_charge_teamlimitmax )

}

wait local.loopwaittime //every local.loopwaittime seconds, resume the while loop
}

wait local.loopwaittime //prevent infinite loop warning
goto enemy_charge1

end

//============================================================//

So what was happenning to your script is that enemy2 was getting the wrong targetname thus the rest of that section was ineffective including the death thread. All this effected your currentalive number and messed up the spawnning as the number was too high after the second spawn since enemy2 did not register death.


Also if I can just make a note about the paths. I think u will find it hard to make them run their paths without the disable_ai.scr, which turns off enemy awarness.


anyway, it all worked fine here. I compiled your map and tested it with the changes. Let me know if you have a problem and I'll post it.

Also let me know when your done, the map looks great.

Hope it helps you out,
Mirek
Mapping !!! Who needs sleep anyway !?!?!?
Mirek
Colour Sergeant
Posts: 77
Joined: Mon Jul 08, 2002 2:12 am
Location: Melbourne, Australia
Contact:

Post by Mirek »

hey UBER_SOLDAT,

Did that work for you or am I full of shit ???
Mapping !!! Who needs sleep anyway !?!?!?
UBER_SOLDAT
Warrant Officer
Posts: 127
Joined: Wed Aug 07, 2002 7:44 pm
Location: ENGLAND
Contact:

Post by UBER_SOLDAT »

yes it did. i only just tried it the other day. thanks for the help. now i can finish this map when i have enough time, aswell as my other SP map and some new weapons
Post Reply