I think I did this right:
world << "[randdmg] damage!"
I am trying to make a verb based on that but nothing works. I just don't know what to do with this! How do I use this to make my coding simpler?
I have this for example:
while(1) //while 1 is true which is always
if(src.loc==locate(12,6,1) | src.loc==locate(12,3,1) | src.loc==locate(11,9,1) && src.pturn) //if the location of myself and my 2 allies is true as well as if its my turn. pturn means player's turn.
for(var/mob/enemy/Prowler/o in locate(15,6,1)) //defining enemy 1: Prowler that already exists in location 15,6,1 of my map
for(var/mob/enemy/Bandit/i in locate(15,3,1))
world << "[src]'s turn" //who's turn
var/tmp/action=input("What would you like to do?") in list ("Attack", "Run") // input turn actions. variable is "action"
if(action=="Attack") //if that action is attack
var/tmp/attackwho=input("Attack who?") in list ("Enemy 1", "Enemy 2") // second input this time choosing to attack who. variable is "attackwho"
if(attackwho=="Enemy 1")//if chosen enemy 1
var/tmp/randomdmg = rand(1,10) // random damamge variable
o.hp-= randomdmg //"o" Prowler variable is damaged randomly
world << "[src] attacks [o] for [randomdmg] dmg" //outputs into the world what has happened. the player attacked prowler for that random damage
src.pturn=0 // player's turn becomes 0 so its not my turn anyore
if(attackwho=="Enemy 2") //same as above just enemy 2
var/tmp/randomdmg = rand(1,30)
world << "[src] attacks [i] for [randomdmg] dmg"
if(action=="Run") // if chose the action Run
if(prob(20)) // 20% probability to run away
src.loc=prevloc // returns to previous location as I defined it in the Move() proc
src.pturn=1 //returns player's turn to 0 if run away
else src.pturn=0 // if I don't run away then its no longer my turn
// global turn 2 making it Prowler's turn
How can a Datum make this simpler and shorter?