Game Modding | Call of Duty: Black Ops 3 | Scripting
BryceiBoi:
Hi all, new to the forums here. Lots of very useful information! :)
I'm having a small issue of my own so I'll just give a little bit of context to the functionality I'd like to implement (it's rather simple, really). Basically, there is a zombie door I have which once opened allows players to enter a Zone in which consists of 'x' Zombie spawners that scripted to enter through 'y' zombie barriers. These barriers lead into the starting zone! SO, I would like to delete said 'y' zombie barriers to enable players to jump through these windows to easily enter-exit the starting zone. This is what I'm having issues with - my delete() wont delete the barriers. I was wondering if this had anything to do with zombie barriers being prefabs? It's got to be something extremely simple that I'm misunderstanding I assume
spawners=GetEntArray("start_zone_spawners",targetname);zombie_barriers=GetEntArray("start_zone_barriers",targetname);// these are the zombie barriers (prefabs) I want to deletesaid_zombie_door=GetEnt("door_trigger","triggerId")// custom KVPsaid_zombie_doorwaittill("trigger");spawners[0]delete();// this worksspawners[1]delete();// this worksfor(i=0;i<zombie_barriers.size;i++){zombie_barriers[i]delete();// This doesn't work?}
Spiki:
The barricades are Zbarriers not entities. Also it wouldnt help to delete them bacause the prefab has a static clip in it which would stop movement anyway.
GetZBarrierArray()
is what you want
BryceiBoi:
The barricades are Zbarriers not entities. Also it wouldnt help to delete them bacause the prefab has a static clip in it which would stop ovement anyway.
GetZBarrierArray()
is what you want
That does sound like the function I need to utilise. Another question though, how can I identify which ZBarrier in the Array is the one I need to remove? Can I access the value of a KVP by simply using the dot operator? For example:
// barrier I want removed in Radiant is given KVP: ("zbarriername", "barrier_i_want_deleted")array=GetZBarrierArray();for(i=0;i<array.size;i++){if(array[i].zbarriername=="barrier_i_want_deleted"){array[i]delete();}}
Alternatively, I guess I could just do some vigorous trial and error to find which array index is the one I need :ROFLMAO:
Spiki:
That does sound like the function I need to utilise. Another question though, how can I identify which ZBarrier in the Array is the one I need to remove? Can I access the value of a KVP by simply using the dot operator? For example:
// barrier I want removed in Radiant is given KVP: ("zbarriername", "barrier_i_want_deleted")array=GetZBarrierArray();for(i=0;i<array.size;i++){if(array[i].zbarriername=="barrier_i_want_deleted"){array[i]delete();}}
Alternatively, I guess I could just do some vigorous trial and error to find which array index is the one I need :ROFLMAO:
you cant slap just any kvp. check attachment. use script_string also you use GetZBarrierArray() like getentarray()
BryceiBoi:
Ok, so I've almost got this! I can get the ZBarrier and delete it with delete() however the clip remains there so I cant walk through where the barrier once was. Any ideas?
zBarriers=GetZBarrierArray();for(i=0;i<zBarriers.size;i++){barrier_name=zBarriers[i].script_string;if(barrier_name=="window_1"){zBarriers[i]delete();// deletes model but clip is still there?break;}}
BryceiBoi:
Managed to resolve the problem by deleting the player clip from the ZBarrier prefab (barricade_reciever_wood.map) and adding the clip outside of the prefab manually. Then in the script just not only deleting the ZBarrier object, but also the clip separately: