PDA

View Full Version : Hero: Toriko


RollerBlades
04-18-2011, 11:03
Toriko the Gourmet Hunter
You can gain unlimited health and become unstoppable, get more fighting experience and so the more you kill the Stronger you'll become!

http://en.wikipedia.org/wiki/Toriko

Description:
gain extra HP from Killing - health you gain from killing exceeds your maxhealth and doesn't have a health limit.
Devour twice as much health by killing someone with headshot


shconfig.cfg CVARS

//Toriko
toriko_level 7
toriko_killsneed 5 // How many people you have to kill in order to gain hp
toriko_hpgained 100 // How much health is gained on a streak
Changelog:
* v 1.1 - RollerBlades - 20/04/11
* - Code cleaned up.
* - Added double health for killing with headshot.
Hope you enjoy this hero :mrgreen:

**Credits** - This is ripped from killstreak plugin so credits goes to Jelle and Fr33m@n!

The Art of War
04-18-2011, 11:08
You know, you even stated yourself that you ripped it, but as that is a plugin well, not as bad as it could be atleast!

Oh, yeah, "Haunter", in sh_set_hero_info is spelled "Hunter", as you spelled it everywhere else correctly.

Why are you checking gHasToriko twice? You only need one of them.

if ( !sh_is_active() || !gHasToriko[attacker] ) return

if ( gHasToriko[attacker] && is_user_connected(attacker) && is_user_connected(victim) && victim != attacker )

RollerBlades
04-18-2011, 11:59
opss srry i must have totally missed that when i double checked the code.

but the code is still okay otherwise?

this is weird: // How many you need to kill need to gain hp XD???? i really suck at english :D

kennyke12
04-18-2011, 14:29
Not bad but may we need to report to the players how many kills they need...

RollerBlades
04-18-2011, 15:04
i dont think we need, usually you only need to kill 1 person to get more hp but if you change it and you want to know how many kills you need i think you have to do it yourself...

Exploited
04-18-2011, 15:45
this is weird: // How many you need to kill need to gain hp XD???? i really suck at english :D

// How many people you have to kill in order to gain hp

or a somewhat shorter version

// Amount of kills needed for extra HP

The Art of War
04-18-2011, 16:19
i dont think we need, usually you only need to kill 1 person to get more hp but if you change it and you want to know how many kills you need i think you have to do it yourself...

In my opinion this should really be hardcoded into something higher than 2... As if you set it to one its basically a 100% Dracula..

Would be funny with like 4-5 killstreak and if you reach it you get a massive health bonus, though its not directly balanced, something that Im always as cranky about as Fr33m@n about code efficiency :D

Jelle
04-18-2011, 19:56
If default is 1 for how many kills is needed you might as well not even have that cvar.

Either you should do as art says or remove the cvar for how many kills is needed. The way it is now it just seems kinda strange.

RollerBlades
04-19-2011, 03:05
i set to 1 beacuse it more fun to get health right after you kill someone but if you want it different change it then, that's the reason why i gave you guys the cvar incase you want to change.....

nothing needs to be changed, it's just a simple code, made out of a great idea

The Art of War
04-19-2011, 03:23
i set to 1 beacuse it more fun to get health right after you kill someone but it you want it different change it then, that's the reason why i gave you guys the cvar incase you want to change.....

nothing needs to be changed, it's just a simple code, made out of a great idea

But as it is now it is:

1. A rip in two ways, ripped from a superhero plugin (Not that bad, I guess thats okey, why not). But also there are atleast 2-3 heroes that gives you health, released and known I can tell you is Dracula, then we have that Head Shooter hero and there are of course others.

2. The hero does not follow the description, or the reversed, which I think is stated in the rules for this section that the description should tell what the hero does, but thats not very important, I guess, but still.


I didnt exactly test it but it looks ok, yes. But I would never even consider using it anywhere if the cvar would be 1 (Im not saying you could change it, but a lot of stupid server operators actually doesnt know or vice versa). I otherwisely hate hardcoded things with all of my heart but this hero is nothing new at all if it's not hardcoded. But you made it, you choose.

Well, you did give proper credits. Ive seen a lot worse from people in that part..

RollerBlades
04-19-2011, 03:27
if you want something hardcoded i can add a cooldown so that after you kill someone you gain 100hp and then you have to wait 1-2minute ore something.....

The Art of War
04-19-2011, 03:30
Hardcoded means that a value or such is not a cvar or anything, that you have to look it up in the code were the value is used, for example in a native, and change it. Atleast thats what I believe it is..

Its your hero, Im just saying its exactly like a lot of other heroes if it does not have a killstreak. You could add a check so that 2 would be the minimum value of the cvar though.

I actually like how you reset the gKillsNeed, I guess you meant kills, not kills needed, as that is the cvar ^^ Doesnt matter ingame but was a bit confusing until I saw how you used it. I like that you are setting it to 0 on death for the attacker instead of using sh_client_spawn that would be less efficient!

One thing if you want to be insane like some people here (hur hur!) about efficiency, I can only see "iHealthGain" once being used in sh_add_hp, meaning you should'nt cache it, instead use

sh_add_hp(attacker, get_pcvar_num(pCvarGain), true)

Of course it doesnt matter unless as I said before want to "witch hunt" for efficiency.

RollerBlades
04-19-2011, 03:41
uhmmm, the reason why i dont want it higher then 1 is beacuse it looks better and is more useful when you get the health right after you kill someone, but i also got another idea that you use Bind Key and press the key to go into a "Knife and Fork" mod and while your in it you must kill as many player's as possible and after you leave "Knife and Fork" mod the hero counts how many you killed and gives you 20+ hp for each one you killed

oreeee i do nothing.....

The Art of War
04-19-2011, 03:43
uhmmm, the reason why i dont want it higher then 1 is beacuse it looks better and is more useful when you get the health right after you kill someone, but i also got another idea that you use Bind Key and press the key to go into a "Knife and Fork" mod and while your in it you must kill as many player's as possible and after you leave "Knife and Fork" mod the hero counts how many you killed and gives you 20+ hp for each one you killed

oreeee i do nothing.....

Sounds a lot better than having it as 1 as I guess vittu would thrash it because it is exactly the same as a 100% Dracula.


Nice idea, really. Want me to put something together to help you? Not saying Im awesome here, but I use sh_hero_key pretty often.. (Keydowns are awesome)

RollerBlades
04-19-2011, 03:45
is it okay if i got both versions posted in one thread?

ore is it a trash risk?

thing is dracula only drains hp from damage when your current healt is lower then your maxhp but this one exceeds maxhp and it doesn't got a limit

The Art of War
04-19-2011, 03:58
is it okay if i got both versions posted in one thread?

ore is it a trash risk?

thing is dracula only drains hp from damage when your current healt is lower then your maxhp but this one exceeds maxhp and it doesn't got a limit

Ah, true, didnt think of that, will have to look into Head Shooter to see if it does that too, I think it does. But that idea you had is kind of cool, really.

Oh, well, Head Shooter restores the max health instantly when you kill someone with a headshot, never mind.

RollerBlades
04-19-2011, 06:47
well i im not good a loops and other advanced stuff so can you post a code how it should look

Jelle
04-19-2011, 07:07
I've put together something which you can use for reference. Try to work out how you want to do it and just this for help. It is not complete. There is no cooldown to this.


public sh_hero_key(id, heroID, key)
{
if ( gHeroID != heroID ) return

//if key down is pressed
if ( key == SH_KEYDOWN )
{
//Tell the guy that he just used it
client_print(id, print_chat, "[SH] Knife and fork mode entered")

//Set a task to run after some seconds, this task will remove the counter
set_task(get_pcvar_num(pcvarKnifeForkTime), "reset_mode", id)

//User is now in fork time
gForkTime[id] = true
}
}

//and we hook death to count when he kills someone in fork time
public sh_client_death(victim, attacker)
{
//If the attacker is in fork time and has the hero, add 1 to the kills
if ( gForkTime[attacker] && gHasHero[attacker] )
{
//Add 1 to kills
gKills[attacker]++
}
}

//and the called task here
public reset_mode(id)
{
//user is no longer in fork time
gForkTime[id] = false

//calculate health whitch should be added
new Health = get_pcvar_num(pcvarHealthToGiveEachKill) * gKills[id]

//add the health
sh_add_hp(id, Health)

//reset kills for next use
gKills[id] = 0
}

RollerBlades
04-19-2011, 07:15
BAD!
set_task(get_pcvar_num(pcvarKnifeForkTime), "reset_mode", id)

to:

GOOD!
set_task(get_pcvar_float(pcvarKnifeForkTime), "reset_mode", id)

EDIT:
Is it ok if i put gForkTime as a bool?

Okay i made this super fast i didn't double check or test it i just made it compile so here's the sma:

The Art of War
04-19-2011, 09:33
Lol Jelle fail. Exactly, tasks has to be floats.


Yes you can make it a bool.

Why are you setting a task for the cooldown? sh_set_cooldown() does all that automatically, use that instead!

Again, you do not need to cache the health value if you want to be an efficiency hunter.

Could you test it?

RollerBlades
04-19-2011, 09:39
no, i dont use superheromod anymore so i cant test it

and yea tasks have to be floats

ohh, i didn't know that

i didnt jelle did but just a sec ill change that in a moment

EDIT:

does anyone have screenshots off this hero working?

fixed!

Jelle
04-19-2011, 15:27
Yeah yeah, just jump on me because of my float problems ^^

RollerBlades
04-19-2011, 16:33
well i wont probably post a single hero in one year from now on there's just to many posts about the code(you actually learn alot from that) and nothing good about the idea, just makes more depressed.... i hope i dont have to change anything again! members of alliedmodders be sastified for once.
this whole post is like a scripting tutorial

I command you to download the sheet and have fun with it now!

I just wanted to be original :3

Emp`
04-19-2011, 16:44
The idea is original, we're just helping improve it.

As it currently is, it does not work as you intend.

toriko_killsneed is not actually referenced.

If you don't get it to work as you say it should, I'll have to move it to Unapproved.

RollerBlades
04-19-2011, 16:48
this is like a 5min hero so yea i will stick to this hero for a long time and there's still alot to learn so ill keep updating though im sometimes i get lazy and just dont wanna look at the code, or am i the only one who thinks that?

so dont move the hero anywhere from now on please and just try helping me whenever you guys feel like ;)

weird on off is that there's 2 sma and that equals twice as hard work

The Art of War
04-19-2011, 17:16
Rule number one before posting heroes is to actually test them, if you want them approved or not thrashed of course.

Im not trying to be rude, Im just saying that if you dont change what the hero is doing in the first post, its been done before, its just that you can make it be a little more original.

I really like the idea you had, and Im willing to help. If you really cant test it, I can, get in CS and add this to favourites:

78.82.192.116:27015

Jelle
04-19-2011, 19:22
You shouldn't post it in new submissions if you are not quite sure if it works. There is a reason why we have a forum called "Scripting help". That is for when you need help scripting or need help testing something.
Don't expect us to test it for you, we will test it with you. You are in a community now, time to stop those silly egoistic stuff and start sharing and help where you can. That is how we grow and have fun.

RollerBlades
04-20-2011, 03:21
Srry, Jelle i already thought it was working from the beginning as it shoud, now im chocked and it happens that i get confused sometimes but i thought at first that you guys wanted to change the idea of the hero but that's the only thing i want to stay original but i guess i was wrong about that, you were just trying improve it, well i would also like to help you guys but im not good at the advanced stuff so please bare with me cause i want the 1st sma to work and it seems somethings missing, i just want everyone to share this hero as i wanted it from the beginning but the killsneed doesn't work properly i think and that's whats makes me so mad just trying to change on it when it shoudve been done from the beginning but i coudn't test it cause i dont run superheromods anylonger i run my own custom mods so sure improve it but i want to keep the original with me DEAL??

here's how far ive done myself im sure alots missing but ive done my best this time, please just work

The Art of War
04-20-2011, 04:18
Srry, Jelle i already thought it was working from the beginning as it shoud, now im chocked and it happens that i get confused sometimes but i thought at first that you guys wanted to change the idea of the hero but that's the only thing i want to stay original but i guess i was wrong about that, you were just trying improve it, well i would also like to help you guys but im not good at the advanced stuff so please bare with me cause i want the 1st sma to work and it seems somethings missing, i just want everyone to share this hero as i wanted it from the beginning but the killsneed doesn't work properly i think and that's whats makes me so mad just trying to change on it when it shoudve been done from the beginning but i coudn't test it cause i dont run superheromods anylonger i run my own custom mods so sure improve it but i want to keep the original with me DEAL??

here's how far ive done myself im sure alots missing but ive done my best this time, please just work

If you want that, what would we improve?

RollerBlades
04-20-2011, 04:23
i just want to make sure that the killsneed worked so this time i double checked and fixed it though i dont know scripting that well so i thought WE could fix it. that's all i want or else im not following the description and WE are risking unapproval or trash

The Art of War
04-20-2011, 04:36
The first script? It is nothing else than the same as atleast 4 other heroes with a very little twist, but its your choice.

RollerBlades
04-20-2011, 05:16
well does the other script work too?

all i need is a screenshot of this hero working properly and im sastified

Jelle
04-20-2011, 06:25
RollerBlades, you might not run a server with SH mod, but download one using HLDS update tool, then install SH mod on your own computer with bots, then you have the possibility to test your stuff before you release it. That is what the rest of us are doing. I could never dream of putting an untested code up on a Red Doom official server, it might not work.

Then if you are having trouble, post in the scripting section and post the code for us and tell us whats wrong.

I am not entirely sure what you are trying to write when you write that you just want a screenshot of it working. Do you want us the fix the code completely for you?
I could do that, but you wont learn anything from it. You should try to figure out the stuff yourself.

I did not release a hero as fast as you have done. You have only been here for 2 month. I had been here for over half a year before I released my first hero, and that one got unapproved.

RollerBlades
04-20-2011, 06:28
i dont even know if there's a problem that's why im asking you guys if there is

Jelle
04-20-2011, 06:29
Do as I wrote. Download your own local server for your LAN, then add bots and start testing.

The Art of War
04-20-2011, 06:32
i dont even know if there's a problem that's why im asking you guys if there is

That is exactly why you must always test before you release anything. I have got fatal errors all over the place (not when compiling of course), causing massive svc_bad or engine errors crashing the game, and I have discovered small bugs by testing stuff into infinity. It can all be pretty easily discovered while testing, so, yeah. Download the 1.2.0.14 or build 16 bug fix from the svn (is it still up? :o), get AMX MOD X installed first, then install SuperHero Mod onto the standalone HLDS or the Steam Dedicated Server Tool.

RollerBlades
04-20-2011, 06:38
I'll do that when i have time and Art do you remember when you said you wanted something hardcoded? well i dont know if you meant something like this but maybe you'll like this

The Art of War
04-20-2011, 06:44
Yes, or just remove the cvar completely, or make a check like this:


if ( get_pcvar_num(pCvarKills) > 2 ) pCvarKills = 2

Would set the cvar to 2 if its lower than 2.

RollerBlades
04-20-2011, 14:09
Well, is the hero more diffrent from other heroes now?

RollerBlades
06-22-2011, 17:45
i found a problem! the problem is it wont give you more health if gPcvarKills is set higher then 1 so will this fix i??

Old Code//Toriko - Become a Gourmet Hunter!

//This is ripped from killstreak plugin so credits goes to Jelle and Fr33m@n!

/* CVARS - copy and paste to shconfig.cfg

//Toriko
toriko_level 7
toriko_killsneed 1 // How many people you have to kill in order to gain hp
toriko_hpgained 20 // How much health is gained on a streak
*/

/*
* v 1.1 - RollerBlades - 20/04/11
* - Code cleaned up.
* - Added double health for killing with headshot.
*/

#include <superheromod>

// GLOBAL VARIABLES
new gHeroID
new const gHeroName[] = "Toriko"
new bool:gHasToriko[SH_MAXSLOTS+1]
new gKillCount[SH_MAXSLOTS+1]
new pCvarKills, pCvarGain
//----------------------------------------------------------------------------------------------
public plugin_init()
{
// Plugin Info
register_plugin("SUPERHERO Toriko", "1.1", "RollerBlades")

// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
new pcvarLevel = register_cvar("toriko_level", "7")
pCvarKills = register_cvar("toriko_killsneed", "1")
pCvarGain = register_cvar("toriko_hpgained", "20")

// FIRE THE EVENT TO CREATE THIS SUPERHERO!
gHeroID = sh_create_hero(gHeroName, pcvarLevel)
sh_set_hero_info(gHeroID, "Knife and Fork", "Become a Gourmet Hunter and Eliminate your enemies to get Stronger.")
}
//----------------------------------------------------------------------------------------------
public client_connect(id)
{
gKillCount[id] = 0
}
//----------------------------------------------------------------------------------------------
public sh_hero_init(id, heroID, mode)
{
if ( gHeroID != heroID ) return

gHasToriko[id] = mode ? true : false
}
//----------------------------------------------------------------------------------------------
public sh_client_death(victim, attacker, headshot)
{
if ( !sh_is_active() || !gHasToriko[attacker] ) return

if ( is_user_connected(attacker) && is_user_connected(victim) && victim != attacker )
{
gKillCount[attacker]++

if ( gKillCount[attacker] <= get_pcvar_num(pCvarKills) )
{
gKillCount[attacker] = 0

sh_add_hp(attacker, get_pcvar_num(pCvarGain), true)
}
else if ( gKillCount[attacker] <= get_pcvar_num(pCvarKills) && headshot )
{
gKillCount[attacker] = 0

sh_add_hp(attacker, get_pcvar_num(pCvarGain) * 2, true)
}

gKillCount[victim] = 0
}
}
//----------------------------------------------------------------------------------------------changed in sh_client_death//Toriko - Become a Gourmet Hunter!

//This is ripped from killstreak plugin so credits goes to Jelle and Fr33m@n!

/* CVARS - copy and paste to shconfig.cfg

//Toriko
toriko_level 7
toriko_killsneed 1 // How many people you have to kill in order to gain hp
toriko_hpgained 20 // How much health is gained on a streak
*/

/*
* v 1.1 - RollerBlades - 20/04/11
* - Code cleaned up.
* - Added double health for killing with headshot.
*/

#include <superheromod>

// GLOBAL VARIABLES
new gHeroID
new const gHeroName[] = "Toriko"
new bool:gHasToriko[SH_MAXSLOTS+1]
new gKillCount[SH_MAXSLOTS+1]
new pCvarKills, pCvarGain
//----------------------------------------------------------------------------------------------
public plugin_init()
{
// Plugin Info
register_plugin("SUPERHERO Toriko", "1.1", "RollerBlades")

// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
new pcvarLevel = register_cvar("toriko_level", "7")
pCvarKills = register_cvar("toriko_killsneed", "1")
pCvarGain = register_cvar("toriko_hpgained", "20")

// FIRE THE EVENT TO CREATE THIS SUPERHERO!
gHeroID = sh_create_hero(gHeroName, pcvarLevel)
sh_set_hero_info(gHeroID, "Knife and Fork", "Become a Gourmet Hunter and Eliminate your enemies to get Stronger.")
}
//----------------------------------------------------------------------------------------------
public client_connect(id)
{
gKillCount[id] = 0
}
//----------------------------------------------------------------------------------------------
public sh_hero_init(id, heroID, mode)
{
if ( gHeroID != heroID ) return

gHasToriko[id] = mode ? true : false
}
//----------------------------------------------------------------------------------------------
public sh_client_death(victim, attacker, headshot)
{
if ( !sh_is_active() || !gHasToriko[attacker] ) return

if ( is_user_connected(attacker) && is_user_connected(victim) && victim != attacker )
{
gKillCount[attacker]++

if ( gKillCount[attacker] <= get_pcvar_num(pCvarKills) )
{
gKillCount[attacker] = 0

sh_add_hp(attacker, get_pcvar_num(pCvarGain) * get_pcvar_num(pCvarKills), true)<<<<THIS!
}
else if ( gKillCount[attacker] <= get_pcvar_num(pCvarKills) && headshot )
{
gKillCount[attacker] = 0

sh_add_hp(attacker, get_pcvar_num(pCvarGain) * get_pcvar_num(pCvarKills) * 2, true)<<<<THIS!
}

gKillCount[victim] = 0
}
}
//----------------------------------------------------------------------------------------------

DarkGod
06-23-2011, 06:34
I don't get the code.

RollerBlades
06-23-2011, 08:21
it adds health if you killed a player or players

The Art of War
06-24-2011, 15:52
I don't get the code.

My first impression too, please hardcode the streak into 2+ or it is like 5 other heroes. Yey a new smiley rukia

RollerBlades
06-25-2011, 05:38
sure, but i dont think hardcoding( i hate hardcoding ) is necessary i just changed the cvar to 5

like i said its not like other heroes since on dracula you drain small amount of hp from the dmg your dealing on a alive player and the higher level you are the more you drain each time you deal dmg on someone..

this hero gives health when you kill a player or players and it exceeds your maxhealth.. i dont see the connection between 5 other heroes and hardcoding is not gonna change that since its ingame that matters...

edit: i took away the fix since the cvar hpgained doesnt need to be multiplied by the killsneed instead you increase its value

DarkGod
06-25-2011, 07:33
I agree with that you shouldn't hardcode it. It's a lot better to use CVars for this.

The Art of War
06-25-2011, 14:17
i dont see the connection between 5 other heroes and hardcoding is not gonna change that since its ingame that matters...



Precisely, Im not saying the code is similar, but that the ingame effect is. Its your hero, Im just saying, that it should be different than others, and yes there are a lot of health draining heroes out there...

I agree I hate hardcoding aswell, perhaps make a pcvar check and set it to 2 if the value is less than 2, but yeh.. "Softcore" hardcoding then.