#Clock Rocket Flare providing vision of invisible units

1 messages · Page 1 of 1 (latest)

crude oriole
#

Basically I want to make an item where I cast an aoe spell that reveals an area, I got that part down but I don't know how to proceed when it comes to making so that it also reveals invisible units

#

here's the code I have so far

#

(btw clock's sound isn't working for some reason)

fresh pumice
#

try
find units in radius and
target:AddNewModifier(caster, self, "modifier_truesight", {duration = sight_duration})

crude oriole
#

I want the invisible units to be displayed inside of the area, but if they leave they get hidden again

#

instead of it "revealing them" even after they leave the area

#

if they get hit initially

#

I'm assuming it's gonna work like that, so I'll try it out, thank you

smoky hearth
#

thats how valve handles that kind of thing

crude oriole
#

hm so I guess it's more complex than I initially thought

#

do you have any examples of dummies being created?

wind gateBOT
#

Found 1 function for createmodifierthinker

🇸 CreateModifierThinker(caster: CDOTA_BaseNPC|nil, ability: CDOTABaseAbility|nil, modifierName: string, paramTable: table|nil, origin: Vector, teamNumber: DOTATeam_t, phantomBlocker: bool): CDOTA_BaseNPC
Create a modifier not associated with an NPC.

smoky hearth
#

just use that

#

if you open that link, and click the github button you'll see plenty of examples

crude oriole
#

thanks

smoky hearth
#

it says >not associated with an NPC.
but in reality there is a dummy unit that the modifier applies to

crude oriole
#

is a dummy unit invisible?

smoky hearth
#

yes, the unit from createmodifierthinker has no model invisible box model and is not found by things like findunitsinradius normally

#

you can find them if you want to, but in 99% of cases you dont want to

crude oriole
#

what would be the best way to get the enemy's team team number

#

this is what I have currently

smoky hearth
#

it would be the team number of the caster

#

the true sight would reveal all of the enemies of the casters team

crude oriole
#

oh

smoky hearth
# crude oriole

hold on. you need to make your own modifier to apply to the thinker

#

and that modifier emits an aura of modifier_truesight

crude oriole
#

ah I thought a thinker would be special in the sense that you just apply any modifier to it and it works

#

I see

smoky hearth
#

there are a bunch of modifier functions for auras.
you would need most of them

wind gateBOT
#

Found 11 functions for aura

🇸 🇨 CDOTA_Buff:GetAuraDuration(): float
Returns aura stickiness (default 0.5).
🇸 🇨 CDOTA_Modifier_Lua:GetAuraDuration(): float
Returns aura stickiness.
🇸 🇨 CDOTA_Modifier_Lua:GetAuraEntityReject(entity: CDOTA_BaseNPC): bool
Return true/false if this entity should receive the aura under specific conditions.
🇸 🇨 CDOTA_Buff:GetAuraOwner(): CDOTA_BaseNPC|nil
Returns the owner of the aura modifier, that applied this modifier. Always `nil` on the client.
🇸 🇨 CDOTA_Modifier_Lua:GetAuraRadius(): int
Return the range around the parent this aura tries to apply its buff.
and 6 more…

crude oriole
#

yeye

#

I think I know how to make that one

smoky hearth
#

alright

#

do note that you should use DOTA_UNIT_TARGET_FLAG_INVULNERABLE, so that the true sight is applied to invulnerable units.

#

by default invulnerable units are ignored in searches and such

crude oriole
#

worked beautifully

#

what would be an invulnerable unit?

#

like an example

#

bkb?

#

something like this right

smoky hearth
#

yeah

smoky hearth
#

plenty of others

crude oriole
#

why is the sound not working

#

and particle

#

I dont get it

reef lava
#

did you precache them?

#

if you don't tell the engine to load them then you can't use them

#

some don't need to be loaded, but generally anything thats tied to a hero or other entity needs to be

crude oriole
#

oh

#

so this is why the cheese sound effect works

#

but this one doesnt

#

I see

reef lava
#

yep

crude oriole
#

where do I precache

#

npc items custom?

reef lava
#

either in the ability kv, in the ability lua, or in addon_game_mode.lua

#

I generally use the ability lua

#
function kraken_spout:Precache( context )
    PrecacheResource( "soundfile", "soundevents/game_sounds_heroes/game_sounds_tidehunter.vsndevts", context )
    PrecacheResource( "particle", "particles/units/heroes/hero_tidehunter/tidehunter_gush.vpcf", context )
    PrecacheResource( "particle", "particles/units/heroes/hero_tidehunter/tidehunter_gush_splash.vpcf", context )
    PrecacheResource( "particle", "particles/units/heroes/hero_tidehunter/tidehunter_gush_slow.vpcf", context )
end
#

I think elfansoer used to precache in the KV, but he does it in the lua now, you can see in the repo that old abilities have the precache in the kv

#
"precache"
        {
            "soundfile"    "soundevents/game_sounds_heroes/game_sounds_abaddon.vsndevts"
            "particle"    "particles/units/heroes/hero_abaddon/abaddon_death_coil.vpcf"
        }
crude oriole
#

still doesnt work

#

I'm confused

#

is there a chance this isnt working because clockwork is disabled?

#

on the herolist

#

actually no that doesnt make sense because shadowfiend is disabled and I can use its autoattack as a particle

crude oriole
#

followup question is there any good examples of repos messing with panorama after the change so that the <scripts> tag isn't allowed?

smoky hearth
#

And "messing with panorama" is pretty vague.

crude oriole
smoky hearth
#

Well that says, <script> is not allowed in custom_ui_manifest.
You can still use it in other xml's, and there is both <script> and <scripts>

#

Plural is for linking js files where the code would be.
Singular is for writing js code in the xml

crude oriole
#

I see

crude oriole
#

doth sound and particle dont work

#

if I change it to something like cheese or w/e it does work

smoky hearth
#

Dotas items have all effects and sounds precached in every game because items are always in every game.
Hero/ unit stuff is not unless the hero is picked or you explicitly precache it.

Custom items are a little weird with precaching, it's been a long time so I'm not entirely sure but i think you need to call this in addon_game_mode's precache function in addition to that

wind gateBOT
#

Found 2 functions for precacheitem

🇸 PrecacheItemByNameAsync(itemName: string, callback: (precacheId: int) → nil): nil
Asynchronously precaches a DOTA item by its dota_npc_items.txt name, provides a callback when it's finished.
🇸 PrecacheItemByNameSync(itemName: string, context: CScriptPrecacheContext): nil
Precaches a DOTA item by its dota_npc_items.txt name.

smoky hearth
#

If that doesnt work then just precache the effects in addon_game_mode instead. As an item it always needs to be precached anyway

crude oriole
#

I'll try

#

what's the difference between asynchronously and synchronously?

smoky hearth
#

Sync is done immediately.
Async is done whenever there are spare resources.

#

Whenever possible you want to use async functions over sync, to prevent hiccups in the servers performance.
But in some cases you need sync

crude oriole
#

even that doesnt work

#

I am so confused

#

also tried precacheitembynamesync and it didn't work

reef lava
#

Ability precache is an ability method
Have a look at the first chunk of code I sent
I didnt know this was for an item, item precache is jankass so I always just put it into the addon_game_mode precache

sleek summit
#

I'll also add that precaches on abilities occur when an ability is created. For heroes, that's usually great because heroes typically start with abilities and don't change them during the course of the game. There's usually just 1 of each ability in the game.

However, for items, which can be bought multiple times, it might be better to just precache the effect on addon_game_mode. This makes it so the precaches are done at the start of the game

crude oriole
crude oriole
#

I tried putting it on addon_game_mode

#

but it didnt work

#

this is why I found it weird

#

even precaching on the item lua doesnt work

#

am I really gonna have to pull the soundfile / particle separately and throw it into my mod

#

instead of getting it from dota itself

heavy dock
#

Let's try another tricking way: create a rattletrap on map, then delete him

crude oriole
#

I think I wanna figure the sound first

#

but I can try that as well

#

oh you mean on top of the createparticle function?

#

can I still create a rattletrap considering he's disabled on herolist?

#

maybe the particle I want doesn't exist? idk

#

but I checked it in the assets browser

smoky hearth
#

you need to precache the sound events file for clockwerk (not individual sound files), and then play the sound thats listed there.

crude oriole
#

I thought I just pulled the corresponding file

#

from whatever showed in assets browser

#

let me check

smoky hearth
#

so for that sound effect the actual name you use in EmitSound is Hero_Rattletrap.Rocket_Flare.Explode

#

and the file you need to precache is game_sounds_rattletrap.vsndevts

crude oriole
#

something like this?

smoky hearth
#

yes

crude oriole
#

do I put the folder as soundevents

#

or just gamesounds rattletrap

smoky hearth
#

been too long, idk. gimmie a moment to find an example.

#

how you have it should be correct

crude oriole
#

still doesnt work

#

gg

smoky hearth
#

well now we're back to the issue of "items are jank at precaching" i think.
try putting the precache in addon_game_mode

#

and just to make sure. you are reloading the map after these changes, correct?

crude oriole
#

lets see

#

yes

#

but I'm doing it through the console

#

instead of hammer

#

idk if that matters

smoky hearth
#

no thats fine

crude oriole
#

but I'm assuming not because all lua scripts update

#

OK IT WORKS

#

THE AUDIO AT LEAST

#

THANK GOD

smoky hearth
#

great

crude oriole
#

gonna remove it from the lua file

#

and keep it only on addon to see if it still works

#

it does ok

#

nice

#

what about the particle now

#

do I import it differently like in the game_sounds

smoky hearth
#

no, the particle one is done how you have it (assuming the filepath is correct)

crude oriole
#

hmmm

#

is it particle instead of particles

#

wait

#

oh it works now

#

ok now I just have to figure out

#

how to make the particle spawn at my cursor / point target

#

is it just pattach absorigin on target_position?

smoky hearth
#

depends on the particle.
but the 'absorigin' pattachments are for attaching the particle to a unit.
if you just want it at a point in the world it probably be PATTACH_POINT

smoky hearth
#
local particle_id = ParticleManager:CreateParticle(...)
ParticleManager:SetControlPoint(particle_id, 0, position)

something like that

crude oriole
#

pattach_point isnt compatible with getcursorposition

#

what should I use instead?

smoky hearth
# crude oriole

in createparticle the last parameter is the unit the particle should be associated with, it can be nil.
its for things like fog of war hiding/showing the particle when the unit cant/can be seen for example.

#

you set the position with control points

crude oriole
#

oh

#

I see

#

I tried with nil instead of caster as well

smoky hearth
#

my bad

wind gateBOT
#

Found 8 functions for SetParticleControl

🇸 🇨 CScriptParticleManager:SetParticleControl(particle: ParticleID, controlPoint: int, value: Vector): nil
Set the control point data for a control on a particle effect.
🇸 🇨 CScriptParticleManager:SetParticleControlEnt(particle: ParticleID, controlPoint: int, unit: CBaseEntity, particleAttach: ParticleAttachment_t, attachment: string, offset: Vector, lockOrientation: bool): nil
🇸 🇨 CScriptParticleManager:SetParticleControlFallback(particle: ParticleID, controlPoint: int, vecPosition: Vector): nil
🇸 🇨 CScriptParticleManager:SetParticleControlForward(particle: ParticleID, controlPoint: int, arg3: Vector): nil
[OBSOLETE - Use SetParticleControlTransformForward] (int nFXIndex, int nPoint, vForward).
🇸 🇨 CScriptParticleManager:SetParticleControlOrientation(particle: ParticleID, controlPoint: int, arg3: Vector, arg4: Vector, arg5: Vector): nil
[OBSOLETE - Use SetParticleControlTransform] (int nFXIndex, int nPoint, vForward, vRight, vUp) - Set the orientation for a control on a particle effect (NOTE: This is left handed -- bad!!).
and 3 more…

crude oriole
#

oh

#

what's the int value for

#

controlPoint: int

#

works perfectly now

smoky hearth
#

particles can have any number of control points that influence their effects.
its different for every particle.
some have just cp0, some have like 15 of them.

crude oriole
#

beautiful

#

thank you

smoky hearth
#

you can see if you open the particle in the particle editor what the cps do by changing their values.
clicking them also highlights what properties read them