How To create simple basic drawing & create send chat message

I want to draw simple text, and send chat message
this my code, but the result no drawing output, Game.PrintMessage just appear in command promt

`using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ensage;
using Ensage.SDK.Abilities.npc_dota_hero_zuus;
using Ensage.SDK.Extensions;
using Ensage.SDK.Helpers;
using Ensage.SDK.Service;
using Ensage.SDK.Service.Metadata;
using SharpDX;
using PlaySharp.Toolkit.Logging;
namespace tutorial
{
[ExportPlugin("Ability Factory Sample(Zeus)", HeroId.npc_dota_hero_zuus)]
internal class Program : Plugin
{
private readonly zuus_arc_lightning arcLighting;
private readonly zuus_lightning_bolt lightningBolt;
private readonly Unit owner;

    [ImportingConstructor]
    public Program(IServiceContext context)
    {
        this.owner = context.Owner;
        var abilityFactory = context.AbilityFactory;

        // some abilities are missing
        // write on discord (#development) if you need them
        // ability names: https://developer.valvesoftware.com/wiki/Dota_2_Workshop_Tools/Scripting/Built-In_Ability_Names
        this.arcLighting = abilityFactory.GetAbility<zuus_arc_lightning>();
        this.lightningBolt = abilityFactory.GetAbility<zuus_lightning_bolt>();

        // also you can get ability by id, but its not preferred
        var thunder = abilityFactory.GetAbility(AbilityId.zuus_thundergods_wrath);
    }

    protected override void OnActivate()
    {
        UpdateManager.Subscribe(this.OnUpdate, 1000);
    }

    protected override void OnDeactivate()
    {
        UpdateManager.Unsubscribe(this.OnUpdate);
    }

    private void OnUpdate()
    {
        // its not really a correct way of using multiple abilities and made only for simplicity
        // check SimpleCombo or OrbwalkerAsync for better ability usage

        if (this.owner.IsAlive)
        {
            Game.PrintMessage("HERO Is Alive");
            return;
        }

        var enemy = EntityManager<Unit>.Entities.FirstOrDefault(x => x.IsValid && x.IsAlive && x.IsEnemy(this.owner));
        if (enemy == null)
        {
            return;
        }

        if (this.arcLighting.CanBeCasted && this.arcLighting.CanHit(enemy))
        {
            this.arcLighting.UseAbility(enemy);
            //Log.Warn("Using arc lightning on: " + enemy.GetDisplayName() + "// damage: " + this.arcLighting.GetDamage(enemy));
            return;
        }

        if (this.lightningBolt.CanBeCasted && this.lightningBolt.CanHit(enemy))
        {
            this.lightningBolt.UseAbility(enemy);
            //Log.Warn("Using lightning bolt on: " + enemy.GetDisplayName() + "// damage: " + this.lightningBolt.GetDamage(enemy));
        }
    }

    public static void onDraw(EventArgs args) {
        Drawing.DrawText("Test",new Vector2(100, 100), Color.White,FontFlags.AntiAlias | FontFlags.StrikeOut);
    }

}

}
`

Tagged:
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!