UGX-Mods

Call of Duty 5: World at War => Help Desk => Scripting => Topic started by: nikfar1 on July 28, 2018, 08:24:24 pm

Title: spawn boss from specific place
Post by: nikfar1 on July 28, 2018, 08:24:24 pm
hi
I have a boss zombie in my map and I want to spawn from specific point(rise from well)
in this script the boss spawn from every riser zombie near to player

spawn script code:

Code Snippet
Plaintext
lionBoss_init()
{

preCacheModel ("lion_b");

if (isdefined(level.lion_next) ) return;
else
{
    lion_trig = getEnt("lion_trig1", "targetname");
lion_trig sethintstring("Press &&1 to spawn");
    lion_trig waittill("trigger");
wait(.4);
lion_trig delete();

wait 1;
spawn_point = undefined; use_spawn_point = undefined;
teh_spawns = undefined;
level.lion_next = 0;
while(true)   
{
while(isdefined(level.doground_nomusic) && level.doground_nomusic == 1) wait 5;
for(am=0;am<50;am++)
{
wait .05;
teh_spawns = level.enemy_spawns;
for(t=0;t<teh_spawns.size;t++)
{
wait .05;
use_spawn_point = teh_spawns[t]; spawn points from riser
if (use_spawn_point.script_noteworthy == "find_flesh") break; // Assure its a riser spawn before continuing
}
spawn_points = GetStructArray("find_flesh","script_noteworthy");
spawn_point = spawn_points[0];
// if (isdefined(spawn_point)) iprintln(spawn_point.origin);
else iprintln("^1NO SPAWN POINT FOUND");
if (spawn_point inMap() && isdefined(spawn_point) ) { break; }
}

ai = spawn_zombie( use_spawn_point );
wait .05;
ai forceTeleport(spawn_point.origin);
ai.boss_enemy = true;
wait .05;
ai DetachAll(); ai attach("char_ger_ansel_head_zomb", "", true);
ai setModel("lion_b");
ai.health = level.zombie_health+randomintrange(6500,8550); wait .05; ai.lion_max_health = ai.health;
if (randomint(100) < 50) ai thread lionBoss_forcewalk(); else ai thread lionBoss_forcewalk(true);
if (randomInt(100) < 50) level.lion_next = 1; else { if (randomInt(100) < 50) level.lion_next = 2; else level.lion_next = 0; }
while(isdefined(ai) ) wait 1;
}
}
}

how to spawn it from one point?
Title: Re: spawn boss from specific place
Post by: codmoddd1234 on July 28, 2018, 11:57:15 pm
If you only need 1 struct for the boss you can add a kvp on a working riser struct
"script_personality" "nikfarboss"
Then in gsc you can use
getstruct("script_personality","nikfarboss");

If you want multiple boss structs then use getstructarray and pick a random single struct from the array.
Title: Re: spawn boss from specific place
Post by: nikfar1 on July 29, 2018, 05:51:45 pm
thanks a lot codmoddd1234
I changed this line as you said:
Code Snippet
Plaintext
spawn_points = GetStructArray("find_flesh","script_noteworthy");
to this:

Code Snippet
Plaintext
spawn_points = GetStructArray("nikfarboss","script_personality");

and the boss spawned from this point but 15 second after activating him.
this lag of time for spawning happens after change this line
why this Delay happened?
Title: Re: spawn boss from specific place
Post by: codmoddd1234 on July 29, 2018, 06:54:42 pm
Probably this.

for(t=0;t<teh_spawns.size;t++)
{
wait .05;

You dont need to sort the all the spawns now. Just get the struct and then spawn the ai.
There is also wait 4; after the trigger is used.
Title: Re: spawn boss from specific place
Post by: nikfar1 on July 29, 2018, 08:00:40 pm
thanks for your help
I changed "50" in this line to 2 and time fixed.  (for(am=0;am<2;am++)
but my first problem repaet again and the boss spawned from another place( this is not related to time problem). :'(
and changing  this line was useless.( spawn_points = GetStructArray("nikfarboss","script_personality");  )
I still have spawning from everywhere..
please     h     e      l     p


Spoiler: click to open...
sorry I thought my first problem was fixed

Title: Re: spawn boss from specific place
Post by: codmoddd1234 on July 29, 2018, 09:31:14 pm
if you are using a regular zombie spawner and then changing the model it probably still uses "add_spawn_function" to "zombie_rise" from zombiemode_spawner.gsc
//
Ill post a working solution when im home but if you want to try yourself then check in zombiemode_spawner do_zombie_rise() find where the script selects a random spot, check if self is the lion guy, and pick your new spot.
Title: Re: spawn boss from specific place
Post by: nikfar1 on July 30, 2018, 06:23:19 am
Thank you for your all help.I am not home.I ll test it later.