Cyberpunk 2020

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: dorpond, trevor, Azhrei

Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)
Post Reply
User avatar
ssveter
Kobold
Posts: 13
Joined: Sat Jan 01, 2011 12:18 pm
Location: Texas
Contact:

Cyberpunk 2020

Post by ssveter »

Alright first let me preface that I dont know a lot about code.

Now my question. I am working on a Initiative Macro that replicates the following rule Initiative=1d10+REF+Combat Sense. ModRef is the reflex stat after modification like cyberware and such and would be the calculated REF stat.

[h: initList = "booga=-1"];

[h, foreach(Selected, getSelected("json")), CODE:
{
[switchToken(Selected)]
[SelectedGMName = getTokenImage()]
[arr = json.fromStrProp(initList)]
[if(json.contains(arr, SelectedGMName) != 0), CODE:
{
[init = json.get(arr, SelectedGMName)]
};
{
[result = 1d10]
[init = result + getProperty("Initiative", Selected)]
[tie = getProperty("Initiative", Selected) / 100]
[init = init + tie]
[initList = concat(initList, ";", SelectedGMName, "=", init)]
}]

[switchToken(Selected)]
[addToInitiative()]
[setInitiative(init)]
}]

[h: sortInitiative()]

[h,foreach(Selected, getSelected("json")), CODE:
{
[switchToken(Selected)]
[init = getInitiative()]
[init = floor(init)]
[setInitiative(init)]
}]

Where in here do I need to put the following token properties

*Intelligence (INT):2
*Reflexes (REF):{RealREF} / {ModREF}
RealREF:2
ModREF:{RealREF}
*Technical Ability (TECH):2
*Cool (CL):2
*Attractiveness (ATTR):2
*Luck (LK):2
*Movement (MA):2
*Body (BODY):2
*Empathy (EMP):{RealEMP}/{ModEMP}
RealEMP:2
ModEMP:2
*Run (RUN):{Movement*3}
*Leap (LEAP):{Run/4}
*@Humanity:{RealEMP*10}
Lift:{Body*40} kg
Carry:{Body*10}kg
*@Hit Points (HP):40
-----SKILL------
SkillSPEC:{"Authority":0, "Leadership":0, "CombatSense":0, "Credibilty":0, "Family":0, "Interface":0, "JuryRig":0, "MedTech":0, "Resources":0", "StreetDeal":0}

User avatar
metatheurgist
Dragon
Posts: 364
Joined: Mon Oct 26, 2009 5:51 am

Re: Cyberpunk 2020

Post by metatheurgist »

Maybe it's the Texan accent, but I'm not understanding what you're trying to do. ;)

I'm assuming you want to go through a list of selected tokens, roll initiative for them, put them in the initiative list with a tie-breaker decimal, then go through the list again and remove the decimal? Unless they are already in initList?

Where is this "Initiative" property that you get here?

[init = result + getProperty("Initiative", Selected)]


User avatar
Khali
Kobold
Posts: 5
Joined: Thu Apr 13, 2017 11:40 pm

Re: Cyberpunk 2020

Post by Khali »

Again this may come a few years late but I think I got your point. I got a different solution to this in my framework but for your coding you could use something like the following:

Code: Select all

[h: removeAllFromInitiative()]

[h, foreach(Selected, getSelected("json")), CODE:
    {
    	[switchToken(Selected)]
	[Result=1d10]
	[Bonus=getStrProp(SkillSPEC, "CombatSense") + RealREF]
	[init=Result+Bonus]
    	[addToInitiative()]
    	[setInitiative(init)]
    }
]

[h: sortInitiative()]
   
[h,foreach(Selected, getSelected("json")), CODE:
    {
	[switchToken(Selected)]
	[if (getState("Dead")), CODE:
	     {
		[if(isPC()<1): removeFromInitiative()]
	     }
	]	
    }
]
[h: nextInitiative()]

Post Reply

Return to “MapTool”