Author |
Topic: Allied AI Invinsibility |
|
Category: CoD4 SP Mapping Posted: Monday, Sep. 3, 2012 10:29 am |
|
I have read the specific tut ( http://modsonline.com/Tutorials-read-616.html ) (Go to the part that says for infinite health) and i did everything it said and i still cant get my allies not dying
Does anyone know an easy and effective way of doing it? |
|
|
|
3st0nian |
|
General Member Since: Jan 14, 2008 Posts: 291 Last: Dec 4, 2017 [view latest posts] |
|
|
|
Category: CoD4 SP Mapping Posted: Monday, Sep. 3, 2012 11:34 am |
|
Should be something like this:
Code: ally_nodamage() //If you spawn them via script
{
allyteam =getentarray ("ally", "targetname");//Gets only static spawner entities
friends = [];//Creates empty array
for(i=0; i<allyteam.size; i++)
{
friends[i] = allyteam[i] doSpawn();//Spawns actor
friends[i] thread maps\_utility::magic_bullet_shield();//Then actor is given magic shield
}
}
OR if you want to spawn them via a trigger, put this line somewhere in you main function, but after the maps\_load::main():
(Updated this part, it had an error)
Code: array_thread( getentarray( "ally", "targetname" ), ::add_spawn_function, ::magic_bullet_shield);
http://modsonline.com/Forums-top-160826.html
edited on Sep. 4, 2012 06:22 am by 3st0nian
edited on Sep. 4, 2012 06:24 am by 3st0nian |
|
|
|
|
Category: CoD4 SP Mapping Posted: Tuesday, Sep. 4, 2012 12:17 pm |
|
i used the 2nd way as they spawn via trigger ( 6 allies) and i want them to have different targetname and also have invincibility.
I did this in my gsc.(i dont show the rest so you wont be confused)
after the maps/load main
Code:
{
maps\_load::main();
array_thread( getentarray( "Alex", "targetname" ), ::add_spawn_function, ::magic_bullet_shield());
array_thread( getentarray( "Pan", "targetname" ), ::add_spawn_function, ::magic_bullet_shield());
array_thread( getentarray( "Jami", "targetname" ), ::add_spawn_function, ::magic_bullet_shield());
array_thread( getentarray( "Loz", "targetname" ), ::add_spawn_function, ::magic_bullet_shield());
array_thread( getentarray( "SV", "targetname" ), ::add_spawn_function, ::magic_bullet_shield());
array_thread( getentarray( "AV", "targetname" ), ::add_spawn_function, ::magic_bullet_shield());
thread ally_nodamage();
}
ally_nodamage()
{
self thread maps\_utility::magic_bullet_shield();
}
resize the window if you have to.
I get an error in this. in the from the first (with Alex NOT the "{" )
edited on Sep. 4, 2012 05:17 am by SPi |
|
|
|
3st0nian |
|
General Member Since: Jan 14, 2008 Posts: 291 Last: Dec 4, 2017 [view latest posts] |
|
|
|
Category: CoD4 SP Mapping Posted: Tuesday, Sep. 4, 2012 12:30 pm |
|
What exactly does the error say?
With the second way, you actually dont need the function ally_nodamage(); (that was my mistake).
And try this:
Code: getent( "Alex", "targetname" ) thread add_spawn_function( ::magic_bullet_shield ); |
|
|
|
|
Category: CoD4 SP Mapping Posted: Wednesday, Sep. 5, 2012 07:22 am |
|
attachment: image(60.5Kb) |
I get the same error with this code too
(getent is used for more than 1 entity)
the error is uploaded as a photo.
I used just alex to test it. becoyse i thought it would be faster to check just 1 character.
Anyway in the end ill need all 6 characters to be invinsible.
|
|
|
|
3st0nian |
|
General Member Since: Jan 14, 2008 Posts: 291 Last: Dec 4, 2017 [view latest posts] |
|
|
|
Category: CoD4 SP Mapping Posted: Wednesday, Sep. 5, 2012 07:34 am |
|
If you have only one spawner with given key/value, you must use
Code: getent( "Alex", "targetname" ) thread add_spawn_function( ::magic_bullet_shield );
If you have more than one spawners with same key/value, you must use
Code: array_thread( getentarray( "ally", "targetname" ), ::add_spawn_function, ::magic_bullet_shield);
The error is telling, that you have multiple spawners(or other entities) with ("Alex", "targetname") key/value, so you must use getentarray, or remove these key/value pairs from other entities
edited on Sep. 5, 2012 12:36 am by 3st0nian
edited on Sep. 5, 2012 12:38 am by 3st0nian |
|
|
|
|
|
|
|
sam_fisher3000 |
|
General Member Since: Apr 18, 2007 Posts: 816 Last: Jul 16, 2016 [view latest posts] |
|
|
|
|