|
Delta Force Anything to do with the Delta Force series of games, DF1, DF2, LW, TFD, BHD, DFX, AF etc. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||
|
Is RaNDom truly random?
Random functions don't seem to be truly random.
After trying DORND without success I've resorted to the code below in various forms and with mixed results. Code:
if never then set v1,0 endif if past 1 and elapse 1 then consol# "v1,",v1 consol# "v1,",v1 consol# "v1,",v1 endif if eq v4,1 and never then set v1,0 endif if random 3 and ne rnd, 2 and ne rnd, 3 then set v1,1 else if ne rnd, 1 and ne rnd, 3 set v1,2 else if ne rnd, 1 and ne rnd, 2 set v1,3 endif endif endif if eq v1,1 and ne v1,2 and ne v1,3 and never then set v4,1 SSNtoWP 4,1 endif if eq v1,2 and ne v1,1 and ne v1,3 and never then set v4,1 SSNtoWP 4,2 endif if eq v1,3 and ne v1,1 and ne v1,2 and never then set v4,1 SSNtoWP 4,3 endif Last edited by Guest001; 04-23-2016 at 07:46 AM. |
#2
|
||
|
You don't need to set v1 to 0 at the start 'cause without instructions to change a variable, the game defaults all variables to 0.
I'm not sure why you want v1 displayed in all three console lines each second. This is how I think randomness works in DBHFD: "if random 3" tells the game to set up a loop of values between 1 and 3 (but not 0) changing "randomly" every second, and to trigger this event when the value 1 occurs. If "random 3" equals 1, then it cannot also equal 2 or 3 at the same time, so excluding those in the "if" is extraneous, in my opinion. I think the last three events would work more reliably nested in an "if ontick X then" event. That would also negate the need for v4 to shut v1 off. I agree with you that "random" is not true randomness in NovaLogic games. I don't think true randomness is possible for a computer to create, it can only simulate it as closely as possible to a point that humans can't really tell it's a pattern. My experience with DFBHD is that there is a simple randomish pattern that the game uses to set up random loops, and if you want something more truly random, you have to fiddle with it. So if you set up a simple "random 3" and edit the redirects to nest in an "if ontick", then the truer randomness will hinge on how you choose the tick that the redirect triggers on. I'm pretty sure the same "random 3" value will always happen at the same tick in game, but I haven't really tested that well.
__________________
////////////////////<- SIGNATURE STARTS ->\\\\\\\\\\\\\\\\\\\\\ The NSO Deadline Mod at NovaHQ.net: /////////////////////<- SIGNATURE ENDS ->\\\\\\\\\\\\\\\\\\\\\\
|
#3
|
|||
|
Quote:
set v1,0 sets the state relationship in events. eq rnd, 1 selects the random value EDIT(using ne rnd, 2 etc helped exclude read errors when incrementing) Found using v1 v2 v3 etc complicated things For example: If nothing else uses v1 then you wouldn't need to set it (init) at all because you set the variable when you call (declare) it locally with, if trigger then set v1,1 Last edited by Guest001; 04-24-2016 at 03:47 AM. |
#4
|
||
|
I just tried this:
Code:
if random 3 then set v1 1 else if eq rnd 2 then set v1 2 else if eq rnd 3 then set v1 3 endif endif endif if ontick 3 then if eq v1 1 then ssntowp 4 1 endif if eq v1 2 then ssntowp 4 2 endif if eq v1 3 then ssntowp 4 3 endif endif text# "Random =" rnd For fun, I changed "if random 3" to 6. The text displayed 5 more rarely than I expected. Did not note which WPs got the redirect, though. I'm convinced truer randomness depends on when and how the redirect is triggered. Edit: I'm aware that leaving the "text#" action untagged is bad form, but I think it's acceptable for testing purposes.
__________________
////////////////////<- SIGNATURE STARTS ->\\\\\\\\\\\\\\\\\\\\\ The NSO Deadline Mod at NovaHQ.net: /////////////////////<- SIGNATURE ENDS ->\\\\\\\\\\\\\\\\\\\\\\
|
#5
|
||
|
; 1 "select 1 or 3 randomly" Does this example from DFX2 documentation mean you can't have more than 2 factors? Or is it a typo?
;example select 1 or 3 randomly if random 3 then text "1" else if eq(rnd, 2) text "2" else if eq(rnd, 3) text "3" endif endif endif ;2 Here with DORND and the auto player variable it'll just assign the values in a logical order from top to bottom - no random at all. if past(3) and not ssndead(10000) and never() then DORND ploop text ("auto, 10") end NEXT ploop text ("auto, 20") end NEXT ploop text ("auto, 30") end NEXT ploop text ("auto, 40") end NEXT ploop text ("auto, 50") end ENDDO Last edited by Guest001; 04-24-2016 at 05:34 AM. |
#6
|
||||
|
Quote:
Quote:
It requires a different start each time but thanks anyway Last edited by Guest001; 04-24-2016 at 06:25 AM. |
#7
|
||
|
So it seems to look as though randoms are tied to the same clock or something like that.
They'll go off simultaneously or in in the same order every time. They also seem to "jump the fence" or over-run, not stopping and you can't seem to "capture" them like other events either. Good for triggering lightning etc.. which also has a few bugs by the way. |
#8
|
||
|
The .wac I inserted above was tested in DFBHD. I don't own nor have any experience with DFX2, so I'm not sure what "ploop" means (player operation?), but it makes my inner 7-year-old giggle.
I think "select 1 or 3 randomly" was supposed to be "select 1, 2 or 3 randomly," 'cause that's what that event nest will do. That bit is also in the KYLE.WAC for DFBHD as well. Finally, just to spout completely unqualified, inexperienced conjecture, I'm gonna guess that if you changed the DORND script by making the NEXT operations to OR operations, it might work differently, or maybe crash the game, possibly start wildfires on America's west coast. I have no idea.
__________________
////////////////////<- SIGNATURE STARTS ->\\\\\\\\\\\\\\\\\\\\\ The NSO Deadline Mod at NovaHQ.net: /////////////////////<- SIGNATURE ENDS ->\\\\\\\\\\\\\\\\\\\\\\
|
#9
|
||
|
It just doesn't seem to work in DFBHD either Baldo - even with raw script like this.
Code:
if ontick 1 and never then ssn2ssn 1 4 ssn2ssn 2 5 ssn2ssn 3 6 endif if ticks 2 and random 4 and never then v1 =0 else if rnd ==2 then v1 =1 else if rnd ==3 then v1 =2 else if rnd ==4 then v1 =3 endif endif endif endif if past 9 and ticks 9 and random 5 and never then if never and v1 ==1 then ssntowp 4 1 endif if never and v1 ==2 then ssntowp 4 2 endif if never and v1 ==3 then ssntowp 4 3 endif endif text# "v1 =" v1 Last edited by Guest001; 04-24-2016 at 02:04 PM. |
#10
|
|||
|
Found this post in an unrelated forum though the subject matter had nothing to do with this particular problem, it could be a possible reason for the issues with this.
BTW This is just as difficult as counting player deaths and then apply variables to them. Try it... Quote:
|
#11
|
||
|
Getting closer with this.
Code:
if ontick(1) and never() then ssn2ssn(1,4) ssn2ssn(2,5) ssn2ssn(3,6) endif if random(4) and never then else if (rnd == (2)) and (rnd != (1)) and never then (v1 = (1)) else if (rnd == (3)) and never then (v1 = (2)) else if (rnd == (4)) and never then (v1 = (3)) endif endif endif endif if (rnd == 4)) then inc(v10) endif if eq(v10,4) and never then random() random() random() else if never and v1 ==1 and random(2) then ssntowp 4 1 endif else if never and v1 ==2 and random(2) then ssntowp 5 2 endif else if never and v1 ==3 and random(2) then ssntowp 6 3 endif endif endif endif endif consol# "v1 =" v1 text# "v10 Response" v10 |
#12
|
||
|
And again almost but not a true random - looks like it's just not possible with this method.
Need to find a master script - where they declare the global vars - just hope it's somewhere in one of the PFFs not inside the exe. Code:
if ontick(1) and never() then ssn2ssn(1,4) ssn2ssn(2,5) ssn2ssn(3,6) endif if random(4) then random() random() random() else if (rnd == (2)) and (rnd != (1)) and never then (v1 = (1)) else if (rnd == (3)) and never then (v1 = (2)) else if (rnd == (4)) and never then (v1 = (3)) endif endif endif endif if never and v1 ==1 then ssntowp 4 1 endif if never and v1 ==2 then ssntowp 5 2 endif if never and v1 ==3 then ssntowp 6 3 endif consol# "v1 =" v1 text# "rnd Response" rnd |
#13
|
|||
|
Not giving up... yet.
Another clue. The script below is in C# and I'm thinking - suspecting - guessing that NL used C# to build their game engine so there may be a way to create a math random with WAC script using C# as a basis... REF: http://stackoverflow.com/questions/2...t-number-in-c] Quote:
Last edited by Guest001; 04-25-2016 at 04:31 AM. |
#14
|
||
|
True Random Number Services - on the internet abound - if only it was just numbers for a X-Lotto form that we really needed but this is a little more complex.
Random numbers would be fine if we could work out the script to generate them and then insert them into a variable. I seem to recall something about that so I'll probably end up going back to the test map but it's been a hard slog. Any ideas even remotely along these lines would be appreciated so please feel welcome to put your idea(s) here. In recapping on previous issues even jumping in the helo at different times or going through triggers isn't working. I expected the scripts in many previous attempts to work. The advice given here was sound with many thanks to Baldo and Chopper for their solutions which should have worked in the given scenario. It's puzzling and forces a rather distasteful series of questions and answers to mind. If that's the way it is, then the answer is nada but if it's a bug? Is there in fact, some sort of curly workaround for it? |
#15
|
|||
|
Back again...
COUNTING TICKS 1/10 sec Could we get the variable to select from a random range? Further... Can we apply a number range between 0 and 1 exclusive then add 1 to keep it over zero? newrandom# = 1 * (0.1,0.9) +1 Quote:
Last edited by Guest001; 04-26-2016 at 02:11 PM. |
#16
|
||
|
I have expiremented with random operations once before and it does work but not very well. If im not mistaken, if "random (#)" means the event will be true 1 out of # times.
If you want to have a random action from a single trigger use "dornd" . I expiremented with this before. I wanted a respawning AI to take a random path of 3 different waypoints each time it respawned. If ssnnearssn ( 1, 2, 2) and ssnalive (1) and elapse(3) then Dornd ssntoWP (1, 1) next ssntoWP (1, 2) next ssntoWP (1, 3) Enddo Endif So if SSN 1 is alive and within 2 meters of spawnpoint: SSN 2 ( used a marker) then randomly trigger one of the following actions. Test every 3 seconds. This worked for me, the AI would take one of the 3 paths at random, BUT sometimes, it would get stuck in a loop where for 10 spawns straight it would take the same path but after the 10 or so cycles it would again start taking a different path. |
#17
|
||
|
Hi thanks for helping but I didn't give up, eventually I found a way and published the map.
Here's the map if you're interested. Human vs AI - Special Forces http://novahq.net/maps.php?ID=10470 Here's the code for detecting player deaths - so simple in the end. Code:
;Count Player Deaths if never() then set(v1,0) // Triggers once then resets set(v2,0) // Count 1 adds set(v3,0) // Count 2 Subtracts endif if not ssnalive(player) then set(v1,1) endif if eq(v1,1) then set(v1,0) endif ; Use chain to trigger once each time the variable flips - link will keep counting if chain(1) then add(v2,1) sub(v3,1) endif Random=3 or random(3) is more or less setting the variable to 3 Random==3 or eq means the random value is equivalent to 3 Though I think "=" and "==" are inter-operable because they are both true. gt > (greater-than) lt < (less-than) neq != (not equal to) eq == (equivalent to) etc. etc. NOTE: The following eq example uses parentheses. Code:
if never() and random(10) then if eq(v1,0) and eq(rnd, 3) then set(v14,1) end endif // if eq(v14,1) then ammo2tgt AMMO_60MM_MORTAR(1) dec(v14) endif |
#18
|
|||
|
Quote:
I beat all 10 levels first try with no deaths though. Do I get a special prize? |
#19
|
|||
|
Quote:
The .mis file is in the download so perhaps you could have a go at improving it, I don't mind. Last edited by Guest001; 02-14-2018 at 08:51 PM. Reason: Typo |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|