Page 1 of 1
Poison mine
Posted: Wed May 27, 2009 1:14 pm
by Executer94
How can i do that. A mine which doesn't damage so heavy but poison you like the debuff poison from the magna guard.
I try something out but the player didn't get poison.
Re: poison mine
Posted: Wed May 27, 2009 10:50 pm
by [TFA]Padawan_Fighter
What exactly did you try?
Re: poison mine
Posted: Thu May 28, 2009 8:31 am
by Executer94
I want to have a mine for my new upcoming map which has the same effect as the secound weapon of the magna guard (debuff_posion).
Re: poison mine
Posted: Thu May 28, 2009 7:48 pm
by Fiodis
I can think of a way to do this via a short bit of hectic LUA coding, but I'd rather see first if there's any ODF solution. I know Mav's rigged poison grenades, which I think activate a low-altitude orbital strike somehow? You might want to fool around with that and see what you get.
When you say effect, did you mean the explosion visual effect? That' won't change any damage; visual effects do not determine damage.
Re: poison mine
Posted: Thu May 28, 2009 9:03 pm
by hammythepig
Well, I can't help you, but I definatly want to know the answer to this, that would be so cool!
Re: poison mine
Posted: Thu May 28, 2009 9:55 pm
by Fiodis
Right.
I can't think offhand of any ODF solution, though there may be one. I'll post the general code outline now; I haven't the time to type the whole thing out right at the moment since I have roughly three days of sleep to chase after.
0. Set up a Poison Mine ODF that works same way as normal mine, but has an extremely small amount of damage (say, 1 damage). It will work with any amount of damage,so you can set it higher if you want poison
and a small explosion or two.
1. On player dispense mine, check if dispensed mine's ODF matches "Poison Mine" weapon ODF. If yes, store player's name as a variable.
2. On character damage, check via GetObjectLastHitWeaponClass if the character was damaged by the "Poison Mine". If yes, apply negative health regen to simulate poison, and attach an effect to the unit if you want to, though how you'd get the effect on just that unit I can't imagine. Also, start a certain timer.
3. On timer elapse, remove the negative health regen. Also, check to see if the unit that the negative health regen was applied to is dead. If yes, grant a certain amount of points to the player who dropped the mine (calling him up through the variable mentioned in step 1). And reset timer. If it's necessary to reset timer.
Of course, this has a number of bugs that would take more code to iron out or work around, if possible. At its current state it would work best in a singleplayer situation with only the human having the weapon.
If no LUA expert sees fault with this (at least any more-than-moderate, un-workaroundable fault), I'll go ahead and take a rough stab at the actual code tomorrow. In the meantime, it's time for me to
...well, that.
Re: poison mine
Posted: Fri May 29, 2009 1:20 am
by DarthD.U.C.K.
couldnt you make it an autoturret with 0.5 lockonrange and a selfdestructionweapon?
Re: poison mine
Posted: Fri May 29, 2009 6:17 am
by Fiodis
That would work just as well; though you would have to make it have a mine's mesh. In fact, that might work better. I'm not so certain you can detect a player dropping a mine, but you can for sure get him dropping a turret.
You don't even need the self-destruct, just a low-damage explosion (again, 1? Set higher for more bang) and kill the object via LUA.
Re: poison mine
Posted: Fri May 29, 2009 6:31 am
by DarthD.U.C.K.
yes, but if you are not experienced in lua (like me), the selfdestruction is easyer

Re: poison mine
Posted: Fri May 29, 2009 6:38 am
by Fiodis
Woah boy, hold it. If we use a turret how do we get it to detonate when the target approaches?
Perhaps a self-destruct, as you mentioned earlier, would be the better path around that problem.
Re: poison mine
Posted: Fri May 29, 2009 7:07 am
by DarthD.U.C.K.
we get it to detonate when the target approaches through the lockonrange= "extremelysmallnumber"
which will him make only fiering the selfdestructing weapon when an enemy reaches that radius
Re: poison mine
Posted: Fri May 29, 2009 5:28 pm
by Fiodis
The the GetObjectLastHitWeaponClass equalling the turret's self-destruct weapon's ODF triggering the negative health regen. Excellent! I'll get to work on it.
Just the script, mind you; you'll have to set up the ODFs yourself.
Re: poison mine
Posted: Sun May 31, 2009 10:44 pm
by Nylad
Or you could just give the turret a poison weapon with tiny range and ApplyOnOwnerIfOnOthers set to 1 and set the damage scale for buildings pretty high. This way, the turret would kill itself and poison all those around, providing the desired effect. This solution wouldn't require any LUA coding, if it worked.
EDIT: hmm... I want to test this now. I'll get back to you on this.
Re: Poison mine
Posted: Mon Jun 01, 2009 8:44 am
by DarthD.U.C.K.
nylad, thats exactly what i allready suggested

Re: Poison mine
Posted: Mon Jun 01, 2009 7:20 pm
by Nylad
DarthD.U.C.K. wrote:nylad, thats exactly what i allready suggested

it was?

I feel silly now. I guess I was confused by fiodis mentioning scripts beyond that point like he still though it was necessary to use scripts. If anyone cares, I couldn't get it to work (crashes when it reaches unit selection screen), but that might not mean anything.
Re: Poison mine
Posted: Tue Jun 02, 2009 10:00 am
by Executer94
sorry i was in short holidays
but i'm trying to fix that in this moment

Re: Poison mine
Posted: Fri Jun 05, 2009 12:02 pm
by Executer94
my computer had a fatal crash
so this topic can be locked.