Brush entities have thier own origin, if you want to set it back to its original position all you have to do is set it back to the coords 0 0 0
Oh.. Thanks. So that's why i didn't see EV_VEC_origin in the first report and have seen it in the second
I used this plugin corrected for my aim. It didn't show empty values so that's why I think I made a mistake
new i, EV_INT_VALUE, Float:EV_FL_VALUE, Float:EV_VEC_VALUE[3], EV_ENT_VALUE, EV_SZ_VALUE[MAX_PLAYERS], EV_BYTE_VALUE new is_attack, was_attack,victim, bodypart;
public plugin_init() { register_plugin("Entity Info", "0.5", "Pizzahut|SPiNX") //99% of code is pizzahut.
Glad you mentioned way-points. That can play a key role. Many routes are 1 way; thus bot is stuck. The other easily omitted thing that comes up is info_bomb_target and func_bomb_target are the same thing on 2 differently aged maps. You did not post all the code so leaving me to shoot in the dark on this.
If you wanna see my poor code so here you go:
Spoiler
--deleted--
I've checked counter-strike's fgd for info_bomb_target and added it to the code after you mentioned it. Ty
Now I have to think if I can still resize that entities or try to change their origins as @Natsheh corrected me
UPD: Code with latest changes. Hope someone could test it and show me what I should adjust for the best experience. (P.S. dont blow the bomb if u can see its entity )
TODO: planned to use nVault to store site names depending on map
Spoiler
PHP Code:
// I stole some of R3X's code https://forums.alliedmods.net/showthread.php?p=803906 #include <amxmodx> #include <engine>
// defined it just to not write zeros :) #define EF_NOFX 0
new const TARGET_ENTITY[][] = { "func_bomb_target", "info_bomb_target" }
new g_sprite
new Array:g_BS, Array:g_BSbrushorigin
new Float:g_worldOrigin[3] = { 0.0, 0.0, 0.0 }
new Float:g_originShifted[3] = { // i think this is enough :) -4096.0, -4096.0, -4096.0 }
new g_entCount, g_entCountShifted
new g_wingman new bool:g_waitingForNextRound new pCvar_wingman new cvarhook:g_cvarhook_handle
public plugin_precache() { g_sprite = precache_model("sprites/dot.spr") }
public plugin_init() { register_plugin("expectation", "latest", "kww")
// mp_wingman -2 - disable mode on the next round without restarting the game // mp_wingman -1 - disable mode without restarting the game // mp_wingman 0 - disable mode and restart the game // mp_wingman 1 - enable mode and restart the game // mp_wingman 2 - enable mode without restarting the game // made for my purpose // mp_wingman 3 - enable mode on the next round without restarting the game // made for my purpose
if(g_entCount) { log_amx("====================") log_amx("found %i bombsite(s)", g_entCount) } else { log_amx("no bombsites have been found") }
g_entCountShifted = g_entCount-1 }
public cvarhook_mp_wingman(pCvar_wingman, const old_value[], const new_value[]) { // mp_wingman -2 - disable mode on the next round without restarting the game // mp_wingman -1 - disable mode without restarting the game // mp_wingman 0 - disable mode and restart the game // mp_wingman 1 - enable mode and restart the game // mp_wingman 2 - enable mode without restarting the game // made for my purpose // mp_wingman 3 - enable mode on the next round without restarting the game // made for my purpose
// p.s. wanna find a better way to process it // i'm very stupid to do it myself static iOld, iNew iOld = str_to_num(old_value) iNew = str_to_num(new_value)
if(iNew != iOld) { switch(iNew) { case 3: { if(!g_waitingForNextRound) { // here we don't have to do anything at all // g_wingman > 0 and the new round gonna start later :) g_waitingForNextRound = true } } case 2: { // here we don't have to restart the game but only force "remove" some plant removal_function() g_waitingForNextRound = true } case 1: { // we just have to restart the game // g_wingman > 0 will do its job :) server_cmd("sv_restartround 1") } case 0: { // reset sites and restart the game // g_wingman == 0 will do its job :) resetSites() server_cmd("sv_restartround 1") } case -1: { // here we don't have to restart the game but only force restore all sites ClCmd_resetwingman(0) g_waitingForNextRound = true } case -2: { if(!g_waitingForNextRound) { // here we don't have to do anything at all (again) // g_wingman < 0 and the new round gonna start later :) g_waitingForNextRound = true } } } } }
public Event_HLTV() { g_waitingForNextRound = false
public removal_function() { /** * Select random site to remove it * ONLY if "mp_wingman" is set to more than zero * AND if map have MORE than 1 site * * (E.g. de_dust2_2x2 and other shortened big maps) * * Otherwise there is no need to remove the only one plant */
public set_pcvar_num_no_trigger(cvarhook:cvarhook_handle, pcvar, target_value) // is this applicable? { disable_cvar_hook(cvarhook_handle) set_pcvar_num(pcvar, target_value) enable_cvar_hook(cvarhook_handle) }
register_bombsite(ent, Float:fOrigin[3]) { new lastEntry = ArrayPushCell(g_BS, ent) ArrayPushArray(g_BSbrushorigin, fOrigin)
log_amx("registered new entry: %i with entity id of %i", lastEntry, ent) }
public ClCmd_teleport(id) { new arg[4] read_argv(1, arg, charsmax(arg))
if(!arg[0]) { console_print(id, "Usage: plant_teleport <registered bombsite index>") } else { new selected = str_to_num(arg) new ent = ArrayGetCell(g_BS, selected)
new Float:temp[3] ArrayGetArray(g_BSbrushorigin, selected, temp)
entity_set_origin(id, temp) server_print("teleported to the bombsite %i", ent) }
return PLUGIN_HANDLED }
public ClCmd_toggle_triggerbox(id) { new arg[4] read_argv(1, arg, charsmax(arg))
if(!arg[0]) { console_print(id, "Usage: plant_toggle_triggerbox <registered bombsite index>") } else { new selected = str_to_num(arg) new ent = ArrayGetCell(g_BS, selected)
switch(entity_get_int(ent, EV_INT_effects)) { case EF_NODRAW: // func_bomb_target have only this flag making it invisible { entity_set_int(ent, EV_INT_effects, EF_NOFX) entity_set_int(ent, EV_INT_rendermode, kRenderTransAdd) entity_set_float(ent, EV_FL_renderamt, 64.0) // 64.0 is almost 25% opacity } case EF_NOFX: { entity_set_int(ent, EV_INT_effects, EF_NODRAW) entity_set_int(ent, EV_INT_rendermode, kRenderNormal) entity_set_float(ent, EV_FL_renderamt, 0.0) } }
public removeSite(selected) { // in case of wrong "plant_removesite" usage. Since ArrayGetCell will not return -1 on error I think this could work if(g_entCountShifted <= selected <= 0) { console_print(0, "Error: could not remove bombsite %i. Wrong entry id provided", selected) return PLUGIN_HANDLED }
console_print(0, "bombsite %i (Entity: %i) have been reset", selected, ArrayGetCell(g_BS, selected)) }
return PLUGIN_HANDLED }
public ClCmd_wingmanhelp(id) { console_print(id, "mp_wingman -2 - disable mode on the next round without restarting the game") console_print(id, "mp_wingman -1 - disable mode without restarting the game") console_print(id, "mp_wingman 0 - disable mode and restart the game") console_print(id, "mp_wingman 1 - enable mode and restart the game") console_print(id, "mp_wingman 2 - enable mode without restarting the game") console_print(id, "mp_wingman 3 - enable mode on the next round without restarting the game")
I think its because of most brush entities don't have the ORIGIN texture block assigned to them which what gives the brush entity its origin, so the brush entity will relay on the world as its spawn origin which { 0, 0, 0 }.
You can make adjustments to add auto lock based on conditions
I shouldn't have made this plugin if I knew something similar already exists
I will look into it
upd: this mode is supposed to be played with small amount of players (like 1v1 or 2v2, idk) on large maps. What adjustments I can make? The only thing that came to my mind is to add command to manually block site swapping (only A or only B)