scripting targets

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
KcAX19

scripting targets

Post by KcAX19 »

i have made a moveing brick and it goes from side to side but now i need it to explode when it takes a cirtain amount of dmg but when it explodes i dont want it to blow the other bricks up so what i am asking 4 is that when u shoot my brick and it takes in dmg i would like it to blow but with no radious dmg the targetnames r "man1" to man6

if u need more info contact me on msn msger or e-mail on
michael_aiz@msn.com

thx
KcAX19
Guest

Post by Guest »

An idea may be to temporarily set the nodamage of the surrounding bricks by just before the explosion occurs and setting the damage just after the explosion and thus also after the damage dealing has occured.
Supposingly you named your bricks brick1 brick2 etc
// brickcount = number of bricks
// wall is the array of the remaining 'healthy' bricks

I'm not so good at scripting yet, but it would be something like this

Code: Select all

thread buildwall

buildwall:
level.brickcount = 10
	for (local.i = 1 ; local.i <=  level.brickcount ; local.i ++)
                {
                 local.i_brickname = ("brick" + local.i)
                 level.wall[local.i] = local.i_brickname 
// maybe the spawning of the bricks can be done here as well
// wall now is filled with brick1 brick2 .. brick"brickcount "
// have listener thread set out for each brick
                 
                 local.i_brickname thread  brick_dead
                 }
end


brick_dead:

    self waittill death 

    thread protect_bricks self.targetname

// after all bricks are protected let her blow
    self thread brick_explodes

// wait statement just to have some processing time available
    wait 0.2

    thread unprotect_bricks

end


protect_bricks local.name:

// check the bricks in the wall
    for (local.i = 1 ; local.i <=  level.brickcount ; local.i ++)
	{
		local.brickname = ("brick" + local.i)

// is this the brick that just died
                                IF local.brickname == local.name

// remove the brick from the wall
	                {
                                level.wall[(local.i] != NIL
                                 }//if

                                ELSE
// protect the surviving brick from the blast
                                {
                                 $(local.brickname) nodamage
                                }  //else
                }   //for
end

brick_explodes:
// do here your own magic brick expoding bit here
end


unprotect_bricks:

    for (local.i = 1 ; local.i <=  level.brickcount ; local.i ++)
	{
// is this a healthy brick 
                                IF wall != NIL
                                {
                                local.brickname = ("brick" + local.i)

                                $(local.brickname) takedamage
                                } //if
                } //for             
end
Hopes it works
Nijnrich
Corporal
Posts: 28
Joined: Tue Oct 01, 2002 11:40 pm
Location: Eindhoven
Contact:

Post by Nijnrich »

**** automatically logged seems is a nuicance , now i can't edit it
Anyway I saw one error already

// is this a healthy brick
IF wall != NIL

should be

// is this a healthy brick
IF wall[local.i] != NIL
Last edited by Nijnrich on Wed Oct 16, 2002 10:05 pm, edited 1 time in total.
Surgeon
Site Admin
Posts: 1386
Joined: Tue Jun 04, 2002 1:15 am
Location: Stirling, Scotland
Contact:

Post by Surgeon »

hmm wierd it works fine for me :?
Admin
Image

.map Forums

Truth and Honor.
KcAX19

:(

Post by KcAX19 »

thanks man but i tryed it and the thingy didnt work 4 me nothing moved nothing blew up ...so if it would be possable for someone to make the .map and the script file for me and send it to my e-mail so i could get an idea on how to make this thing that would be great.

thx

KcAX19
HkySk8r187
Lance Corporal
Posts: 20
Joined: Fri Jun 28, 2002 6:37 pm
Contact:

Post by HkySk8r187 »

try just making it a func_crate. It will look like wood particles when it breaks but maybe you can change some properties for that, don't know, but it will do what you want it to do. Be sure to do each brick seperatly, if you do them all at once they will break together.
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Sorry, nothing to do with the subject, but is it 'in' to choose a name that's a random combination of characters? :)
Nijnrich
Corporal
Posts: 28
Joined: Tue Oct 01, 2002 11:40 pm
Location: Eindhoven
Contact:

Post by Nijnrich »

HkySk8r187 wrote:try just making it a func_crate. It will look like wood particles when it breaks but maybe you can change some properties for that, don't know, but it will do what you want it to do. Be sure to do each brick seperatly, if you do them all at once they will break together.
I thought that his question was how to let the brick really explode without causing the other brick sto explode and yet still do radius damage . :( If it's just the animation he's after and not the damage dealing bit then I was completely off . Sorry about it. The func_crate is much much better....

About drawing the brick's Either uses the copy function a lot or make one big brick and then use the clipper tool wisely. :)
KcAX19

Post by KcAX19 »

i am sorry but i dont think u can make a script_object into a func_crate lol thanks for trying tho.....oh and my question is how to make the bricks explode when they take damage thats all i want and the bricks r a script object so the idea of a crate is out of the question and yes i need it to be a script object cause the brick actually move with the script *$man1 moveleft 150*...well really the script is more complicated than this but this shows u what it does....
Post Reply