Author Topic: Coding Question  (Read 4153 times)

0 Members and 1 Guest are viewing this topic.

Hollywood

  • Orb Member
  • Elvin Legion
  • ***
  • Posts: 418
  • Reputation: +0/-0
Coding Question
« on: February 4, 2004 11:21 am CST »
I made a .cs file to quickly spawn packs (using admin) with exp, sp, lck, etc.. But have run into some problems. One, the packs all have to have a different number, which a simple script cannot do. Two, I was looking for something much easier to use for questing on the server.

What I want to make is a key that spawns one of many random packs, from adding sp and lck or exp to a rarer one that takes them or something. On the pressing of the key, one of the random packs spawns and so on.

Thank you anyone for some help!
« Last Edit: December 31, 1969 06:00 pm CST by Hollywood »

Aphex

  • Uber Menace
  • *******
  • Posts: 1,670
  • Reputation: +0/-0
(No subject)
« Reply #1 on: February 4, 2004 08:53 pm CST »
the one you wrote for me rocks! you dont need to change it. It made 3 pack quest go sooo fast. But having a radom one would be nice. Because you can only have one SP or one EXP at a time. If there was a way around only having one at a time it would be great.
« Last Edit: December 31, 1969 06:00 pm CST by Aphex »
Quote from: "Aphex"
<3 google


Hollywood

  • Orb Member
  • Elvin Legion
  • ***
  • Posts: 418
  • Reputation: +0/-0
(No subject)
« Reply #2 on: February 4, 2004 09:56 pm CST »
Thanks to UnderGod you are about to get a new super one!
« Last Edit: December 31, 1969 06:00 pm CST by Hollywood »

DeathAdder

  • Orc Thrasher
  • ***
  • Posts: 137
  • Reputation: +0/-0
    • http://www.los.planetubh.com
(No subject)
« Reply #3 on: February 6, 2004 10:51 am CST »
Aphex, it is possible to have randome EXP SP and LCK or whatever in one pack. I have done it befor. Give me the details and I'll write something up for you that you can modify and throw into your quest. ^_^
« Last Edit: December 31, 1969 06:00 pm CST by DeathAdder »
<img src="http://www.pcrpg.org/pics/hosted/dadder.jpg">

LastWish

  • What's Yours?
  • Uber Menace
  • *******
  • Posts: 1,743
  • Reputation: +0/-0
(No subject)
« Reply #4 on: February 6, 2004 07:42 pm CST »
Code: [Select]
$packx = -2358;

$packy = -289;

$packz = 70;


function packquest()
{
say(0, "#anon all 1 A strange line of packs has appeared outside keldrin town!");
say(0, "#block 1");
say(0, "#addexp %1 100");
say(0, "#addsp %1 50");
say(0, "#fell %1");
say(0, "#endblock");

say(0, "#block 2");
say(0, "#addexp %1 1000");
say(0, "#addsp %1 100");
say(0, "#fell %1");
say(0, "#endblock");

say(0, "#block 3");
say(0, "#addexp %1 5000");
say(0, "#addsp %1 150");
say(0, "#fell %1");
say(0, "#endblock");

say(0, "#block 4");
say(0, "#addexp %1 8000");
say(0, "#addsp %1 200");
say(0, "#fell %1");
say(0, "#endblock");

say(0, "#block 5");
say(0, "#addexp %1 10000");
say(0, "#addsp %1 250");
say(0, "#fell %1");
say(0, "#endblock");

say(0, "#block 6");
say(0, "#addexp %1 20000");
say(0, "#addsp %1 500");
say(0, "#anon all 1 %1 got the GOD PACK!");
say(0, "#fell %1");
say(0, "#endblock");

 
                                 

%x = 3;

%y = 3;                      

%newx = 0;

%newy = 0;

%packcounter = 1;          

 

            %newx = (%x + $packx);  

            %newy = ($packy - %y);        

 

for(%counter=0;%counter<20;%counter++)  

{                                      

                        %cnt = 4;      

                        %who = (getRandom() * %cnt);  

                        echo(%who);              

 

 

 

            if (%who < 1)

            {

                        say(0, "#spawnpack "@%packcounter@" "@%newx@" "@%newy@" "@$packz@" | * * >#call 1 ^victimName,");

            }                      

            else if ((%who > 1)&&(%who < 2))

            {

                        say(0, "#spawnpack "@%packcounter@" "@%newx@" "@%newy@" "@$packz@" | * * >#call 2 ^victimName,");

            }

            else if ((%who > 2) && (%who < 2.9))

            {

                        say(0, "#spawnpack "@%packcounter@" "@%newx@" "@%newy@" "@$packz@" | * * >#call 3 ^victimName,");

           

            }          

            else if ((%who > 2.9) && (%who < 3))

            {

                        say(0, "#spawnpack "@%packcounter@" "@%newx@" "@%newy@" "@$packz@" | * *  >#call 6 ^victimName,");

           

            }                        

            else if ((%who > 3)&&(%who < 3.5))

            {

                        say(0, "#spawnpack "@%packcounter@" "@%newx@" "@%newy@" "@$packz@" | * * >#call 4 ^victimName,");

            }  


           else if ((%who > 3.5)&&(%who < 4))

            {

                        say(0, "#spawnpack "@%packcounter@" "@%newx@" "@%newy@" "@$packz@" | * * >#call 5 ^victimName,");

            }






                       

%newx = (%newx + %x);                  
         

%newy = (%newy - %y);        

%packcounter++;              

}                                                      

return;

}

function clearpackquest()                        

{                                                  

%packcounter = 1;                    

                                               

 

            for(%counter=0;%counter<10;%counter++)

                        {

                        say(0, "#delpack "@%packcounter@"");          

                        %packcounter++;

                        }          

say(0, "#delblock 1");

say(0, "#delblock 2");

say(0, "#delblock 3");

say(0, "#delblock 4");

say(0, "#delblock 5");

say(0, "#delblock 6");

}


This spawns 20 packs or so outside of keldrin town, it's the one I used..  you can change the original coordinates at the top to make the packs wherever you want.  Also, you can change the number of packs spawned at the for(%counter=0;%counter<20;%counter++)  line.  Change the prizes in the blocks, but you don't have to delete any if you are only doing 3 packs--it will just choose random blocks to put in those 3 packs.  Don't be afraid to put a few set-velocities in there..  it usually ends up in a good laugh :P

*edit*  Oh, and the blocks go in order from least rare to spawn to the most rare to spawn (1-6, 1 should be the lowest prize and 6 should be the highest).
« Last Edit: December 31, 1969 06:00 pm CST by LastWish »

Aphex

  • Uber Menace
  • *******
  • Posts: 1,670
  • Reputation: +0/-0
(No subject)
« Reply #5 on: February 7, 2004 09:38 am CST »
yeah but what I really want is a script that will spawn packs at the push of a button. Just one.

I know you probably cant do it. And Hollywood wrote me a script that kind of does that but I can only have one exp, sp, lck, and coins pack out at a time. so only 4 at any given time which is good for three pack but im looking for something that would be good for easter egg or the one I do that's underwater. so that I can just spawn a random pack at my crosshair without having to type in the command. because that takes forever!
« Last Edit: December 31, 1969 06:00 pm CST by Aphex »
Quote from: "Aphex"
<3 google


-eViL-

  • Minotaur Rager
  • ******
  • Posts: 880
  • Reputation: +0/-0
(No subject)
« Reply #6 on: February 7, 2004 10:57 am CST »
Code: [Select]
$SpawnPack::Count = 0;

function SpawnPack(%Special)
{
%PackContents = "";
%Name = $PCFG::Name[$PCFG::CurrentPlayer] $+ $SpawnPack::Count;
%ADD[1] = "COINS " @ foor((getRandom() * 5000));
%ADD[2] = "LCK " @ floor(getRandom() * 3));
%ADD[3] = "EXP " @ floor(getRandom() * 1000));
%ADD[4] = "SP " @ floor(getRandom() * 10));

echo("* * * * * * * * * * * * * * *");
echo("Pack Name: " @ %Name);
for(%i=1; %i <= 4; %i++)
{
if(getWord(%ADD[%i], 1) != 0)
{
echo(%ADD[%i]);
%PackContents = %PackContents @ " " @ %Add[%i];
}
}
if(%Special != "")
{
echo(%Special);
%PackContents = %PackContents @ " " @ Special;
}
echo("* * * * * * * * * * * * * * *");

say(0, "#spawnpack "@%Name@" | * * " @ %PackContents);
$SpawnPack::Count++;
}

bindCommand(keyboard0, make, "1", TO, "SpawnPack();");

// Use:
// SpawnPack(); spawns basic pack with random coins, exp, lck, and sp (this is bound to the key)
// SpawnPack("LongSword 1"); will spawn basic pack + 1 Long Sword
// SpawnPack(" KeldrinArmor 2 Claymore 10"); will spawn basic pack + 2 Keldrin Armor's and 10 Claymores.
// Etc.


something like that maybe?  i dunno, just my 2 cents, threw it together in about 5 minutes...
« Last Edit: December 31, 1969 06:00 pm CST by -eViL- »
There's nothing ever wrong but nothing's ever right
Such a cruel contradiction

Aphex

  • Uber Menace
  • *******
  • Posts: 1,670
  • Reputation: +0/-0
(No subject)
« Reply #7 on: February 7, 2004 11:41 am CST »
thanks. i'll try it out.
« Last Edit: December 31, 1969 06:00 pm CST by Aphex »
Quote from: "Aphex"
<3 google


Pecker

  • Server Mommy
  • Uber Menace
  • ******
  • Posts: 1,704
  • Reputation: +0/-0
(No subject)
« Reply #8 on: February 7, 2004 02:06 pm CST »
Quote from: "Aphex"
yeah but what I really want is a script that will spawn packs at the push of a button. Just one.

I know you probably cant do it. And Hollywood wrote me a script that kind of does that but I can only have one exp, sp, lck, and coins pack out at a time. so only 4 at any given time which is good for three pack but im looking for something that would be good for easter egg or the one I do that's underwater. so that I can just spawn a random pack at my crosshair without having to type in the command. because that takes forever!



I've been trying to find someone to figure that out forever. =/
« Last Edit: December 31, 1969 06:00 pm CST by Pecker »

Lidge Farkley

  • Uber Menace
  • *******
  • Posts: 1,357
  • Reputation: +2/-3
    • http://www.angelfire.com/ca2/psychosworld2/
(No subject)
« Reply #9 on: February 7, 2004 05:20 pm CST »
What Evil posted should work.... if it does not I would be damn suprised.  What are the results on it?



Also... I am probably just ranting crazily... but this may be a pattern to make one as well:

Create a variable that would be recognised between many functions and call it some thing unique... I would just call it "packnumbers" if that works.

write a function based on math that keeps track of your pack numbers by simply adding a "1" to the variable "packnumbers" every time you run the function to create a pack.

nest this instruction that makes a new pack that is based on the mathematical addition instruction which takes a defined name or the client connection name for the pack and tacks the "packnumbers" variable on to the end of the string that makes the pack.

nest the final instruction which would then make the pack and could also be assigned to get it's contents generated from some random number generators, multiple or singular content types for each content type you wanted in the pack.


The only things I would change in Evils script... is that I would put the pack addition in the beginning of the script (just before the PackContents = " " line) and I would write several different "say" parts which would have their own keybinds that would each get their variables of the different items/bonus effects from a list or from what the used defines in each of them... then keybinding to each seperately.
Bah... that sounded loopy... but I think it makes some sense.

Anyway, evils's sshould work!
« Last Edit: December 31, 1969 06:00 pm CST by Lidge Farkley »
Lend your heart unto the divine mineral TOPAZ;
from which our reverent hearts and minds sprang.
Also Known As:  Alcoholic 007
My Page of tribes Tools and Helpful "FAQ" Stuff

UnderGod

  • Centurian Lord
  • ********
  • Posts: 2,691
  • Reputation: +0/-0
(No subject)
« Reply #10 on: February 9, 2004 05:37 pm CST »
Uhh Pecker, you know who to ask for that kind of stuff.
« Last Edit: December 31, 1969 06:00 pm CST by UnderGod »
"The right man in the wrong place can make all the difference in the world"

-eViL-

  • Minotaur Rager
  • ******
  • Posts: 880
  • Reputation: +0/-0
(No subject)
« Reply #11 on: February 9, 2004 06:33 pm CST »
Quote from: "UnderGod"
Uhh Pecker, you know who to ask for that kind of stuff.


yes, ask ozzy.
« Last Edit: December 31, 1969 06:00 pm CST by -eViL- »
There's nothing ever wrong but nothing's ever right
Such a cruel contradiction

Xanth

  • Minotaur Rager
  • ******
  • Posts: 760
  • Reputation: +0/-0
(No subject)
« Reply #12 on: February 19, 2004 02:32 pm CST »
Groovy!
Very Nice!
Now all you need is a GUID to go with it, LOL
« Last Edit: December 31, 1969 06:00 pm CST by Xanth »


Currently playing BF2
(Name: Xanth-911 ) BooYa!!

Hersh

  • Elvin Legion
  • *****
  • Posts: 413
  • Reputation: +0/-0
(No subject)
« Reply #13 on: February 20, 2004 08:54 pm CST »
I'll help  :D

GUIDE:

Save eViL's code as "eViLPacks.cs"
In Autoexec add the line.
exec("eViLPacks.cs");

Start TRIBES with - mod rpg
Become admin 3 or higher, Push 1 on your keyboard.*

For more specific Pack items...
In console - Result
Quote from: "eViL"
SpawnPack("LongSword 1"); will spawn basic pack + 1 Long Sword
SpawnPack(" KeldrinArmor 2 Claymore 10"); will spawn basic pack + 2 Keldrin Armor's and 10 Claymores.


End Guide.

*1 as in above TAB, not on your numberpad.
« Last Edit: December 31, 1969 06:00 pm CST by Hersh »

I kissed a drunk girl on the lips.
This post, by its very length, defends itself against the risk of being read.