Adding poison with multiple instances

Please post any questions about developing your plugin here. Please use the search function before posting!
arawra
Senior Member
Posts: 190
Joined: Fri Jun 21, 2013 6:51 am

Adding poison with multiple instances

Postby arawra » Wed May 27, 2015 1:30 pm

Trying to wrap my ahead around a such that I can 'poison' a person, and if I do it again EXTEND the original duration, and allow others their own instances.

This is my first solution and am looking for pointers or other helpful information.

Syntax: Select all

#called on the victim, such as victim.poison(attacker, 5, 3, 6)

def poison(self, attacker, amount, interval, total=0):
#PlayerDataDictionary stores things such as maximum hp, max speed ,etc
if PlayerDataDictionary[self.steamid].poison:
for instance in PlayerDataDictionary[self.steamid].poison:
if instance[1] != [attacker, amount, interval]:
#safeDamage is a point_hurt wrapper
myTimer = TickRepeat(safeDamage, self, attacker, amount)
#Tracking timers to end them all at round_end
timers.append(myTimer)
myTimer.start(interval, total)
PlayerDataDictionary[self.steamid].poison.append([myTimer, [attacker, amount, interval]])
else:
instance[0].extend(total)
else:
myTimer = TickRepeat(safeDamage, self, attacker, amount)
timers.append(myTimer)
myTimer.start(interval, total)
PlayerDataDictionary[self.steamid].poison.append([myTimer, [attacker, amount, interval]])

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 45 guests