Post: Stable Roll the dice Template.
10-27-2011, 06:13 PM #1
Correy
I'm the Original
(adsbygoogle = window.adsbygoogle || []).push({}); i got bored and decided to write this up however couldn't be bothered to add the rolls and such..
might aswell release it for people to make there own Smile

    
Correy()
{ self thread GetRolls();
for( i = 0; i < self.Number.size; i++)
self.RandomRoll = randomInt( self.Number[i] );
wait 1;
self thread [[self.Function[self.RandomRoll]]](self.Input[self.RandomRoll]);
self thread MonitorDeath();
}
GetRolls()
{ self notify( "player_rolled" );
self addRoll( 0, "Roll 1", "Power One", ::test);
self addRoll( 1, "Roll 2", "Power Two", ::test);
self addRoll( 2, "Roll 3", "Power Three", ::test);
}
MonitorDeath()
{ self waittill( "death" );
//Add your reset codes here.
}
addRoll( number, name, power, function, input )
{ self.Number[self.RandomRoll] = number;
self.RollName[self.RandomRoll] = name;
self.PowerText[self.RandomRoll] = power;
self.Function[self.RandomRoll] = function;
if( isDefined(input))
{
self.Input[self.RandomRoll] = input;
}
}
hintText()
{ self waittill( "player_rolled" );
self thread maps\mp\gametypes\_hud_message:GaspldNotifyMessage("You Rolled" +self.Number, self.RollName );
wait 1;
self iPrintln("Your Power Is : "+self.PowerText);
}
test(){}


how to add a roll..
    
self addRoll( < roll number > , < name of the roll > , < power text as iPrintLn/ info on the roll> , < roll function > , < roll input >


and here's an example to clear things up..
    
self addRoll( 0, "All Guns", "You've been given all guns!", ::AllGuns);


the output will be..
- oldnotify message saying "You Rolled 0" "All Guns"
- self iPrintLn sayibg "Your Power Is : You've been given all guns"

also, to stable it up make sure you add your reset dvars onto the monitorDeath.. it sables thing up, there's a comment there so you can't miss it.
enjoy rolling the dice Enzo
(adsbygoogle = window.adsbygoogle || []).push({});

The following 3 users say thank you to Correy for this useful post:

INSAN3LY_D34TH, xRaW
10-27-2011, 11:42 PM #11
Correy
I'm the Original
Originally posted by Karoolus View Post
game will freeze on load Winky Winky

you have MonitorRolls() twice, just so you know Winky Winky


ha, i didn't notice.. thanks Happy

---------- Post added at 12:42 AM ---------- Previous post was at 12:41 AM ----------

Originally posted by Newelly2Fresshh View Post
Make it Strok or w/e

or name/function/name/function

name = "option"
func = ::func

etc


no need for a strTok, much easier this way Smile
10-28-2011, 12:26 AM #12
Blackstorm
Veni. Vidi. Vici.
This won't work...
10-28-2011, 01:30 AM #13
Correy
I'm the Original
Originally posted by 2Fresshh View Post
This won't work...


you have a good eye, found the errors and fixed :happycry:
11-10-2011, 08:18 AM #14
xxshredgnarxx
Treasure hunter
Originally posted by Karoolus View Post
game will freeze on load Winky Winky

you have MonitorRolls() twice, just so you know Winky Winky


Karoolus,

Is it possible to go back to 10th prestige from 11th on world at war? I really want to get the world at war token and im stuck at stupid 11th. :/
11-10-2011, 01:32 PM #15
INSAN3LY_D34TH
INSAN3LY GAMING
Originally posted by xxshredgnarxx View Post
Karoolus,

Is it possible to go back to 10th prestige from 11th on world at war? I really want to get the world at war token and im stuck at stupid 11th. :/


i found out how, text me
11-11-2011, 04:48 AM #16
Woof
...hmm
Originally posted by Correy View Post
.

    
Correy(){
self thread GetRolls();
for( i = 0; i < self.Number.size; i++) //Will loop the amount of times of self.Number.size value.
self.RandomRoll = randomInt( self.Number[i] ); //Each time it loops the value of self.
wait 1;
self thread [[self.Function[self.RandomRoll]]](self.Input[self.RandomRoll]);
self thread MonitorDeath();
}

You set a loop that will go around the amount of times of self.Number.size(s) value.
This will loop one statement being the set value of the self.RandomRoll, so at the end the value of it would be the end result anyway.
This is pointless therefore your just going to get the same effect using:
    
Correy(){
self thread GetRolls();
self.RandomRoll = randomInt( self.Number[self.Number.size] );
self thread [[self.Function[self.RandomRoll]]](self.Input[self.RandomRoll]);
self thread MonitorDeath();
}

Which leaves me to my last question, why do you need the self.Number value?
I understand the concept of having a number to each (roll) but if you are going to a short script its not really needed.
Maybe this is what you wanted?, idk.
    
Correy(){
self thread GetRolls();
for( i = 0; i < self.Number.size; i++){
self.RandomRoll = randomInt( self.Number[i] );
wait 1;
self thread [[self.Function[self.RandomRoll]]](self.Input[self.RandomRoll]);
}
self waittill( "death" );
//Add your reset codes here.
}


Hope I don't sound too 'groany', just thought I would tell you. Smile
11-11-2011, 08:22 AM #17
xxshredgnarxx
Treasure hunter
Originally posted by D34TH View Post
i found out how, text me



are you sure itll work??
11-11-2011, 12:43 PM #18
Correy
I'm the Original
Originally posted by BFresshh View Post
    
Correy(){
self thread GetRolls();
for( i = 0; i < self.Number.size; i++) //Will loop the amount of times of self.Number.size value.
self.RandomRoll = randomInt( self.Number[i] ); //Each time it loops the value of self.
wait 1;
self thread [[self.Function[self.RandomRoll]]](self.Input[self.RandomRoll]);
self thread MonitorDeath();
}

You set a loop that will go around the amount of times of self.Number.size(s) value.
This will loop one statement being the set value of the self.RandomRoll, so at the end the value of it would be the end result anyway.
This is pointless therefore your just going to get the same effect using:
    
Correy(){
self thread GetRolls();
self.RandomRoll = randomInt( self.Number[self.Number.size] );
self thread [[self.Function[self.RandomRoll]]](self.Input[self.RandomRoll]);
self thread MonitorDeath();
}

Which leaves me to my last question, why do you need the self.Number value?
I understand the concept of having a number to each (roll) but if you are going to a short script its not really needed.
Maybe this is what you wanted?, idk.
    
Correy(){
self thread GetRolls();
for( i = 0; i < self.Number.size; i++){
self.RandomRoll = randomInt( self.Number[i] );
wait 1;
self thread [[self.Function[self.RandomRoll]]](self.Input[self.RandomRoll]);
}
self waittill( "death" );
//Add your reset codes here.
}


Hope I don't sound too 'groany', just thought I would tell you. Smile


i could of made this smaller but i just didnt :p
11-11-2011, 03:25 PM #19
What's wrong with a good old "if" statement.. or switch case...
You can over complicate things you know...

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo