-
Elite Member
RadioactiveArea not working
Hello Ragezone
i have a problem, my RadioactiveArea does not work i used the Damagearea.cpp and changed some thinks on it to m_Toxic
If you need more information just post down here but i will not release somethink from this code.
-
-
Developer
Re: RadioactiveArea not working
Then what are you saying and why are you even wasting time posting?
This isn't how we do things -.-
-
Elite Member
Re: RadioactiveArea not working
ok i am posting the code what i made.
#include "r3dPCH.h"
#include "r3d.h"
#include "GameCommon.h"
#include "obj_RadioactiveArea.h"
#include "../../multiplayer/ClientGameLogic.h"
#include "../ai/AI_Player.H"
#include "Editors/ObjectManipulator3d.h"
IMPLEMENT_CLASS(obj_RadioactiveArea, "obj_RadioactiveArea", "Object");
AUTOREGISTER_CLASS(obj_RadioactiveArea);
extern bool g_bEditMode;
static r3dTexture *RadioactiveAreaIcon = NULL;
/*static*/ obj_RadioactiveArea::Arr obj_RadioactiveArea::ms_RadioactiveAreaArr ;
obj_RadioactiveArea::obj_RadioactiveArea()
{
m_Radius = 5.0f;
m_Toxic = 1.0f;
ms_RadioactiveAreaArr.PushBack( this ) ;
}
obj_RadioactiveArea::~obj_RadioactiveArea()
{
int erased = 0 ;
for( int i = 0, e = ms_RadioactiveAreaArr.Count() ; i < e ; i ++ )
{
if( ms_RadioactiveAreaArr[ i ] == this )
{
ms_RadioactiveAreaArr.Erase( i ) ;
erased = 1 ;
break ;
}
}
r3d_assert( erased ) ;
}
BOOL obj_RadioactiveArea::Load(const char *fname)
{
if(!parent::Load(fname)) return FALSE;
if(g_bEditMode)
if (!RadioactiveAreaIcon) RadioactiveAreaIcon = r3dRenderer->LoadTexture("Data\\Images\\DamageArea.dds");
return TRUE;
}
BOOL obj_RadioactiveArea::OnCreate()
{
parent::OnCreate();
DrawOrder = OBJ_DRAWORDER_LAST;
setSkipOcclusionCheck(true);
ObjFlags |= OBJFLAG_DisableShadows | OBJFLAG_ForceSleep;
r3dBoundBox bboxLocal ;
bboxLocal.Size = r3dPoint3D(2,2,2);
bboxLocal.Org = -bboxLocal.Size * 0.5f;
SetBBoxLocal( bboxLocal ) ;
UpdateTransform();
return 1;
}
extern bool g_bExplicitlyShowBattleZoneWarning;
BOOL obj_RadioactiveArea::Update()
{
return parent::Update();
}
void obj_RadioactiveArea::ReadSerializedData(pugi::xml_node& node)
{
GameObject::ReadSerializedData(node);
pugi::xml_node RadioactiveAreaNode = node.child("RadioactiveArea");
m_Radius = RadioactiveAreaNode.attribute("radius").as_float();
m_Toxic = RadioactiveAreaNode.attribute("toxic").as_float();
}
void obj_RadioactiveArea::WriteSerializedData(pugi::xml_node& node)
{
GameObject::WriteSerializedData(node);
pugi::xml_node RadioactiveAreaNode = node.append_child();
RadioactiveAreaNode.set_name("RadioactiveArea");
RadioactiveAreaNode.append_attribute("radius") = m_Radius;
RadioactiveAreaNode.append_attribute("toxic") = m_Toxic;
}
struct RadioactiveAreaRenderable : Renderable
{
void Init() { DrawFunc = Draw; }
static void Draw( Renderable* RThis, const r3dCamera& Cam )
{
RadioactiveAreaRenderable *This = static_cast<RadioactiveAreaRenderable*>( RThis );
r3dRenderer->SetTex(NULL);
r3dRenderer->SetMaterial(NULL);
r3dColor clr = r3dColor::red; clr.A = 128;
r3dRenderer->SetRenderingMode( R3D_BLEND_PUSH| R3D_BLEND_ALPHA | R3D_BLEND_ZC );
r3dDrawSphereSolid ( This->Parent->GetPosition(), This->Parent->GetRadius(), gCam, clr );
r3dRenderer->SetRenderingMode( R3D_BLEND_POP );
r3dRenderer->Flush();
}
obj_RadioactiveArea* Parent;
};
void r3dDrawIcon3D(const r3dPoint3D& pos, r3dTexture *icon, const r3dColor &Col, float size);
struct RadioactiveAreaRenderableHelper : Renderable
{
void Init()
{
DrawFunc = Draw;
}
static void Draw( Renderable* RThis, const r3dCamera& Cam )
{
RadioactiveAreaRenderableHelper *This = static_cast<RadioactiveAreaRenderableHelper*>( RThis );
r3dRenderer->SetTex(NULL);
r3dRenderer->SetMaterial(NULL);
r3dRenderer->SetRenderingMode( R3D_BLEND_NOALPHA | R3D_BLEND_ZC );
if((This->Parent->GetPosition() - Cam).Length() < 100)
r3dDrawIcon3D(This->Parent->GetPosition(), RadioactiveAreaIcon, r3dColor(255,255,255), 24);
}
obj_RadioactiveArea* Parent;
};
#define RENDERABLE_OBJ_USER_SORT_VALUE (3*RENDERABLE_USER_SORT_VALUE)
void obj_RadioactiveArea::AppendRenderables( RenderArray ( & render_arrays )[ rsCount ], const r3dCamera& Cam )
{
#ifdef FINAL_BUILD
return;
#else
// don't draw debug info if we're not in editor mode
if ( !g_bEditMode )
return;
if( r_hide_icons->GetInt() )
return ;
float idd = r_icons_draw_distance->GetFloat();
idd *= idd;
if( ( Cam - GetPosition() ).LengthSq() > idd )
return;
if(g_Manipulator3d.PickedObject() == this)
{
RadioactiveAreaRenderable rend;
rend.Init();
rend.SortValue = RENDERABLE_OBJ_USER_SORT_VALUE;
rend.Parent = this;
render_arrays[ rsDrawDebugData ].PushBack( rend );
}
// helper
extern int CurHUDID;
if(CurHUDID == 0)
{
RadioactiveAreaRenderableHelper rend;
rend.Init();
rend.Parent = this;
rend.SortValue = RENDERABLE_OBJ_USER_SORT_VALUE;
render_arrays[ rsDrawComposite1 ].PushBack( rend );
}
#endif
}
#ifndef FINAL_BUILD
float obj_RadioactiveArea::DrawPropertyEditor(float scrx, float scry, float scrw, float scrh, const AClass* startClass, const GameObjects& selected)
{
float starty = scry;
starty += parent::DrawPropertyEditor( scrx, scry, scrw,scrh, startClass, selected );
if( IsParentOrEqual( &ClassData, startClass ) )
{
starty += imgui_Static ( scrx, starty, "Radioactive Area Properties" );
static float radiusVal = 0 ;
radiusVal = m_Radius ;
starty += imgui_Value_Slider(scrx, starty, "Radius", &radiusVal, 0.0f,300, "%.2f",1);
PropagateChange( radiusVal, &obj_RadioactiveArea::m_Radius, this, selected ) ;
static float toxicVal = 0 ;
toxicVal = m_Toxic ;
starty += imgui_Value_Slider(scrx, starty, "Toxic per Second", &toxicVal, 0.0f,200.0f, "%.2f",1);
PropagateChange( toxicVal, &obj_RadioactiveArea::m_Toxic, this, selected ) ;
}
return starty-scry;
}
#endif
-
Developer
Re: RadioactiveArea not working
Promise, I'm not here to take it.
I don't even have time to resolve it.
All you and I can both do now, is hope someone here has the time.
Thank you for being an upstanding community member.
-
Elite Member
Re: RadioactiveArea not working
No one knows or want to help ?
-
Member
Re: RadioactiveArea not working
-
Elite Member
Re: RadioactiveArea not working
nope i did not solved this :((
-
m70b1jr#9501
Re: RadioactiveArea not working
post your obj_RadioactiveArea.h amd add my skype m70b1jr_1
-
AKCore
Re: RadioactiveArea not working
-
m70b1jr#9501
Re: RadioactiveArea not working

Originally Posted by
ATIDOT3
i'm writing a tutorial.
ETA?
Love ya :D
-
Elite Member
Re: RadioactiveArea not working
Thx atidote i will see what i made wron in your tut
-
Member
Re: RadioactiveArea not working
i tried his tut but there is somethin wrong its not gving damage in studio and game also