Author Topic: [OLD] Making a race  (Read 17609 times)

Anthony Iacono

  • Lead Developer
  • Administrator
  • Full Member
  • *****
  • Posts: 136
  • Lets make it better.
    • MSN Messenger - anthonyiacono@gmail.com
    • View Profile
    • My Blog
    • Email
[OLD] Making a race
« on: December 01, 2009, 04:27:14 AM »
Part 1
Hey guys,

I am going to show you guys how to create a new race! First of all, before you do anything, please remember that this plugin requires SourceMod, and races are created via the plugin system. How about this, lets create a race called Maniac, sorry about the lame name. First thing you would do is paste this into Notepad or a text editor of your choice.

Code: [Select]
#include <sourcemod>
#include "War3Source/War3Source_Interface"

new raceID;

public Plugin:myinfo =
{
name = "War3Source Race - Maniac",
author = "Anthony Iacono",
description = "An example race called Maniac.",
version = "1.0.0.0",
url = "http://war3source.com/"
};


public OnWar3PluginReady()
{
raceID=War3_CreateRace("Maniac","maniac","You are now a Maniac!","You will be a Maniac when you respawn.","Happy Feet","20-80% Speed Increase","Gift of Life","15-60 addition spawn HP","Hurdle","Allows you to jump with 20-80% less gravity","Rampage","Use your ultimate for 10 seconds of 225-300% speed");
}

Alright, before I go any further let me explain.
Code: [Select]
#include <sourcemod>
#include "War3Source/War3Source_Interface"
These are includes, which contain functions. The first one is SourceMod's important functions, and the second one is the War3Source interface (please note I haven't posted this file yet but I will soon).

Code: [Select]
new raceID;War3Source identifies each race by an ID. new means we are defining a variable, so we are telling SourceMod to define a variable named raceID.

Code: [Select]
public OnWar3PluginReady()
{
raceID=War3_CreateRace("Maniac","maniac","You are now a Maniac!","You will be a Maniac when you respawn.","Happy Feet","20-80% Speed Increase","Gift of Life","15-60 addition spawn HP","Hurdle","Allows you to jump with 20-80% less gravity","Rampage","Use your ultimate for 10 seconds of 300% speed",6);
}
First, public OnWar3PluginRead() defines the function called when War3Source has finished loading. Next, we do raceID=War3_CreateRace(...) which means store the race's ID to raceID. Now let me go through the big list of parameters with you. First is the race's name, easy. Second is the race's database name identifier, easy, make sure it is one word and preferably lower-case. Third is the message that the player sees when they are changed to the race, simple. Fourth is, you guessed it, the message they see when they try to choose the race while still alive (they will become X race when dead.) Fifth is the first skill's name. Sixth is the first skill's description. Seventh is the second skill's name. Eighth is the second skill's description. Ninth is the third skill's name. Tenth is the third skill's description. Eleventh is the ultimate skill's name. Twelfth is ultimate skill's description. Last but not least, thirteenth is the required total level to use the race, please remember that this is optional, and if you leave it out it will default to 0.

Phew. Alright, lets more on to actually making the skills.
Lets start with Happy Feet, which is a speed increase. Some of you logical thinkers might be thinking, what if two race's or shopmenu item's contradict each other? I'll get to that in a second, I have designed a simple system (simple for you at least) to combat this issue.

First, we need to paste in two more function definitions.
Code: [Select]
public OnPluginStart()
{
HookEvent("player_spawn",PlayerSpawnEvent);
}

public PlayerSpawnEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
}

This will make our plugin listen for player spawning. We'll make it actually do something soon. Next, add this:
Code: [Select]
public OnSkillLevelChanged(client,race,skill,oldskilllevel,newskilllevel)
{
}

Ah, seeming sort of cool yet? This function is called any time a skill's level changes.
Now add this:
Code: [Select]
public OnRaceSelected(client,oldrace,newrace)
{
}

This function gets called whenever a player changes their race. Alright, now lets put some code inside these functions. Change you public PlayerSpawnEvent(...) to look like this:
Code: [Select]
public PlayerSpawnEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
new userid=GetEventInt(event,"userid"); // read "userid" from event information
new client=GetClientOfUserId(userid); // get the client index of userid
if(client>0) // make sure client is valid
{
new race=War3_GetRace(client); // get the race of the client
if(race==raceID) // this client is our race, they may get some of our skills
{
new happyfeet_skill=War3_GetSkillLevel(client,race,0); // get skill level of CLIENT in RACE, 0 means that we want skill 1. (0 mean skill 1, 1 means skill 2, 2 means skill 3, and 3 means ultimate)
new Float:speed=1.0; // remember to define speed as a Float because it is a decimal
switch(happyfeet_skill) // switch means conditional statement
{
case 0: // skill level 0, no speed increase
speed=1.0;
case 1: // skill level 1, 20% speed increase
speed=1.2;
case 2: // skill level 2, 40% speed increase
speed=1.4;
case 3: // skill level 3, 60% speed increase
speed=1.6;
case 4: // skill level 4, 80% speed increase
speed=1.8;
}
War3_SetMaxSpeed(client,speed); // War3_SetMaxSpeed actually tells War3: Source that if our speed provided is greater than any other race's speed, use it. This prevents failure due to multiple speed settings
}
}
}

Phew. Well, now we need to do something similar inside of public OnSkillLevelChanged(...):
Code: [Select]
public OnSkillLevelChanged(client,race,skill,oldskilllevel,newskilllevel)
{
if(race==raceID && skill==0) // if the race is our race and the skill is 0 (skill 1, Happy Feet)
{
new Float:speed=1.0; // remember to define speed as a Float because it is a decimal
switch(newskilllevel) // switch means conditional statement
{
case 0: // skill level 0, no speed increase
speed=1.0;
case 1: // skill level 1, 20% speed increase
speed=1.2;
case 2: // skill level 2, 40% speed increase
speed=1.4;
case 3: // skill level 3, 60% speed increase
speed=1.6;
case 4: // skill level 4, 80% speed increase
speed=1.8;
}
War3_SetMaxSpeed(client,speed);
}
}

Not so bad now eh? :) Now, what happens if they change races?! We need to tell War3: Source to stop giving them the speed boost. Easy peezy lemon squeezy :)
Code: [Select]
public OnRaceSelected(client,oldrace,newrace)
{
if(newrace!=raceID) // well they aren't our race anymore
{
War3_SetMaxSpeed(client,1.0);
}
}

See, your getting the hang of it already! Happy Feet is done :) Lets move on to Gift of Life, which is incredibly easy. Lets modify public PlayerSpawnEvent(...):
Code: [Select]
public PlayerSpawnEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
new userid=GetEventInt(event,"userid"); // read "userid" from event information
new client=GetClientOfUserId(userid); // get the client index of userid
if(client>0) // make sure client is valid
{
new race=War3_GetRace(client); // get the race of the client
if(race==raceID) // this client is our race, they may get some of our skills
{
new happyfeet_skill=War3_GetSkillLevel(client,race,0); // get skill level of CLIENT in RACE, 0 means that we want skill 1. (0 mean skill 1, 1 means skill 2, 2 means skill 3, and 3 means ultimate)
new Float:speed=1.0; // remember to define speed as a Float because it is a decimal
switch(happyfeet_skill) // switch means conditional statement
{
case 0: // skill level 0, no speed increase
speed=1.0;
case 1: // skill level 1, 20% speed increase
speed=1.2;
case 2: // skill level 2, 40% speed increase
speed=1.4;
case 3: // skill level 3, 60% speed increase
speed=1.6;
case 4: // skill level 4, 80% speed increase
speed=1.8;
}
War3_SetMaxSpeed(client,speed); // War3_SetMaxSpeed actually tells War3: Source that if our speed provided is greater than any other race's speed, use it. This prevents failure due to multiple speed settings
new giftoflife_skill=War3_GetSkillLevel(client,race,1); // get skill level of CLIENT in RACE, 1 means that we want skill 2.
new old_health=GetClientHealth(client); // get their old health
new add_health=0; // define our variable for additional health
switch(giftoflife_skill) // again, conditional statement
{
case 0: // skill level 0, no increase
add_health=0;
case 1: // skill level 1, 15 extra HP
add_health=15;
case 2: // skill level 2, 30 extra HP
add_health=30;
case 3: // skill level 3, 45 extra HP
add_health=45;
case 4: // skill level 4, 60 extra HP
add_health=60;
}
SetEntityHealth(client,old_health+add_health); // easy, set CLIENT's health to old_health + add_health
}
}
}

Alright, not bad, not bad. Lets move on to Hurdle, this is very similar to Happy Feet's mechanism so I am not going to hold your hand through this one.
Code: [Select]
public PlayerSpawnEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
new userid=GetEventInt(event,"userid"); // read "userid" from event information
new client=GetClientOfUserId(userid); // get the client index of userid
if(client>0) // make sure client is valid
{
new race=War3_GetRace(client); // get the race of the client
if(race==raceID) // this client is our race, they may get some of our skills
{
new happyfeet_skill=War3_GetSkillLevel(client,race,0); // get skill level of CLIENT in RACE, 0 means that we want skill 1. (0 mean skill 1, 1 means skill 2, 2 means skill 3, and 3 means ultimate)
new Float:speed=1.0; // remember to define speed as a Float because it is a decimal
switch(happyfeet_skill) // switch means conditional statement
{
case 0: // skill level 0, no speed increase
speed=1.0;
case 1: // skill level 1, 20% speed increase
speed=1.2;
case 2: // skill level 2, 40% speed increase
speed=1.4;
case 3: // skill level 3, 60% speed increase
speed=1.6;
case 4: // skill level 4, 80% speed increase
speed=1.8;
}
War3_SetMaxSpeed(client,speed); // War3_SetMaxSpeed actually tells War3: Source that if our speed provided is greater than any other race's speed, use it. This prevents failure due to multiple speed settings
new giftoflife_skill=War3_GetSkillLevel(client,race,1); // get skill level of CLIENT in RACE, 1 means that we want skill 2.
new old_health=GetClientHealth(client); // get their old health
new add_health=0; // define our variable for additional health
switch(giftoflife_skill) // again, conditional statement
{
case 0: // skill level 0, no increase
add_health=0;
case 1: // skill level 1, 15 extra HP
add_health=15;
case 2: // skill level 2, 30 extra HP
add_health=30;
case 3: // skill level 3, 45 extra HP
add_health=45;
case 4: // skill level 4, 60 extra HP
add_health=60;
}
SetEntityHealth(client,old_health+add_health); // easy, set CLIENT's health to old_health + add_health
new hurdle_skill=War3_GetSkillLevel(client,race,2);
new Float:gravity=1.0;
switch(hurdle_skill)
{
case 0:
gravity=1.0;
case 1:
gravity=0.8;
case 2:
gravity=0.6;
case 3:
gravity=0.4;
case 4:
gravity=0.2;
}
War3_SetMinGravity(client,gravity); // War3_SetMinGravity actually tells War3: Source that if our gravity provided is less than any other race's gravity, use it.
}
}
}

public OnSkillLevelChanged(client,race,skill,oldskilllevel,newskilllevel)
{
if(race==raceID && skill==0) // if the race is our race and the skill is 0 (skill 1, Happy Feet)
{
new Float:speed=1.0; // remember to define speed as a Float because it is a decimal
switch(newskilllevel) // switch means conditional statement
{
case 0: // skill level 0, no speed increase
speed=1.0;
case 1: // skill level 1, 20% speed increase
speed=1.2;
case 2: // skill level 2, 40% speed increase
speed=1.4;
case 3: // skill level 3, 60% speed increase
speed=1.6;
case 4: // skill level 4, 80% speed increase
speed=1.8;
}
War3_SetMaxSpeed(client,speed);
}
if(race==raceID && skill==2) // Hurdle
{
new Float:gravity=1.0;
switch(newskilllevel)
{
case 0:
gravity=1.0;
case 1:
gravity=0.8;
case 2:
gravity=0.6;
case 3:
gravity=0.4;
case 4:
gravity=0.2;
}
War3_SetMinGravity(client,gravity); // War3_SetMinGravity actually tells War3: Source that if our gravity provided is less than any other race's gravity, use it.
}
}

public OnRaceSelected(client,oldrace,newrace)
{
if(newrace!=raceID) // well they aren't our race anymore
{
War3_SetMaxSpeed(client,1.0);
War3_SetMinGravity(client,1.0);
}
}
« Last Edit: August 19, 2010, 06:50:16 PM by Ownz »

Anthony Iacono

  • Lead Developer
  • Administrator
  • Full Member
  • *****
  • Posts: 136
  • Lets make it better.
    • MSN Messenger - anthonyiacono@gmail.com
    • View Profile
    • My Blog
    • Email
Re: Making a race
« Reply #1 on: December 01, 2009, 04:27:34 AM »
Part 2
Nice, three skills down, now all we need to tackle is the ultimate skill, Rampage. Add this to the bottom:
Code: [Select]
new Float:fLastUsed[65]; // make an array with max players + 1 indices, this is for cooldown
#define RAMPAGE_COOLDOWN 45 // this is a preprocessor, how often should they be able to rampage? 45 seconds by default
public OnUltimateCommand(client,race,bool:pressed)
{
// pressed will be true if they pushed down, and false if they released
if(pressed && race==raceID) // they pressed it down and they are our race, lets keep checking
{
new rampage_level=War3_GetSkillLevel(client,race,3);
new current_time=GetEngineTime();
if(rampage_level>0 && current_time>=(fLastUsed[client]+RAMPAGE_COOLDOWN))
{
// lets rampage!
new Float:speed=1.0;
switch(rampage_level)
{
case 1:
speed=2.25;
case 2:
speed=2.50;
case 3:
speed=2.75;
case 4:
speed=3.0;
}
War3_SetOverrideSpeed(client,speed); // we are overriding War3: Source's speed system.
fLastUsed[client]=current_time; // cooldown
CreateTimer(10.0,FinishRampage,GetClientUserId(client)); // we use userid because in a 10 second inteval, our client's index might change. userid's aren't reused, however, so it is safe to use them.
}
}
}

public Action:FinishRampage(Handle:timer,any:userid)
{
new client=GetClientOfUserId(userid);
if(client>0) // check if this player is still valid
{
War3_SetOverrideSpeed(client,0.0); // setting override speed to 0.0 tells War3 to go back to it's own system
}
CloseHandle(timer); // kill our timer
}

One last thing, lets make sure our override goes away on spawn as well as race change. And there you go, our finished race:
Code: [Select]
#include <sourcemod>
#include "War3Source/War3Source_Interface"

new raceID;

public Plugin:myinfo =
{
name = "War3Source Race - Maniac",
author = "Anthony Iacono",
description = "An example race called Maniac.",
version = "1.0.0.0",
url = "http://war3source.com/"
};


public OnWar3PluginReady()
{
raceID=War3_CreateRace("Maniac","maniac","You are now a Maniac!","You will be a Maniac when you respawn.","Happy Feet","20-80% Speed Increase","Gift of Life","15-60 addition spawn HP","Hurdle","Allows you to jump with 20-80% less gravity","Rampage","Use your ultimate for 10 seconds of 225-300% speed");
}

public OnPluginStart()
{
HookEvent("player_spawn",PlayerSpawnEvent);
}

public PlayerSpawnEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
new userid=GetEventInt(event,"userid"); // read "userid" from event information
new client=GetClientOfUserId(userid); // get the client index of userid
if(client>0) // make sure client is valid
{
new race=War3_GetRace(client); // get the race of the client
if(race==raceID) // this client is our race, they may get some of our skills
{
new happyfeet_skill=War3_GetSkillLevel(client,race,0); // get skill level of CLIENT in RACE, 0 means that we want skill 1. (0 mean skill 1, 1 means skill 2, 2 means skill 3, and 3 means ultimate)
new Float:speed=1.0; // remember to define speed as a Float because it is a decimal
switch(happyfeet_skill) // switch means conditional statement
{
case 0: // skill level 0, no speed increase
speed=1.0;
case 1: // skill level 1, 20% speed increase
speed=1.2;
case 2: // skill level 2, 40% speed increase
speed=1.4;
case 3: // skill level 3, 60% speed increase
speed=1.6;
case 4: // skill level 4, 80% speed increase
speed=1.8;
}
War3_SetMaxSpeed(client,speed); // War3_SetMaxSpeed actually tells War3: Source that if our speed provided is greater than any other race's speed, use it. This prevents failure due to multiple speed settings
new giftoflife_skill=War3_GetSkillLevel(client,race,1); // get skill level of CLIENT in RACE, 1 means that we want skill 2.
new old_health=GetClientHealth(client); // get their old health
new add_health=0; // define our variable for additional health
switch(giftoflife_skill) // again, conditional statement
{
case 0: // skill level 0, no increase
add_health=0;
case 1: // skill level 1, 15 extra HP
add_health=15;
case 2: // skill level 2, 30 extra HP
add_health=30;
case 3: // skill level 3, 45 extra HP
add_health=45;
case 4: // skill level 4, 60 extra HP
add_health=60;
}
SetEntityHealth(client,old_health+add_health); // easy, set CLIENT's health to old_health + add_health
new hurdle_skill=War3_GetSkillLevel(client,race,2);
new Float:gravity=1.0;
switch(hurdle_skill)
{
case 0:
gravity=1.0;
case 1:
gravity=0.8;
case 2:
gravity=0.6;
case 3:
gravity=0.4;
case 4:
gravity=0.2;
}
War3_SetMinGravity(client,gravity); // War3_SetMinGravity actually tells War3: Source that if our gravity provided is less than any other race's gravity, use it.
// Last, remove Maniac override
War3_SetOverrideSpeed(client,0.0);
}
}
}

public OnSkillLevelChanged(client,race,skill,oldskilllevel,newskilllevel)
{
if(race==raceID && skill==0) // if the race is our race and the skill is 0 (skill 1, Happy Feet)
{
new Float:speed=1.0; // remember to define speed as a Float because it is a decimal
switch(newskilllevel) // switch means conditional statement
{
case 0: // skill level 0, no speed increase
speed=1.0;
case 1: // skill level 1, 20% speed increase
speed=1.2;
case 2: // skill level 2, 40% speed increase
speed=1.4;
case 3: // skill level 3, 60% speed increase
speed=1.6;
case 4: // skill level 4, 80% speed increase
speed=1.8;
}
War3_SetMaxSpeed(client,speed);
}
if(race==raceID && skill==2) // Hurdle
{
new Float:gravity=1.0;
switch(newskilllevel)
{
case 0:
gravity=1.0;
case 1:
gravity=0.8;
case 2:
gravity=0.6;
case 3:
gravity=0.4;
case 4:
gravity=0.2;
}
War3_SetMinGravity(client,gravity); // War3_SetMinGravity actually tells War3: Source that if our gravity provided is less than any other race's gravity, use it.
}
}

public OnRaceSelected(client,oldrace,newrace)
{
if(newrace!=raceID) // well they aren't our race anymore
{
War3_SetMaxSpeed(client,1.0);
War3_SetMinGravity(client,1.0);
War3_SetOverrideSpeed(client,0.0);
}
}

new Float:fLastUsed[65]; // make an array with max players + 1 indices, this is for cooldown
#define RAMPAGE_COOLDOWN 45 // this is a preprocessor, how often should they be able to rampage? 45 seconds by default
public OnUltimateCommand(client,race,bool:pressed)
{
// pressed will be true if they pushed down, and false if they released
if(pressed && race==raceID) // they pressed it down and they are our race, lets keep checking
{
new rampage_level=War3_GetSkillLevel(client,race,3);
new Float:current_time=GetEngineTime();
if(rampage_level>0 && current_time>=(fLastUsed[client]+RAMPAGE_COOLDOWN))
{
// lets rampage!
new Float:speed=1.0;
switch(rampage_level)
{
case 1:
speed=2.25;
case 2:
speed=2.50;
case 3:
speed=2.75;
case 4:
speed=3.0;
}
War3_SetOverrideSpeed(client,speed); // we are overriding War3: Source's speed system.
fLastUsed[client]=current_time; // cooldown
CreateTimer(10.0,FinishRampage,GetClientUserId(client)); // we use userid because in a 10 second inteval, our client's index might change. userid's aren't reused, however, so it is safe to use them.
}
}
}

public Action:FinishRampage(Handle:timer,any:userid)
{
new client=GetClientOfUserId(userid);
if(client>0) // check if this player is still valid
{
War3_SetOverrideSpeed(client,0.0); // setting override speed to 0.0 tells War3 to go back to it's own system
}
CloseHandle(timer); // kill our timer
}

Let me know if you have any questions. BE CREATIVE! Anything you can do with SourceMod, you can incorporate into a race! I'll post a tutorial on making a shop menu item soon.

Anthony

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: Making a race
« Reply #2 on: December 01, 2009, 11:24:47 AM »
Looks really advanced :D
But i'll keep reading this tutorial and learn it, anyways, big tutorial :)
Looks good.
Support ?

DisturbeD

  • Newbie
  • *
  • Posts: 39
  • Me fail English? That’s unpossible.
    • View Profile
    • Email
Re: Making a race
« Reply #3 on: December 01, 2009, 12:26:18 PM »
Wow you just convinced me.. it looks way better than ES.. Looking at this Python got the same syntax like c++
Only declarations are a bit weird, but Ill get used to that  :)

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: Making a race
« Reply #4 on: December 01, 2009, 12:30:08 PM »
Pspad made my day, lol
i learned some of the tutorial, when i was making a race, fast understanding.
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: Making a race
« Reply #5 on: December 01, 2009, 02:42:15 PM »
Just so you guys know, this isn't Python, its SourcePawn. See http://sourcemod.com for more information on developing SourceMod plugins.

slipvyne

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Making a race
« Reply #6 on: December 14, 2009, 04:25:55 PM »
Wow you just convinced me.. it looks way better than ES.. Looking at this Python got the same syntax like c++
Only declarations are a bit weird, but Ill get used to that  :)

Anthony already said:
Just so you guys know, this isn't Python, its SourcePawn. See http://sourcemod.com for more information on developing SourceMod plugins.

But for reference, this is written in pawn, which is a derivative of C.
http://en.wikipedia.org/wiki/Pawn_%28programming_language%29

DisturbeD

  • Newbie
  • *
  • Posts: 39
  • Me fail English? That’s unpossible.
    • View Profile
    • Email
Re: Making a race
« Reply #7 on: December 14, 2009, 04:41:32 PM »
Yup.. before I learned about SourcePawn, somebody said me that there is only Python or ESS
if you want to mod with css, which is obviously wrong!

I dunno Python so I assumed that could be only Python.. sry my fault  :P
Just still dont get why to use Pawn if there is c++ as well, where is the advantage?

stinkyfax

  • Full Member
  • ***
  • Posts: 120
    • View Profile
    • Email
Re: Making a race
« Reply #8 on: December 14, 2009, 05:58:57 PM »
try them both and u'll see difference.

slipvyne

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Making a race
« Reply #9 on: December 14, 2009, 08:55:15 PM »
Yup.. before I learned about SourcePawn, somebody said me that there is only Python or ESS
if you want to mod with css, which is obviously wrong!

I dunno Python so I assumed that could be only Python.. sry my fault  :P
Just still dont get why to use Pawn if there is c++ as well, where is the advantage?

short answer, pawn is scripted, while c++ is compiled.  A server needs to be able to fire off single scripts to reduce stress and workload for minor events.  if it was compiled, it would eat alot of system resources going through the whole program.  And if we were to use something as complex as this server mod, then the game would be unplayable except for on supercomps. 

Python is REALLY good for people who are starting out in programming.  Less confusion, but offers less control on what you are doing.  Pawn still has a big foot in the C world, where it makes you declare space for saving, but is still relatively simple.

Naris

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
    • Email
Re: Making a race
« Reply #10 on: December 14, 2009, 11:01:25 PM »
short answer, pawn is scripted, while c++ is compiled.  A server needs to be able to fire off single scripts to reduce stress and workload for minor events.  if it was compiled, it would eat alot of system resources going through the whole program.  And if we were to use something as complex as this server mod, then the game would be unplayable except for on supercomps.  

Python is REALLY good for people who are starting out in programming.  Less confusion, but offers less control on what you are doing.  Pawn still has a big foot in the C world, where it makes you declare space for saving, but is still relatively simple.

You are completely and totally wrong there. You statement makes absolutely NO sense and is backwards. If a server had to "fire off singe scripts", it would "eat a lot of resources" compared to a compiled executable. This is why the Valve Engine, Counter Strike, TF2, DoD, and other games are written in C++ and NOT in  an interpreted script.

Also,  Pawn is NOT an interpreted script, it is compiled to bytecode which is then Just-In-Time compiled when loaded.
« Last Edit: December 14, 2009, 11:06:35 PM by Naris »

Naris

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
    • Email
Re: Making a race
« Reply #11 on: December 14, 2009, 11:06:14 PM »
Just still dont get why to use Pawn if there is c++ as well, where is the advantage?

The "advantage" to using Pawn instead of C++ is that Pawn doesn't require a compiler such as the Microsoft Visual Studio or gcc in linux. It is also possible to write a plugin using windows and then deploy it to a linux server without having to compile it on a linux system.

Pawn is also somewhat simpler to code for and you are less likely to make a mistake that will, leak memory, corrupt memory or do other bad things that crash the server.

slipvyne

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Making a race
« Reply #12 on: December 15, 2009, 09:15:58 AM »
i dont understand the reason to attack me on this.  If i misunderstood something, tell me where so i have a better understanding of it, and not just flame me.  My understanding was that the plugins made were compiled once to turn them into smx(the bytecode).  The scripts that are made with sourcemod, are only ran through once then exited once their job is done.  And pawn is an embedded script.  I never said it was interpreted.

stinkyfax

  • Full Member
  • ***
  • Posts: 120
    • View Profile
    • Email
Re: Making a race
« Reply #13 on: December 15, 2009, 11:45:13 AM »
i dont understand the reason to attack me on this.  If i misunderstood something, tell me where so i have a better understanding of it, and not just flame me.  My understanding was that the plugins made were compiled once to turn them into smx(the bytecode).  The scripts that are made with sourcemod, are only ran through once then exited once their job is done.  And pawn is an embedded script.  I never said it was interpreted.
I won't flame you but it might look so :)
You're completely wrong in every statement you have said.
By the way script can never be faster than binary machine specific code whether it is small, big, or huge.

Naris

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
    • Email
Re: Making a race
« Reply #14 on: December 15, 2009, 08:58:08 PM »
i dont understand the reason to attack me on this.  If i misunderstood something, tell me where so i have a better understanding of it, and not just flame me.  My understanding was that the plugins made were compiled once to turn them into smx(the bytecode).  The scripts that are made with sourcemod, are only ran through once then exited once their job is done.  And pawn is an embedded script.  I never said it was interpreted.

I'm sorry, I didn't mean to come off as attacking or flaming you. That wasn't the intent.
I meant to point out that you have entirely the wrong impression about how things work.

In fact, sourcemod plugins (which are NOT scripts, embedded or otherwise) are indeed loaded and remain loaded (and executed) as long as the server is running (unless they are unloaded). They are NOT "ran through once and then exited" as you seem to think.

You keep referring to SourceMod Pawn plugins as "scripts", which would also imply that you think they are interpreted, since most, if not all, scripting languages are interpreted.

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2437
  • chmod -R 777 *
    • View Profile
    • OwnageClan
Re: Making a race
« Reply #15 on: December 16, 2009, 11:53:13 AM »
i see you went with a modular coding style

Gus

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: Making a race
« Reply #16 on: December 19, 2009, 04:50:37 AM »
Anthony, when will you release your item tutorial?

Ive been craving for it.

zero

  • Full Member
  • ***
  • Posts: 194
    • View Profile
    • IBIS Gaming
    • Email
Re: Making a race
« Reply #17 on: March 03, 2010, 03:06:07 PM »
Can you only have 4 abilities or is there a way to have more!?

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2437
  • chmod -R 777 *
    • View Profile
    • OwnageClan
Re: Making a race
« Reply #18 on: March 03, 2010, 09:33:10 PM »
3 skills 1 ultimate why would u need 4 abilities?

zero

  • Full Member
  • ***
  • Posts: 194
    • View Profile
    • IBIS Gaming
    • Email
Re: Making a race
« Reply #19 on: March 04, 2010, 12:47:59 PM »
Because my players demand it. Especally on higher level races they want ones with different numbers of powers and more diverse races. Is there any way to add abilities after the ultimate like still use 4 for ultimate but put other things after that?

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2437
  • chmod -R 777 *
    • View Profile
    • OwnageClan
Re: Making a race
« Reply #20 on: March 04, 2010, 04:13:51 PM »
then that would be ultimate warcraft..which we might work on..but for now we will be sticking with 3 skill 1 ultimate for a while

[Oddity]TeacherCreature

  • Sr. Member
  • ****
  • Posts: 467
    • View Profile
Re: Making a race
« Reply #21 on: July 04, 2010, 12:44:59 PM »
Ok I tried to write or change some race codes from race.sp files

then I went to sourcemod site uploaded .sp file and hit compile
The error Igot was needs .inc file

I guess since Iam new to SM I am looking for instructions on compiling,
do i compile one race at a time? do i compile multiple files at once like a zip or rar would?
is there a better application for compiling than the tool on the SM website?

some general instructions owuld help because hte race tutorial is well written and if I can finish the compilin part I will be coding in a week, and anyone knows me knows Iwill have 35 races coded by the end of the month

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2437
  • chmod -R 777 *
    • View Profile
    • OwnageClan
Re: Making a race
« Reply #22 on: July 04, 2010, 01:46:49 PM »
you cannot compile races on sm web compiler, they do not hold custom includes, you must do them locally

[Oddity]TeacherCreature

  • Sr. Member
  • ****
  • Posts: 467
    • View Profile
Re: Making a race
« Reply #23 on: July 04, 2010, 04:44:03 PM »
can u give me a local compiler tutorial? either teach me or link me to a tutorial,

I will spend alot of time developing the mod with u but right now i feel like my hands are tied.

Ownz

  • Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2437
  • chmod -R 777 *
    • View Profile
    • OwnageClan
Re: Making a race
« Reply #24 on: July 04, 2010, 06:27:49 PM »
have you read http://wiki.alliedmods.net/Compiling_SourceMod_Plugins and the links within?