Archived copy of war3source.com, the War3Source forum (2009–2020), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2012-10-24 (original capture). Forum · All archived topics · Wiki · Bug tracker · Blog
Chat

War3:Source
October 24, 2012, 03:22:59 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Download: http://war3source.com/index.php?board=9.0
What is War3Source?: http://war3source.com/index.php?topic=200.0
Sample Stats: http://war3source.com/war3stats
Steam Community Group: http://steamcommunity.com/groups/war3source
War3Source SVN Checkout: http://ownageclan.com/svn/war3source/
War3Source servers: http://www.game-monitor.com/search.php?vars=war3_version=
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: My First race.  (Read 391 times)
splatted
Newbie
*
Posts: 3


View Profile Email
« on: January 15, 2012, 01:15:26 AM »

Hey guys I've had a crack coding my first race with some help from your tutorials. Little did I know I need a testing platform which I don't have nor can I get to work.

I was wondering if anyone could either tell me if it works or test it for me.

#include <sourcemod>
#include "War3Source/War3Source_Interface"
#include <sdktools>
#include <sdktools_functions>

new raceID;

public Plugin:myinfo =
{
   name =  "Splatgutz", //Race Name!
   author =  "Splatted", //Author of the race!
   description = "Myfirstrace", //Description for the race!
   version = "1.0",   //Race Version!
   url = "sevensinsgaming.com/"  //
};

new ComballEffect,FireSprite,HyBeam,TeleBeam;

public OnWar3PluginReady()
{
   raceID=War3_CreateRace("Splatgutz",
                             "splatgutz
                                "You are now Splatgutz",
                                "Respawned as Splatgutz",
                                 "Kebab Sauce Slowdown",
                                "Slowdown the enemy you shoot!",
                                "Harden",
                                "Lightspeed","Use your ultimate for 10 seconds of 225-300% speed"");
}

public OnPluginStart()
{
   HookEvent("player_Attacker",PlayerAttackerEvent);
}

public PlayerSpawnEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
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.8;
      case 2:
        speed=0.7;
      case 3:
        speed=0.5;
      case 4:
        speed=0.2;
    }
    War3_SetOverrideSpeed(victim,speed,skillnumber);
TE_SetupBeamRingPoint(vec,25.10,10.0.0,ComballEffect,TeleBeam,,5,25,1.3,15.0,0.0,ringColor,20,1.0);
TE_SetupBeamRingPoint(vec,60.60,25.0.0,FireSprite,HyBeam,10,29,1.3,15.0,10.0,ringColor,50,5.3);
            TE_SendToAll();
    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);
  }
}
    CreateTimer(5.0,fix_speed,GetEventInt("userid"));
         {
            case 0:
               add_health=4;
            case 1:
               add_health=8;
            case 2:
               add_health=16;
            case 3:
               add_health=32;
            case 4:
               add_health=64;
        {
public Action:fix_speed(Handle:timer,any:userid)
{
  new client=GetClientOfUserId(userid);
  if(client>0)
  {
    War3_SetOverrideSpeed(victim,0.0,skillnumber);
      }
   }

enum War3Immunity
{
   Immunity_Ultimates = 1,
   Immunity_HealthTake = 1,
           {

            War3_ChatMessage(client,"You can't stop me, and Toughtnut !",);
         }
}

public OnSkillLevelChanged(client,race,skill,oldskilllevel,newskilllevel)
{
   if(race==raceID && skill==0)
   {
    War3_SetMinSpeed(client,speed)
   }
   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 OnMapStart()
{
   FireSprite=PrecacheModel("materials/sprites/halo01.vmt");
  ComballEffect=PrecacheModel("models/effects/comball_tape.vmt");
  HyBeam=PrecacheModel("sprites/hydragutbeamcap.vmt");
  TeleBeam=PrecacheModel("sprites/tp_beam001.vmt");
}

public OnRaceSelected(client,oldrace,newrace)
{
   if(newrace!=raceID)
   {
      War3_SetMaxSpeed(client,1.0);
      War3_SetMinGravity(client,1.0);
    War3_SetMinHealth(client,100);
   }
 }
}
« Last Edit: January 15, 2012, 02:20:49 AM by splatted » Logged
Necavi
Full Member
***
Posts: 223


View Profile
« Reply #1 on: January 15, 2012, 01:37:18 AM »

I would recommend at least enclosing that in bbcode blocks, or more likely just attaching a file.
Logged

splatted
Newbie
*
Posts: 3


View Profile Email
« Reply #2 on: January 15, 2012, 02:16:22 AM »

Thanks for the reply, I didn't even think of attaching the file.

Nor can I work out how to attach it now :\
« Last Edit: January 15, 2012, 02:21:45 AM by splatted » Logged
Revan
Sr. Member
****
Posts: 275



View Profile
« Reply #3 on: January 15, 2012, 05:25:19 AM »

war3_setmaxspeed - isn't this a very very old native? seems like u used a outdated tutorial
Logged

#war3source
Vulpone
Full Member
***
Posts: 140



View Profile Email
« Reply #4 on: January 15, 2012, 10:34:35 AM »

Also, it seems like you're using unnecessary events, outdated buffs and yeah, seems like an old tutorial.

I recommend talking a look at the packaged races and looking at the newest sourcemod API.

Other than that, congrats on your first race. Smiley
Logged

Sapere aude!
alex0310
Full Member
***
Posts: 170



View Profile
« Reply #5 on: January 15, 2012, 11:07:07 AM »

Thanks for the reply, I didn't even think of attaching the file.

Nor can I work out how to attach it now :\
why? don't you want to use the proposal by Necavi...

it easy)))
http://war3source.com/index.php?action=help;page=post#additional
Logged
Ownz
Developer
Administrator
Hero Member
*****
Posts: 2045



View Profile WWW Email
« Reply #6 on: January 15, 2012, 12:14:02 PM »

a
Also, it seems like you're using unnecessary events, outdated buffs and yeah, seems like an old tutorial.

I recommend talking a look at the packaged races and looking at the newest sourcemod API.

Other than that, congrats on your first race. Smiley
Yup hes using reallllllly old APIs which should have been gone a long time ago.

numbers associated with levels should be in arrays.

see default races for examples.
Logged

DarkEnergy
splatted
Newbie
*
Posts: 3


View Profile Email
« Reply #7 on: January 16, 2012, 03:31:23 AM »

Lol okay cool thanks for the help there guys, I'll have a look for a newer tutorial and go for round 2.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!