Hmm interesting problem you have here... i don't have much knowledge about these things but a "rudimentary" idea might be to create an copy of every item and remove the abilities of those copies... when the hero takes the flag his items should be replaced with its copy and vice versa when the flag is dropped. Yet this way requires a lot of triggering and there should be a easier way to do it with JASS (which i don't know sorry).
You could use something like Engineering Upgrade, where the flag has the ability. Have one of the fields with your original spell at the top, then make a dummy skill based off Channel with Visible unchecked. This should replace the ability with nothing when the flag is taken, then restore the ability when the flag is dropped.
maybe, if when a hero picks up the flag it drops his items and moves them elsewhere, until the unit drops the flag, maybe also prevent any unit carrying the flag from picking up other items.
make a dummy invisible unit you give to each player make that unit the tech tree requirement to cast the item ability when hero picks up flag take away ownership of the dummy unit.
Quite simple, like johhny said. When a player picks up the flag, (use a player string to make the triggering easier) swap the ability he has and the abilities the flag has to ones that work and dont. For example nightstalkers passive in dota when it turns night he gains a bonus movement speed etc and at day time it goes away. The ability icon is the same but instead of being endurance aura + .2% its 0, so it looks the same just has no bonus's...hope i helped!
i think i found a easier solution.
Hero pick the flag.
Item with active ability -remove , Then
Give to hero the same item but without the active ability, so if click to the item
nothing do.
: D
I'm on a page about incorrect corrections, and spent the better part of like two hours trying to get someone to understand that -5^2 = -25, not 25, and then that post had comments get reposted because that group is self sustaining, and that person was in turn trying to explain what I just explained to them. And I'm taking that as a victory
I will be AFK for a couple of days you guys hold down the fort while I am gone. I will be checking in on my phone but that will severly limit me. Be back saturday!