AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Electric Ball with Consecutive damage (https://forums.alliedmods.net/showthread.php?t=253293)

AGoodGuy 12-19-2014 12:00

Electric Ball with Consecutive damage
 
Hi all, i have some idea and making something call: Electric Ball

Plz look this image, you can easy imagine:

http://th05.deviantart.net/fs70/200H...gn-d6wc7h2.jpg


And i stuck in step: Make Consecutive damage when any player touch this. Any one have some way to make Consecutive damage? Please help me to create this idea. Thank so much! :D

HamletEagle 12-19-2014 12:04

Re: Electric Ball with Consecutive damage
 
More ExecuteHamB(Ham_TakeDamage,...) with different damages ?

AGoodGuy 12-19-2014 12:07

Re: Electric Ball with Consecutive damage
 
- Yes, Consecutive !

Take damage like this men in this video, LOL :D:

https://www.youtube.com/watch?featur...EfU47QY_k#t=14

- My idea is skill to throw electric ball to 1 place and any player touch this will take Consecutive damage :D

RateX 12-19-2014 12:27

Re: Electric Ball with Consecutive damage
 
You want the player takes damage after he touches it or while he's still touching it?

AGoodGuy 12-19-2014 12:32

Re: Electric Ball with Consecutive damage
 
While he's still touching, thanks!
You can understand like this:

Player-->touching electric ball--> Damage His HP Consecutive until the ball remove or he moving out of this!

RateX 12-19-2014 12:52

Re: Electric Ball with Consecutive damage
 
Use register_touch/Ham_Touch, then in touch funtion use Ham_TakeDamage. Since touch can be call a lot of times per second, use get_gametime() to control the interval between each time you use Ham_TakeDamage.

AGoodGuy 12-19-2014 13:02

Re: Electric Ball with Consecutive damage
 
@Ratex: Can i use set_task for this? Because, i knew, ham_touch is not a loop like cmd or pre_think so can't use get_gametime()?

Can you make for me 1 simple example with code?

RateX 12-20-2014 01:16

Re: Electric Ball with Consecutive damage
 
Here's an example:
PHP Code:

register_touch("Your_Entity_Classname""player""Your_Touch_Funtion")

public 
Your_Touch_Funtion(YourEntIDPlayerID)
{
    if(!
pev_valid(YourEntID))
        return
    if((
get_gametime() - last_damage_time) < interval_time)
        return
    
last_damage_time get_gametime()
    
//use Ham_TakeDamage here...


In the above code, I use get_gametime() because you can control interval time < 0.1, while set_task can only have minimum of 0.1. Also, get_gametime() is far more simple.

You can store last_damage_time in a global var like last_damage_time[33] for each player, or store it in ball entity's empty value holder from fuser1 to fuser4.

AGoodGuy 12-20-2014 02:57

Re: Electric Ball with Consecutive damage
 
Thank so much for your help, i will try to make this. :)


All times are GMT -4. The time now is 15:26.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.