|
Title: Secret Hero Post by: Martin Texno on December 01, 2009, 11:50:35 AM The Secret Hero !
(http://starsmedia.ign.com/stars/image/article/104/1042735/baddie-brawl-sephiroth-vs-liquid-snake-20091105024507111-000.jpg) I don't have this War3 Mod ? so i can't test the race.... How's the race going ? Code: #include <sourcemod> #include "War3Source/War3Source_Interface" new raceID; public Plugin:myinfo = { name = "Secret hero", author = "<---TexNo--->", description = "First Race inn this coding.", version = "1.0", url = "http://zeroasylum.freeforums.org/" }; public OnWar3PluginReady() { raceID=War3_CreateRace("Secret Hero","secret hero","you are now Secret hero","Return of the Secret Hero","Impaling Gravity","Gravity Increase","Liquid Life","Health At spawn","Speedy Hero","More Speed"); } public OnPluginStart() { HookEvent("player_spawn",PlayerSpawnEvent); } public PlayerSpawnEvent(Handle:event,const String:name[],bool:dontBroadcast) { new userid=GetEventInt(event,"userid"); new client=GetClientOfUserId(userid); if(client>0) { new race=War3_GetRace(client); if(race==raceID) { new impalegravity_skill=War3_GetSkillLevel(client,race,0); new Float:gravity=1.0; switch(impalegravity_skill) { case 0: gravity=1.1; case 1: gravity=1.3; case 2: gravity=1.5; case 3: gravity=1.7; case 4: gravity=1.9; } War3_SetMinGravity(client,gravity); new health_skill=War3_GetSkillLevel(client,race,1); new old_health=GetClientHealth(client); new add_health=0; switch(health_skill) { case 0: add_health=9; case 1: add_health=16; case 2: add_health=27; case 3: add_health=38; case 4: add_health=46; } SetEntityHealth(client,old_health+add_health); new speed_skill=War3_GetSkillLevel(client,race,2); new Float:speed=1.0; switch(speed_skill) { case 0: speed=1.3; case 1: speed=1.5; case 2: speed=1.6; case 3: speed=1.7; case 4: speed=1.8; } War3_SetMaxSpeed(client,speed) } } } public OnSkillLevelChanged(client,race,skill,oldskilllevel,newskilllevel) { if(race==raceID && skill==0) { new Float:gravity=1.0; switch(newskilllevel) { case 0: gravity=1.1; case 1: gravity=1.3; case 2: speed=1.5; case 3: gravity=1.7; case 4: gravity=1.9; } War3_SetMinGravity(client,gravity) } if(race==raceID && skill==1) { new Float:speed=1.0; switch(newskilllevel) { case 0: speed=1.3; case 1: speed=1.5; case 2: speed=1.6; case 3: speed=1.7; case 4: speed=1.8; } War3_SetMaxSpeed(client,speed); } } public OnRaceSelected(client,oldrace,newrace) { if(newrace!=raceID) { War3_SetMaxSpeed(client,1.0); War3_SetMinGravity(client,1.0); War3_SetOverrideSpeed(client,0.0); } } } Title: Re: Secret Hero Post by: Anthony Iacono on December 01, 2009, 02:31:25 PM When I get home I'll take a better look, but glad you are taking a shot at making races already!
You don't seem to have a need for SetOverrideSpeed, so you can remove that. To explain better, that function is used for overriding War3's Max Speed detection, so for example if you are trying to slow someone down when you shoot them for 5 seconds, you could do something along these lines: Code: You would HookEvent player_hurt, and inside you would do something like... new victim=GetClientOfUserId(GetEventInt("userid")); new attacker=GetClientOfUserId(GetEventInt("attacker")); if(victim>0 && attacker>0) { new skill_attacker=War3_GetSkillLevel(attacker,victim,skillnumber); if(skill_attacker>0) { new Float:speed=1.0; switch(skill_attacker) { case 1: speed=0.9; case 2: speed=0.8; case 3: speed=0.7; case 4: speed=0.6; } War3_SetOverrideSpeed(victim,speed,skillnumber); CreateTimer(5.0,fix_speed,GetEventInt("userid")); } } public Action:fix_speed(Handle:timer,any:userid) { new client=GetClientOfUserId(userid); if(client>0) { War3_SetOverrideSpeed(victim,0.0,skillnumber); // give war3 back control } } Obviously skillnumber would be the skill (0-3) of the power that would do this. Let me know if you are still confused. Title: Re: Secret Hero Post by: Martin Texno on December 01, 2009, 02:47:17 PM Ok, just confusing to make a race, when the mod isn't released ;)
I'll still try make some more. Still learning, it's a good tutorial so it shouldn't be so very hard. Title: Re: Secret Hero Post by: DisturbeD on December 01, 2009, 02:55:53 PM Ill probably recode many of the good old races to sourcepawn when its released ;p
How to use est- stuff btw? Title: Re: Secret Hero Post by: Martin Texno on December 01, 2009, 03:12:41 PM Code: [quote author=Anthony Iacono link=topic=4.msg18#msg18 date=1259699485] [/quote]new victim=GetClientOfUserId(GetEventInt("userid")); new attacker=GetClientOfUserId(GetEventInt("attacker")); if(victim>0 && attacker>0) { new skill_attacker=War3_GetSkillLevel(attacker,victim,skillnumber); if(skill_attacker>0) { new Float:speed=1.0; switch(skill_attacker) { case 1: speed=0.9; case 2: speed=0.8; case 3: speed=0.7; case 4: speed=0.6; } War3_SetOverrideSpeed(victim,speed,skillnumber); CreateTimer(5.0,fix_speed,GetEventInt("userid")); } } public Action:fix_speed(Handle:timer,any:userid) { new client=GetClientOfUserId(userid); if(client>0) { War3_SetOverrideSpeed(victim,0.0,skillnumber); } } Thank you, this was very helpfull. Question : Would this race work, for the mod ? Title: Re: Secret Hero Post by: Anthony Iacono on December 01, 2009, 05:20:20 PM Ill probably recode many of the good old races to sourcepawn when its released ;p How to use est- stuff btw? EST is not needed. Everything can be done with SourceMod. Quote Thank you, this was very helpfull. Question : Would this race work, for the mod ? I understand it is very difficult without the mod to test. Don't worry, it won't be long until there is a beta. Also, I'll make a build of your race and let you know as soon as I can how it works. Title: Re: Secret Hero Post by: stinkyfax on December 07, 2009, 06:05:56 PM EST is just small part of what SP does in effects area.
But about the race, I didn't like it - what's so interesting about it? +hp +speed +gravity, all those 3 skills are the least exciting to have. Sorry for negative feedback, I hope it will help you with next race. Title: Re: Secret Hero Post by: Martin Texno on December 08, 2009, 01:21:03 PM EST is just small part of what SP does in effects area. i do understand, it sucks, btw it was my first race, how could i do something really good ? :pBut about the race, I didn't like it - what's so interesting about it? +hp +speed +gravity, all those 3 skills are the least exciting to have. Sorry for negative feedback, I hope it will help you with next race. Title: Re: Secret Hero Post by: stinkyfax on December 08, 2009, 05:26:17 PM EST is just small part of what SP does in effects area. i do understand, it sucks, btw it was my first race, how could i do something really good ? :pBut about the race, I didn't like it - what's so interesting about it? +hp +speed +gravity, all those 3 skills are the least exciting to have. Sorry for negative feedback, I hope it will help you with next race. |