This may be a bit of a nightmare to explain, but i decided since i’ve been lurking on this specific site for maybe a month and a half that i should just kinda actually ask a question or two and see if people have answers.
I’m working on using Sugarcube to make a playable game, since the engine is kinda incredibly easy for one to understand and pick up, (I should know, I only started work on messing with this stuff probably about 2 months ago. wild.) Basically, It’s a dungeon crawler experience where you control around 5 characters who go on quests which you chose. however i’m running into a problem where the end of day cycle i created which then explains what happened does not actively affect ALL adventerer’s, it only interacts with the first one, and even then its semi rare.
Here’s a code snipit
<<set $fordl2 to $fordl + random(1,10)>>
<<set $daft +random(1,10)>>
<<if $daft gte $fordl2>> you win!!! <<set $rep to $rep + random(1,5)>> Because of this you gained Rep with the town. <<else>> you lose!!! <</if>>
gold xp
<<for $forew to 0; $forew lt $fordl; $forew++>>
<<set $foreodint to random(1,5)>>
<<if $Zg.team is "forest" && $foreodint is 1>>
$Zg.Name ended up finding gold, and gaining experience.
<<set $gold to $gold + random(1,5)>> <<set $Zg.xp to $Zg.xp + random(1,5)>>
<<else>> <<set $foreodint++>> <</if>>
<<if $Pg.team is "forest" && $foreodint is 2>>
$Pg.Name ended up finding gold, and gaining experience.
<<set $gold to $gold + random(1,5)>> <<set $Pg.xp to $Pg.xp + random(1,5)>>
<<else>><<set $foreodint++>> <</if>>
<<if $Kg.team is "forest" && $foreodint is 3>>
$Kg.Name ended up finding gold, and gaining experience.
<<set $gold to $gold + random(1,5)>> <<set $Kg.xp to $Kg.xp + random(1,5)>>
<<else>> <<set $foreodint++>> <</if>>
<<if $Lg.team is "forest" && $foreodint is 4>>
$Lg.Name ended up finding gold, and gaining experience.
<<set $gold to $gold + random(1,5)>> <<set $Lg.xp to $Lg.xp + random(1,5)>>
<<else>> <<set $foreodint++>> <</if>>
<<if $Hg.team is "forest" && $foreodint is 5>>
$Hg.Name ended up finding gold, and gaining experience.
<<set $gold to $gold + random(1,5)>> <<set $Hg.xp to $Hg.xp + random(1,5)>>
<<else>> <<set $foreodint++>> <</if>>
<</for>>
ALL of these have coresponding characters they’re interacting with, but here’s the object code for just 1.
<<set $Zg = {
Name : "Z",
name : "z",
class :"Thief",
lvl : 1,
gld : "1",
xp : 10,
hp : 10,
mayor : "false",
team : "false",
height : "6'8"
}>>
On top of that the code for the events are pretty simple but,
<<set $fordl2 to $fordl + random(1,10)>>
<<set $daft +random(1,10)>>
$daft refers to the value of adventurers level’s combined together.
$fordl refers to the area’s level of difficulty,
Basically, $daft and $fordl fight to have a higher value, which determines if they win or lose.
Then, $fordl (the area difficulty level) is put into a for loop up to its value, to give the adventurer’s rewards. . … BUT THIS IS WHERE IM HAVING A PROBLEM. as it only interacts with the first one, and even then its semi rare.
What am i doing wrong?