Raised This Month: $32 Target: $400
 8% 

Need help with somewhat compicated hero


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
3volution
Junior Member
Join Date: Jun 2006
Old 06-19-2006 , 23:49   Need help with somewhat compicated hero
Reply With Quote #1

I recently set up my SH server again and decided to add some custom / recode old heros . After messing around with pawn for awhile creating a few of my own heros and doing some work on others, I decided to try and make a more complicated and at least somewhat original hero. But alas, my inferior scripting knowledge could only take me so far. Instead of just scrapping the whole idea, I figured I could turn it over to some hopefully more talented people that would be willing to help me out.

Here is what I have so far:

(I know it looks similar to blue vision's hero by the same name. I used it as a starting reference (along side Zeus), but put alot of my own coding and ideas into it.)


Code:
#include <amxmodx> #include <superheromod> // GLOBAL VARIABLES new gHeroName[]="Sacrifice" new gBetweenRounds new bool:gHasSacrificePowers[SH_MAXSLOTS+1] //---------------------------------------------------------------------------------------------- public plugin_init() { // Plugin Info register_plugin("SUPERHERO Sacrifice","0.4", "") // DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG register_cvar("sacrifice_level", "18" ) register_cvar("sacrifice_cooldown", "60" ) // FIRE THE EVENT TO CREATE THIS SUPERHERO! shCreateHero(gHeroName, "Ritual of Blood: Revive Teammates", "Revive A Fallen Teammate For 150 HP", true, "sacrifice_level" ) // REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS) register_event("ResetHUD","sacrifice_newspawn","b") register_srvcmd("sacrifice_init", "sacrifice_init") shRegHeroInit(gHeroName, "sacrifice_init") // KEY DOWN register_srvcmd("sacrifice_kd", "sacrifice_kd") shRegKeyDown(gHeroName, "sacrifice_kd") // DEATH register_event("DeathMsg", "sacrifice_death", "a") // ROUND EVENTS register_logevent("round_start", 2, "1=Round_Start") register_logevent("round_end", 2, "1=Round_End") register_logevent("round_end", 2, "1&Restart_Round_") } //---------------------------------------------------------------------------------------------- public plugin_precache() { precache_sound("warcraft3/resurrecttarget.wav") } //---------------------------------------------------------------------------------------------- public sacrifice_newspawn(id) { if ( !hasRoundStarted() ) { gPlayerUltimateUsed[id] = false } else { gPlayerUltimateUsed[id] = true //dead loose their power... } } //---------------------------------------------------------------------------------------------- public sacrifice_init() { // First Argument is an id new temp[6] read_argv(1,temp,5) new id = str_to_num(temp) // 2nd Argument is 0 or 1 depending on whether the id has sacrifice powers read_argv(2,temp,5) new hasPowers = str_to_num(temp) gHasSacrificePowers[id] = (hasPowers != 0) } //---------------------------------------------------------------------------------------------- public sacrifice_death() { new id = read_data(2) if ( !is_user_connected(id) || is_user_alive(id) ) return // Look for alive players with unused Sacrifice Powers on the same team for ( new player = 1; player <= SH_MAXSLOTS; player++ ) { if ( player != id && is_user_alive(player) && gHasSacrificePowers[player] && !gPlayerUltimateUsed[player] && get_user_team(id) == get_user_team(player)) { set_task(1.0,"sacrifice_kd", 0) } } } //----------------------------------------------------------------------------------------------- // RESPOND TO KEYDOWN public sacrifice_kd() { // First Argument is an id with Sacrifice Powers! new temp[6] read_argv(2,temp,5) new id=str_to_num(temp) if ( !is_user_alive(id) ) // Let them know they already used their ultimate if they have if ( gPlayerUltimateUsed[id] ) { playSoundDenySelect(id) } new sacrificeCooldown=get_cvar_num("sacrifice_cooldown") if ( sacrificeCooldown > 0 )ultimateTimer(id, sacrificeCooldown * 1.0 ) if ( !is_user_connected(id) || is_user_alive(id) ) return // Look for alive players with unused Sacrifice Powers on the same team for ( new player = 1; player <= SH_MAXSLOTS; player++ ) { if ( player != id && is_user_alive(player) && gHasSacrificePowers[player] && !gPlayerUltimateUsed[player] && get_user_team(id) == get_user_team(player) ) { // We got a Sacrifice character willing to raise the dead! new parm[2] parm[0] = id parm[1] = (player) set_task(1.0,"sacrifice_respawn", 0, parm, 2) } } } //---------------------------------------------------------------------------------------------- public sacrifice_respawn(parm[]) { new dead = parm[0] new sacrifice = parm[1] if (gPlayerUltimateUsed[sacrifice] || gBetweenRounds) return if ( !is_user_connected(dead) || !is_user_connected(sacrifice)) return if ( !is_user_alive(sacrifice) || is_user_alive(dead) ) return if ( get_user_team(dead) != get_user_team(sacrifice) ) return ultimateTimer(sacrifice, get_cvar_float("sacrifice_cooldown")) emit_sound(sacrifice, CHAN_STATIC, "warcraft3/resurrecttarget.wav", 1.0, ATTN_NORM, 0, PITCH_NORM) new sacrificeName[32],deadName[32] get_user_name(sacrifice,sacrificeName,31) get_user_name(dead,deadName,31) client_print(0,print_chat,"%s used their Sacrificial Powers to Raise Dead Team Member %s!", sacrificeName, deadName ) set_user_health(1, get_user_health(1)-150) //Double spawn prevents the no HUD glitch (hopefully) user_spawn(dead) user_spawn(dead) emit_sound(dead, CHAN_STATIC, "warcraft3/resurrecttarget.wav", 1.0, ATTN_NORM, 0, PITCH_NORM) shGlow(dead,255,255,0) set_task(3.0, "sacrifice_unglow", dead) set_task(1.0, "sacrifice_teamcheck", 0, parm, 2) } //---------------------------------------------------------------------------------------------- public sacrifice_unglow(id) { shUnglow(id) } //---------------------------------------------------------------------------------------------- public sacrifice_teamcheck(parm[]) { new dead = parm[0] new sacrifice = parm[1] if ( get_user_team(dead) != get_user_team(sacrifice) ) { client_print(dead,print_chat,"You changed teams and got respawned via Sacrifice, now you shall die") user_kill(dead,1) gPlayerUltimateUsed[sacrifice] = false } } //---------------------------------------------------------------------------------------------- public round_start() { gBetweenRounds = false } //---------------------------------------------------------------------------------------------- public round_end() { gBetweenRounds = true } //----------------------------------------------------------------------------------------------

A VERY crude start of where I would like the final to be.
The way I have the keydown set right now doesn't work, as I was just testing whether or not you could have the power only active when a certain condition is met (dead teammate search from Zeus's code).

If it is even possible, I would like to have a menu show on key down that would display a list of your current team (ct/t). It will hopefully look similar to that of the one for picking heros, with names of dead teammates (one's that can be revived) in white and alive teammates (one's that cannot be revived) in gray. Then when you press the corresponding key, the power would activate on the selected player. If an incorrect target is chosen, a msg would appear saying so and the menu would stay open until a correct target is chosen or is exited via the 0 key.

Well, any help with coding, or just ideas in general are greatly appreciated!
3volution is offline
1sh0t2killz
Senior Member
Join Date: Dec 2004
Old 06-25-2006 , 00:31   Re: Need help with somewhat compicated hero
Reply With Quote #2

ehhh this is just a n00b guess of me but, ive compiled it and it only gave me 2 errors (da same error on different lines)

u didnt define da "user_spawn"
if my version is outdated (which is highly likely since i havent been up 2 date with this) im guessing dat it is already defined in da include files, but ehhh i dun wanna update 2 dat.

as 4 ur keydown problem imma look at dat stuff right now nd ill edit this post when i figured out y it doesnt work or if i give up cuz i aint really good at coding.

EDIT:
ok after i looked at ur keydown coding shyt i fixed it up, i just rearranged da order, cuz dis interrupted it (or sumthin like dat)
Code:
// Let them know they already used their ultimate if they have
if ( gPlayerUltimateUsed[id] ) {
playSoundDenySelect(id)
}
REPLACE UR KEYDOWN CODE WITH THIS AND HOPE IT WORKS!!!!
Code:
// RESPOND TO KEYDOWN
public sacrifice_kd()
{
// First Argument is an id with Sacrifice Powers!
new temp[6]
read_argv(2,temp,5)
new id=str_to_num(temp)

if ( !is_user_alive(id) )
	{
		new sacrificeCooldown=get_cvar_num("sacrifice_cooldown")
		if ( sacrificeCooldown > 0 )ultimateTimer(id, sacrificeCooldown * 1.0 )
			{
				if ( !is_user_connected(id) || is_user_alive(id) ) return
				{
					// Look for alive players with unused Sacrifice Powers on the same team
					for ( new player = 1; player <= SH_MAXSLOTS; player++ ) {
					if ( player != id && is_user_alive(player) && gHasSacrificePowers[player] && !gPlayerUltimateUsed[player] && get_user_team(id) == get_user_team(player) )
						{
							// We got a Sacrifice character willing to raise the dead!
							new parm[2]
							parm[0] = id
							parm[1] = (player)
							set_task(1.0,"sacrifice_respawn", 0, parm, 2)
						}
					}
				}
			}
		}
// Let them know they already used their ultimate if they have
else if ( gPlayerUltimateUsed[id] ) 
	{
		playSoundDenySelect(id)
	}

}
if it doesnt work, sry i couldnt help
__________________
I ♥ ⌂ ♫

Last edited by 1sh0t2killz; 06-25-2006 at 00:40.
1sh0t2killz is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 06-25-2006 , 00:40   Re: Need help with somewhat compicated hero
Reply With Quote #3

http://www.amxmodx.org/funcwiki.php?go=func&id=127
Freecode is offline
1sh0t2killz
Senior Member
Join Date: Dec 2004
Old 06-25-2006 , 00:41   Re: Need help with somewhat compicated hero
Reply With Quote #4

hehe, so dat "user_spawn" was already identified XD i juz didnt have an updated version of superhero mod
__________________
I ♥ ⌂ ♫
1sh0t2killz is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:01.


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