RadioactiveArea not working

Results 1 to 12 of 12
  1. #1
    Elite Member eywasgeht is offline
    Member +Rank
    Dec 2013 Join Date
    167Posts

    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.


  2. #2
    Developer DNC is offline
    DeveloperRank
    Oct 2011 Join Date
    2,493Posts

    Re: RadioactiveArea not working

    Then what are you saying and why are you even wasting time posting?
    This isn't how we do things -.-

  3. #3
    Elite Member eywasgeht is offline
    Member +Rank
    Dec 2013 Join Date
    167Posts

    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

  4. #4
    Developer DNC is offline
    DeveloperRank
    Oct 2011 Join Date
    2,493Posts

    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.

  5. #5
    Elite Member eywasgeht is offline
    Member +Rank
    Dec 2013 Join Date
    167Posts

    Re: RadioactiveArea not working

    No one knows or want to help ?

  6. #6
    Member promedans is offline
    MemberRank
    Apr 2014 Join Date
    60Posts

    Re: RadioactiveArea not working

    did u solve ur problem ?

  7. #7
    Elite Member eywasgeht is offline
    Member +Rank
    Dec 2013 Join Date
    167Posts

    Re: RadioactiveArea not working

    nope i did not solved this :((

  8. #8
    m70b1jr#9501 m70b1jr is offline
    Grand MasterRank
    May 2013 Join Date
    North CarolinaLocation
    862Posts

    Re: RadioactiveArea not working

    post your obj_RadioactiveArea.h amd add my skype m70b1jr_1

  9. #9
    AKCore ATIDOT3 is offline
    Grand MasterRank
    Apr 2013 Join Date
    BinaryLocation
    536Posts

    Re: RadioactiveArea not working

    i'm writing a tutorial.

  10. #10
    m70b1jr#9501 m70b1jr is offline
    Grand MasterRank
    May 2013 Join Date
    North CarolinaLocation
    862Posts

    Re: RadioactiveArea not working

    Quote Originally Posted by ATIDOT3 View Post
    i'm writing a tutorial.
    ETA?
    Love ya :D

  11. #11
    Elite Member eywasgeht is offline
    Member +Rank
    Dec 2013 Join Date
    167Posts

    Re: RadioactiveArea not working

    Thx atidote i will see what i made wron in your tut

  12. #12
    Member promedans is offline
    MemberRank
    Apr 2014 Join Date
    60Posts

    Re: RadioactiveArea not working

    i tried his tut but there is somethin wrong its not gving damage in studio and game also



Advertisement