Post: deleting a bunker
04-14-2016, 08:19 AM #1
seanhellen
Are you high?
(adsbygoogle = window.adsbygoogle || []).push({}); Hi all - I was wondering how I could go about deleting a bunker. this is my function and the delete function I was hoping to use;

    
SpawnBunkerCrate(origin, angle)
{
bunkercrate = spawn("script_model", origin);
bunkercrate.angles = angle;
bunkercrate setModel("t6_wpn_supply_drop_ally");
return bunkercrate;
level.bunker++;
}

DeleteBunker()
{
foreach(crate in level.bunker)
crate delete();
}


Reading my delete function now, I see why it doesn't work(just changes the variable, doesn't delete the actual crate...right?), but can't think how I would make it work. Been trying to study jwm's forge menu, but still can't apply it to my menu
(adsbygoogle = window.adsbygoogle || []).push({});
04-14-2016, 09:19 AM #2
Patrick
League Champion
Originally posted by seanhellen View Post
Hi all - I was wondering how I could go about deleting a bunker. this is my function and the delete function I was hoping to use;

    
SpawnBunkerCrate(origin, angle)
{
bunkercrate = spawn("script_model", origin);
bunkercrate.angles = angle;
bunkercrate setModel("t6_wpn_supply_drop_ally");
return bunkercrate;
level.bunker++;
}

DeleteBunker()
{
foreach(crate in level.bunker)
crate delete();
}


Reading my delete function now, I see why it doesn't work(just changes the variable, doesn't delete the actual crate...right?), but can't think how I would make it work. Been trying to study jwm's forge menu, but still can't apply it to my menu

Just make an array then use array_delete to delete them all Smile

The following user thanked Patrick for this useful post:

iRnZ
04-14-2016, 11:26 AM #3
seanhellen
Are you high?
Ah yes, forgot about array_delete.

So I would make level.bunker = [];
Then level.bunker++ to add to it per crate
Then array_delete(level.bunker)

Hopefully thatll work Happy
04-14-2016, 12:03 PM #4
iRnZ
NextGenUpdate Elite
Originally posted by seanhellen View Post
Ah yes, forgot about array_delete.

So I would make level.bunker = [];
Then level.bunker++ to add to it per crate
Then array_delete(level.bunker)

Hopefully thatll work Happy


for( i = 0; i < bunkercrate.size; i++ )
{
bunkercrate delete();
}
04-14-2016, 12:54 PM #5
Patrick
League Champion
Originally posted by seanhellen View Post
Ah yes, forgot about array_delete.

So I would make level.bunker = [];
Then level.bunker++ to add to it per crate
Then array_delete(level.bunker)

Hopefully thatll work Happy


If you need help add me on skype: Extinctxo
04-14-2016, 12:55 PM #6
Patrick
League Champion
Originally posted by iReZ View Post
for( i = 0; i < bunkercrate.size; i++ )
{
bunkercrate delete();
}


array_delete does the job just fine Smile
04-14-2016, 01:26 PM #7
Patrick
League Champion
Originally posted by seanhellen View Post
Hi all - I was wondering how I could go about deleting a bunker. this is my function and the delete function I was hoping to use;

    
SpawnBunkerCrate(origin, angle)
{
bunkercrate = spawn("script_model", origin);
bunkercrate.angles = angle;
bunkercrate setModel("t6_wpn_supply_drop_ally");
return bunkercrate;
level.bunker++;
}

DeleteBunker()
{
foreach(crate in level.bunker)
crate delete();
}


Reading my delete function now, I see why it doesn't work(just changes the variable, doesn't delete the actual crate...right?), but can't think how I would make it work. Been trying to study jwm's forge menu, but still can't apply it to my menu


Also you need to change a little of the function you made:

Wrong:
    return bunkercrate;
level.bunker++;


Correct:
    level.bunker++;
return bunkercrate;

The following user thanked Patrick for this useful post:

iRnZ
04-14-2016, 02:17 PM #8
seanhellen
Are you high?
Great. Thanks for the help :yes:

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo