This is an explanation of the system I'm using to generate randomized spankings in RPG Maker. I don't know how applicable it will be to other systems, but some of the ideas here might be helpful....
The spanking is done via a common event, but there are some prerequisites that need to be set up before the common event starts:
1) There has to be a similar set of expressions for each spankee, and the face file has to be associated with an actor in the db.
2)That is so I can add them to the party for the spanking (dropping them after). This lets me use a plugin, YanFly Extended Message Pack 2, to call the images for the exclamations rather than coding an event for each person. You can see examples of the the code for this below. \pf[2] = second party member, \faceindex[2]= third image on that party member's face set (they start at 0).
3) You also have to set a variable "Strokes" before calling the common event - that will determine how long the spanking goes. You can randomize it if you like (e.g. Set strokes=10 then add a random number from 1-6), or another option is to give the player the option of setting the value.
Ok so as you might expect the event code is all running in a loop. Each spank adds one to the delivered variable, and once it equals the strokes variable, the event ends and resets both variables:
◆Loop
◆If:Strokes = Delivered
◆Control Variables:#0007 Delivered = 0
◆Control Variables:#0006 Strokes = 0
◆Break Loop
◆
The way I am handling the sprite images mean the common event has to be called from the event with the sprite of the victim. These "movements" actually change the victim's sprite from bare (the starting point), to pink, to red. If you're not making spanked sprites, this part isn't needed...
◆If:Delivered = 15
◆Set Movement Route:This Event (Wait)
: :◇Turn Left
◆
:End
◆If:Delivered = 30
◆Set Movement Route:This Event (Wait)
: :◇Turn Down
◆
Random spank control is just a random number - think of it like a dice roll.
◆Control Variables:#0005 RandomSpankControl = Random 1..12
Here's the meat of the thing. There are three different sets of statements that represent progression through the spanking in terms of the victim's reactions. This is the lowest intensity, less than 20 spanks - you get a mild exclamation on a "roll" of 10, 11 and 12, otherwise just a sound/flash effect. I like to set it up so that each spank doesn't necessarily sound exactly alike too so there are slight volume and timing variations with those too...
◆If:Delivered < 20
◆If:RandomSpankControl ≥ 12
◆Play SE:Spank2 (65, 100, 0)
◆Flash Screen:(255,119,170,255), 20 frames (Wait)
◆Text:None, Window, Bottom
: :\pf[2]\faceindex[2]Ow!
◆Wait:16 frames
◆Control Variables:#0007 Delivered += 1
◆
:Else
◆If:RandomSpankControl ≥ 11
◆Play SE:Spank2 (70, 90, 0)
◆Flash Screen:(255,119,170,255), 20 frames (Wait)
◆Text:None, Window, Bottom
: :\pf[2]\faceindex[0]Oh!
◆Wait:16 frames
◆Control Variables:#0007 Delivered += 1
◆
:Else
◆If:RandomSpankControl ≥ 10
◆Play SE:Spank2 (85, 110, 0)
◆Flash Screen:(255,119,170,255), 20 frames (Wait)
◆Text:None, Window, Bottom
: :\pf[2]\faceindex[2]Ah!
◆Wait:16 frames
◆Control Variables:#0007 Delivered += 1
◆
:Else
◆If:RandomSpankControl ≥ 7
◆Play SE:Spank2 (65, 100, 0)
◆Flash Screen:(255,119,170,255), 20 frames (Wait)
◆Wait:22 frames
◆Control Variables:#0007 Delivered += 1
◆
:Else
◆If:RandomSpankControl ≥ 3
◆Play SE:Spank2 (70, 90, 0)
◆Flash Screen:(255,119,170,255), 20 frames (Wait)
◆Wait:24 frames
◆Control Variables:#0007 Delivered += 1
◆
:Else
◆Play SE:Spank1 (85, 100, 0)
◆Flash Screen:(255,119,170,255), 20 frames (Wait)
◆Wait:25 frames
◆Control Variables:#0007 Delivered += 1
◆
:End
◆
:End
◆
:End
◆
:End
◆
:End
◆
:Else
Once you hit 20 but less than 35 spanks, the exclamations change and become more frequent...
◆If:Delivered < 35
◆If:RandomSpankControl ≥ 11
◆Play SE:Spank2 (90, 100, 0)
◆Flash Screen:(255,68,102,255), 20 frames (Wait)
◆Text:None, Window, Bottom
: :\pf[2]\faceindex[4]Ow! Ah!
◆Wait:16 frames
◆Control Variables:#0007 Delivered += 1
◆
:Else
◆If:RandomSpankControl ≥ 9
◆Play SE:Spank2 (80, 90, 0)
◆Flash Screen:(255,68,102,255), 20 frames (Wait)
◆Text:None, Window, Bottom
: :\pf[2]\faceindex[2]Oh! Ow!
◆Wait:16 frames
◆Control Variables:#0007 Delivered += 1
◆
:Else
◆If:RandomSpankControl ≥ 7
◆Play SE:Spank2 (90, 110, 0)
◆Flash Screen:(255,68,102,255), 20 frames (Wait)
◆Text:None, Window, Bottom
: :\pf[2]\faceindex[3]Aaah!
◆Wait:16 frames
◆Control Variables:#0007 Delivered += 1
◆
:Else
◆If:RandomSpankControl ≥ 5
◆Play SE:Spank3 (85, 100, 0)
◆Flash Screen:(255,68,102,255), 20 frames (Wait)
◆Wait:35 frames
◆Control Variables:#0007 Delivered += 1
◆
:Else
◆If:RandomSpankControl ≥ 3
◆Play SE:Spank2 (95, 100, 0)
◆Flash Screen:(255,68,102,255), 20 frames (Wait)
◆Wait:40 frames
◆Control Variables:#0007 Delivered += 1
◆
:Else
◆Play SE:Spank3 (100, 90, 0)
◆Flash Screen:(255,68,102,255), 20 frames (Wait)
◆Wait:45 frames
◆Control Variables:#0007 Delivered += 1
◆
:End
◆
There's a third set of options for more than 35 spanks, but it's basically the same thing again, just with different exclamations and expressions so I didn't include it. Instead I'm going to point out something that may not be entirely obvious: one of the nice things about this system is that you can interrupt and resume a spanking in order to interject some text that's specific to the current situation:
Set strokes to 20
Call current event
add custom text (e.g. "that was 20 spanks, I'm going to give you another 10 for good measure")
Set strokes = 30 and delivered = 20
Call current event again - if you do that the spanking will proceed from the correct point intstead of starting over with an un-reddened bottom etc.
This tiny "game" has three different spankings using this technique - each one calls the same common event
http://www.mediafire.com/file/m1pl2o...fk/Sandbox.zip