Thread: [DFX2] Is RaNDom truly random?
View Single Post
  #18  
Old 02-12-2018, 04:52 PM
Oscarmike247 is offline Oscarmike247
Oscarmike247's Avatar
Registered User

Join Date: Feb 2018
Posts: 259

Quote:
Originally Posted by stompem View Post
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
As you probably know you can pick the random using relational operators.

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
played your map and thoroughly enjoyed it. I commented in the map posting.

I beat all 10 levels first try with no deaths though. Do I get a special prize?
Attached Images
File Type: jpg SS00001.jpg (128.4 KB, 6 views)
Reply With Quote