GlennimusPrime Posted May 29 Share Posted May 29 I'm familiar enough with triggering a random point on every frame, but when it comes to triggering a point on a random frame (and only triggering it for one frame only) I'm having some difficulties. I have a somewhat working example available here. I'm telling a random point to turn red for one frame only. But when it comes to randomly choosing when that happens I'm not quite understanding. This somewhat works, but when adjusting the minimum rand time, nothing triggers at all. int trigger = @Frame + fit01(rand($F), chi("min_rand_frame"), chi("max_rand_frame")); if (@ptnum == trigger && @ptnum == $F) { v@Cd = set(1,0,0); } I'm not locked at all to any of this vex, so any other solutions are gladly accepted! Any ideas? trigger_on_rand_frame_v01.hiplc Quote Link to comment Share on other sites More sharing options...
forever_kk Posted May 29 Share Posted May 29 (edited) delete your "trigger_on_rand_frame" node create a new attribwrangle1 Run Over Detail float seed = chf("seed"); int min_frame = chi("min_frame"); int max_frame = chi("max_frame"); int trigger_frame = int(fit01(rand(seed),min_frame,max_frame)); //prt("trigger_frame: ",trigger_frame); if(@Frame != trigger_frame) return; int red_point = int(fit01(rand(seed),0,npoints(0)));//you can change it //prt("red_point: ",red_point); setpointattrib(0,"Cd",red_point,{1,0,0}); only one frame and only one point red Edited June 4 by forever_kk 1 Quote Link to comment Share on other sites More sharing options...
hannes603 Posted May 29 Share Posted May 29 (edited) trigger_random_modulo_red_point.hip here you have rand point on random frame only once. (wip) Edited May 29 by hannes603 Quote Link to comment Share on other sites More sharing options...
GlennimusPrime Posted June 4 Author Share Posted June 4 On 5/29/2024 at 9:34 PM, forever_kk said: float seed = chf("seed"); int min_frame = chi("min_frame"); int max_frame = chi("max_frame"); int trigger_frame = int(fit01(rand(seed),min_frame,max_frame)); prt("trigger_frame: ",trigger_frame); if(@Frame != trigger_frame) return; int red_point = int(fit01(rand(seed),0,npoints(0)));//you can change it prt("red_point: ",red_point); setpointattrib(0,"Cd",red_point,{1,0,0}); Hi @forever_kk Thanks for your attempt. I have never seen a detail wrangle used to manipulate points before. Unfortunately I get errors right off the bat. I think 'prt' first needs to be defined. I wasn't aware of any VEX that uses semicolons either. Is this Python? On 5/30/2024 at 3:53 AM, hannes603 said: here you have rand point on random frame only once. (wip) Also thank you @hannes603 this is working for now, although I would love to explore options that might be able to get away with using a solver where possible. 1 Quote Link to comment Share on other sites More sharing options...
forever_kk Posted June 4 Share Posted June 4 2 hours ago, GlennimusPrime said: Hi @forever_kk Thanks for your attempt. I have never seen a detail wrangle used to manipulate points before. Unfortunately I get errors right off the bat. I think 'prt' first needs to be defined. I wasn't aware of any VEX that uses semicolons either. Is this Python? Also thank you @hannes603 this is working for now, although I would love to explore options that might be able to get away with using a solver where possible. I'm very sorry, "prt" is my custom debugging function. You can delete it Quote Link to comment Share on other sites More sharing options...
GlennimusPrime Posted June 4 Author Share Posted June 4 Thanks for your reply @forever_kk It's somewhat working now with those two prt lines removed, although I'm only getting one single point changing to red when playing down the timeline. I probably didn't explain in my initial post very well, but I'd like random single points to change red, for one frame only, but as the timeline plays down, I'd like other random points to also turn red for one single frame. These points turning red would happen between a random frame time. I hope that explains a little better. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.