Booby Trap (BT)
Posted: Mon Aug 06, 2012 9:30 pm
Ok - walking through what I think could be a booby trap script. Not using any of the script itself - just the logical progression:
Tile 21 42 on a certain map contains a building. We want to place a Booby Trap (BT) script in the BSF file so that the BT is triggered if a PLAYER unit enters the location there is a percentage that the Booby Trap is sprung.
Has Player unit moved into 21 42? -> If Yes - continue; if No - exit
Is BoobyTrapCounter set to 1? -> If Yes, exit script; If No - continue
Continue: Is unit Infantry or Artillery? If Yes - continue; if No - do nothing
Continue: 30 percent chance for Booby Trap to be sprung
Question: Was Trap Sprung? -> If Yes - set BoobyTrapCounter to 1 and attack unit with HE (value TBD), show banner "Booby Trap!," and exit; if No - leave BoobyTrapCounter at 0 and exit.
Now my only concern is that the program will be constantly running this script so perhaps there is a better way to logically think this one out. I also do not know how to have the script run an attack using an HE value at 1 hex. That would be its own part of the routine.
Sorry I didn't flow chart this one out. Hope you guys could follow it. The idea is that it would only harm infantry or artillery and that once used the script would not run again.
Tile 21 42 on a certain map contains a building. We want to place a Booby Trap (BT) script in the BSF file so that the BT is triggered if a PLAYER unit enters the location there is a percentage that the Booby Trap is sprung.
Has Player unit moved into 21 42? -> If Yes - continue; if No - exit
Is BoobyTrapCounter set to 1? -> If Yes, exit script; If No - continue
Continue: Is unit Infantry or Artillery? If Yes - continue; if No - do nothing
Continue: 30 percent chance for Booby Trap to be sprung
Question: Was Trap Sprung? -> If Yes - set BoobyTrapCounter to 1 and attack unit with HE (value TBD), show banner "Booby Trap!," and exit; if No - leave BoobyTrapCounter at 0 and exit.
Now my only concern is that the program will be constantly running this script so perhaps there is a better way to logically think this one out. I also do not know how to have the script run an attack using an HE value at 1 hex. That would be its own part of the routine.
Sorry I didn't flow chart this one out. Hope you guys could follow it. The idea is that it would only harm infantry or artillery and that once used the script would not run again.