Author Topic: Secret Hero  (Read 5850 times)

Martin Texno

  • Newbie
  • *
  • Posts: 22
  • I'm Constructive ?
    • MSN Messenger - martinkongerule@hotmail.com
    • Yahoo Instant Messenger - martinmikalsen@yahoo.com
    • View Profile
    • Zombie-Asylum !
    • Email
Secret Hero
« on: December 01, 2009, 11:50:35 AM »
The Secret Hero !


I don't have this War3 Mod ? so i can't test the race....
How's the race going ?

Code: [Select]
#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);
}
 }
}
« Last Edit: December 01, 2009, 05:00:57 PM by Martin Texno »
Support ?

Anthony Iacono

  • Lead Developer
  • Administrator
  • Full Member
  • *****
  • Posts: 136
  • Lets make it better.
    • MSN Messenger - anthonyiacono@gmail.com
    • View Profile
    • My Blog
    • Email
Re: Secret Hero
« Reply #1 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: [Select]
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.

Martin Texno

  • Newbie
  • *
  • Posts: 22
  • I'm Constructive ?
    • MSN Messenger - martinkongerule@hotmail.com
    • Yahoo Instant Messenger - martinmikalsen@yahoo.com
    • View Profile
    • Zombie-Asylum !
    • Email
Re: Secret Hero
« Reply #2 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.
« Last Edit: December 01, 2009, 02:56:34 PM by Martin Texno »
Support ?

DisturbeD

  • Newbie
  • *
  • Posts: 39
  • Me fail English? That’s unpossible.
    • View Profile
    • Email
Re: Secret Hero
« Reply #3 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?

Martin Texno

  • Newbie
  • *
  • Posts: 22
  • I'm Constructive ?
    • MSN Messenger - martinkongerule@hotmail.com
    • Yahoo Instant Messenger - martinmikalsen@yahoo.com
    • View Profile
    • Zombie-Asylum !
    • Email
Re: Secret Hero
« Reply #4 on: December 01, 2009, 03:12:41 PM »
Code: [Select]
[quote author=Anthony Iacono link=topic=4.msg18#msg18 date=1259699485]
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);
  }
}
[/quote]

Thank you, this was very helpfull.
Question : Would this race work, for the mod ?
Support ?

Anthony Iacono

  • Lead Developer
  • Administrator
  • Full Member
  • *****
  • Posts: 136
  • Lets make it better.
    • MSN Messenger - anthonyiacono@gmail.com
    • View Profile
    • My Blog
    • Email
Re: Secret Hero
« Reply #5 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.

stinkyfax

  • Full Member
  • ***
  • Posts: 120
    • View Profile
    • Email
Re: Secret Hero
« Reply #6 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.

Martin Texno

  • Newbie
  • *
  • Posts: 22
  • I'm Constructive ?
    • MSN Messenger - martinkongerule@hotmail.com
    • Yahoo Instant Messenger - martinmikalsen@yahoo.com
    • View Profile
    • Zombie-Asylum !
    • Email
Re: Secret Hero
« Reply #7 on: December 08, 2009, 01:21:03 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.
i do understand, it sucks, btw it was my first race, how could i do something really good ? :p
Support ?

stinkyfax

  • Full Member
  • ***
  • Posts: 120
    • View Profile
    • Email
Re: Secret Hero
« Reply #8 on: December 08, 2009, 05:26:17 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.
i do understand, it sucks, btw it was my first race, how could i do something really good ? :p
I didn't like it not because it's bad coded or has errors (which is usually met during first attemps of new programmer) but because the concept is boring and too common. You don't need to be skilled programmer in order to invent something funny or new.