AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Skills For Xp Based Mod (https://forums.alliedmods.net/showthread.php?t=61058)

Frozen Usp 09-19-2007 15:32

Skills For Xp Based Mod
 
Hi I'm Frozen Usp!

ATM i'm working on a mod that with 4 classes.
The problem is i don't know how to put skill in the races.
Ex. Regeneration for HP and AP, Speed and gravity...




-= !Stay Frozen! =-

purple_pixie 09-20-2007 08:46

Re: Skills For Xp Based Mod
 
Don't ask for PM's / emails, the forum isn't just so you get help.
If someone else found your thread, looking for exactly the same answers, they want to see the answers, not "I've send you a PM of exactly what you need to know" :-D

Step one is to work out when the skills are required.

e.g. HP/Armour - on spawn
regen - starts on spawn, should get called every few seconds.
speed - changes whenever weapon changes.

I'll show you the examples you posted:
Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike> // we include fun and cstrike, because it has useful functions // like setting a user's health and armour respectively #define TASK_REGEN 999 // this is sort of like a variable, only it is constant. // we use it to identify the "regen" task (tasks need an id) new curweapon[33] ; // stores the current weapon for each player // to check if they have changed it. public plugin_init() {     register_plugin("XP Plugin", "1.0", "Me")     register_event("ResetHUD","on_spawn","be")     // this is called on spawn, and a few other places     // "b" means "only hook if this is sent to just one player"     // "e" means "only if the player is alive"         register_clcmd("fullupdate","on_fullupdate")     // this *should* also call ResetHUD,     // we hook it so that it doesn't.         register_event("CurWeapon","on_weaponevent","be")     // hook the "weapon" event.     // this is called on shooting, and on change weapon } public on_fullupdate(id) {     return PLUGIN_HANDLED ; } public on_spawn(id) {     // give the user 50 extra health     set_user_health(id,150)         // and 100 points of armour + a helmet     cs_set_user_armor(id,100,CS_ARMOR_VESTHELM)         // and reduce their gravity to half     set_user_gravity(id,0.5)         // and in 5 seconds, call the on_regen function     set_task(5.0,"on_regen",TASK_REGEN+id) } public on_weaponevent(id) {     new dummy ;     // a "dummy" variable - we don't care what happens to it, we just need one to call the next function     new tempweapon = get_user_weapon(id,dummy,dummy)     // get their current weapon     if ( tempweapon != curweapon[id] )     {         // if they have changed weapon         curweapon[id] = tempweapon         // store their new weapon                 set_user_maxspeed(id,(get_user_maxspeed(id)*1.5))         // and give them a 50% speed increase.     } } public on_regen(id) {     // here, we take away the constant part of the task's id ( 999 )     // and are left with just the player id     // (the task id is 999 + player's id )     if ( id > TASK_REGEN )         id -= TASK_REGEN ;     // don't regen dead people !     if ( !is_user_alive(id) )         return ;         // give user 5 hp     set_user_health(id,get_user_health(id)+5)         // and do it again in 5 seconds     set_task(5.0,"on_regen",TASK_REGEN+id) }
Also, check out the Scripting Tutorials for the XP Mod tutorial.

Frozen Usp 09-20-2007 09:26

Re: Skills For Xp Based Mod
 
Okey,
i going to try to make it work but how about if you whant to putt like
speed on a special class?
Where can i find the scripting tutorials for XP Mod?
+karma

purple_pixie 09-20-2007 10:17

Re: Skills For Xp Based Mod
 
The tutorial is right here ( and on the first page of the code snippets / tutorials forum ... )

I recommend you read through that before thinking how skills apply based on character class.

Frozen Usp 09-20-2007 10:21

Re: Skills For Xp Based Mod
 
My Plugin is based 100% on that tutorial.
It works fine the thing is i got 4 classes but no skills in them
thats what i need help with

purple_pixie 09-20-2007 11:07

Re: Skills For Xp Based Mod
 
Hehe.

What you need to do, is before each "skill" function, check if the user is the right class.

e.g.
Code:
set_user_health(id,150)
would be
Code:
if ( PlayerClass[id] == CLASS_THEONETHATGETSEXTRAHP )     set_user_health(id,150)

Frozen Usp 09-20-2007 13:11

Re: Skills For Xp Based Mod
 
Is There Any chance you can do something like this

Code:
if ( PlayerClass[id] == CLASS_SCOUT )
if ( PlayerClass[id] == CLASS_MEDIC )
set_user_maxspeed(id,(get_user_maxspeed(id)*1 .5))
// and give them a 50% speed increase.

fxfighter 09-20-2007 13:30

Re: Skills For Xp Based Mod
 
Quote:

if ( PlayerClass[id] == CLASS_SCOUT || PlayerClass[id] ==CLASS_MEDIC){
set_user_maxspeed(id,480.0)
}
320 normal you shuld use change weapon event for best effect

Frozen Usp 09-20-2007 13:39

Re: Skills For Xp Based Mod
 
What is the Change weapon effect?
if i post the code can you fix it?

Frozen Usp 09-20-2007 13:46

Re: Skills For Xp Based Mod
 
okey i got it working

can you fix the code so it works?


All times are GMT -4. The time now is 16:04.

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