Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

how to put skill system?

i can't find a way to add some kind of skill selection like SPECIAL from fallout.(Im using Sugacube 1.x)
i really appreciate some help.

and, ¿how i create a probability system(like skyrim persuation)?

Comments

  • Well, the short answer is with quite a bit of work. ;-)

    The longer one depends on how complex you want to get.

    Simple skill system:

    Add a skill points available attribute to to your user object. You'll need to work out some logic about when to give them available skill points.

    Add an array of available skills to the character. How you build this up and when you expand it is something you'll need to work out. Might be the same fixed set for everyone, might be class based, might be achievement based.

    Then you need a panel where a character can pick a skill they don't have and acquire it. More complex versions give them multiple levels of each skill and might make the training to acquire/raise it only available at certain places in the game.

    Then you need action systems in the game that actually use the skills. Lock picking is fine, but if there are no locks to pick, you've just wasted a skill point. Likewise combat skills need to affect your combat system. Performance skills may just affect the availability of story actions (at the festival, poets gets to recite, singers get to sing and muck shovellers get to sit and watch).

    Not something I'd want to implement without giving it a bit of forethought. I'd strongly suggest you go for the simplest option that'll work for you as your first attempt.

    You can get random numbers with Math.random().
  • mykael wrote: »
    You can get random numbers with Math.random().
    Or by using SugarCube 1's built-in random function.
  • greyelf wrote: »
    Or by using SugarCube 1's built-in random function.
    Indeed. Using SugarCube's built-in random functions and methods are always the best idea if you need random values. Not only are they easier to use, but they always use the appropriate PRNG (Math.random() or, if enabled, SugarCube's seedable PRNG).
  • thank you for the help.
    i used the <<click>> and <span> and <<replace>> macros for the selection but i don't know how to put a limit. because i click too many times and i get 22222222 strength and i only want a limit of 10 strength and 24 points
    there is the code.
    Strength: <<set $pcStr to 10>><span id="stats-str"><<print $pcStr>></span> 
    ( <<click "[+]">><<set $pcStr++>><<replace "#stats-str">><<print $pcStr>><</replace>><</click>> 
     <<click "[-]">><<set $pcStr-->><<replace "#stats-str">><<print $pcStr>><</replace>><</click>> 
    
  • Hey, here is how I am doing it if you mean a simple attribute/skill system. Also, currently working on editing yours so that there can be a limit to the value. I know there is a way, I have the idea in my head.

    Anyways, here is my current system, presupposing the variables $charstrength and $statsavailable and the fact that this is set in a passage called "stats":
    Strength: <<print $charstrength>> <<nobr>>
    <<if $charstrength >0>> 
    		<<button "-">> 
    			<<set $charstrength to $charstrength -= 1>>
    			<<goto "stats">>
    			<<set $statsavailable to $statsavailable += 1>>
    		<</button>> 
    	<</if>> 
    <<if $charstrength < 10>>
    	<<if $statsavailable > 0>> 
    			<<button "+">>
    				<<set $charstrength to $charstrength + 1>>
    				<<goto "stats">>
    				<<set $statsavailable to $statsavailable -= 1>>
    			<</button>>
    		<</if>>
    	<</if>>
    <</nobr>>
    

    When you press the increase button it adds 1 to $charstrength, subtracts 1 from $statsavailable and then reloads the passage. Once you get to either $charstrength = 10 or $statsavaiable = 0, it stops allowing you to increase the value, but still allows you to decrease it on the stats page. I do this for each "skill" or "attribute."

    Is this what you are looking for?
  • update: I've found a way to limit your system, but now I have another problem. I can't get the decrease function working properly.

    my funky version of your code... I've included enough code for 2 stats so you can see how it would be limited (i.e., how if you maxed str at 10, you could only get dex to 8):
    You have <span id="statpoints"><<print $statsavailable>></span> point<<if $statsavailable >1>>s<</if>>
    
    Strength: <span id="strnumber"><<print $charstrength>></span><<nobr>>
    
    <span id="str"><<button "+">>
    	<<set $charstrength ++>>
    	<<set $statsavailable -->>
    	<<replace #statpoints>><<print $statsavailable>><</replace>>
    	<<replace #strnumber>><<print $charstrength>><</replace>>
    	<<if $charstrength == 10>>
    		<<replace #str>><<print "">><</replace>>
    	<</if>>
    	<<if $statsavailable == 0>>
    		<<replace #str>><<print "">><</replace>>
    	<</if>>
    <</button>></span>
    
    <</nobr>>
    Dexterity: <span id="dexnumber"><<print $chardexterity>></span><<nobr>>
    
    <span id="dex"><<button "+">>
    	<<set $chardexterity ++>>
    	<<set $statsavailable -->>
    	<<replace #statpoints>><<print $statsavailable>><</replace>>
    	<<replace #dexnumber>><<print $chardexterity>><</replace>>
    	<<if $chardexterity == 10>>
    		<<replace #dex>><<print "">><</replace>>
    	<</if>>
    	<<if $statsavailable == 0>>
    		<<replace #dex>><<print "">><</replace>>
    	<</if>>
    <</button>></span>
    
    <</nobr>>
    

    Remember, in this example you would have to have the variables $charstrength, $chardexterity and $statsavailable. I'm on the verge of a breakthrough with how to make the decrease button work inside of this code properly, so that it never disappears permanently.
  • edited January 2016
    Ahhhh, sorry mate, I just can't do it without having to reload the passage entirely. So here is the example I first gave with 3 different attributes.

    My system:
    You have $statsavailable point<<if $statsavailable > 1>><<print "s">><</if>> left for stat distribution.
    
    Strength: <<print $charstrength>> <<nobr>>
    
    <<if $charstrength >0>> 
    		<<button "-">> 
    			<<set $charstrength -->>
    			<<goto "stats">>
    			<<set $statsavailable ++>>
    	        <</button>> 
    <</if>> 
    <<if $charstrength < 10>>
    	<<if $statsavailable > 0>> 
    			<<button "+">>
    				<<set $charstrength ++>>
    				<<goto "stats">>
    				<<set $statsavailable -->>
    			<</button>>
    	<</if>>
    <</if>>
    
    <</nobr>>
    Dexterity: <<print $chardexterity>> <<nobr>>
    
    <<if $chardexterity >0>> 
    		<<button "-">> 
    			<<set $chardexterity -->>
    			<<goto "stats">>
    			<<set $statsavailable ++>>
    		<</button>> 
    <</if>> 
    <<if $chardexterity < 10>>
    	<<if $statsavailable > 0>> 
    			<<button "+">>
    				<<set $chardexterity ++>>
    				<<goto "stats">>
    				<<set $statsavailable -->>
    			<</button>>
    	<</if>>
    <</if>>
    
    <</nobr>>
    Constitution: <<print $charconst>> <<nobr>>
    
    <<if $charconst >0>> 
    		<<button "-">> 
    			<<set $charconst -->>
    			<<goto "stats">>
    			<<set $statsavailable ++>>
    		<</button>> 
    <</if>> 
    <<if $charconst < 10>>
    	<<if $statsavailable > 0>> 
    			<<button "+">>
    				<<set $charconst ++>>
    				<<goto "stats">>
    				<<set $statsavailable -->>
    			<</button>>
    	<</if>>
    <</if>>
    
    <</nobr>>
    
    <<if $statsavailable == 0>>[[Next|wherevertheheckyouwantthecharactertogonext]]<<else>>Use up all of your stat points before you move on.<</if>>
    

    Note: this example presumes the variables $charconst = 0, $chardexterity = 0, $charstrength = 0 and $statsavailable = 18. Oh, also that this is set in a passage called "stats"
  • @mykael:
    The Issues Implementing an RPG style Stats Screen (Stat point allocation etc) in Sugarcube 1x thread also includes two examples (one by TheMadExile and the other by me) showing how to implement what you asked for. The solutions should work in both SC 1 and 2.
Sign In or Register to comment.