User Tools

Site Tools


modding:function:objprogramdamage

Discuss this page

objProgramDamage

Syntax (objProgramDamage obj hacker progName aiLevel code) → True/Nil
Arguments obj: The ship that will receive a cyberattack
hacker: The object carrying out the cyberattack
progName: The name that shows up when the obj detects the attack.
aiLevel: The strength of the cyberattack.
code: A segment of code that will be evaluated if the cyberattack is successful
Returns True if the cyberattack succeeds. Nil otherwise
Category spaceObject functions
Description Makes an object carry out a cyberattack against a ship. Success depends on the difference between aiLevel and the target's cyberDefenseLevel. The code will not be evaluated if the cyberattack fails.

Success rate is 90% plus 10% for each level that the aiLevel is greater than the target's cyberDefenseLevel. If the cyberattack succeeds, the hacker is highlighted on the target's SRS for 200 ticks (6.66 seconds) and the target receives a message consisting of “cyberattack detected: ” followed by progName.

Example

(block (target)
	(setq target (sysFindObject gPlayerShip "sA N"))
	(objProgramDamage target gPlayerShip 'SL4V3R 10
		(block Nil
			(shpCancelOrders target)
			(shpSetEventHandler target &baStdAutonBase;)
			(shpSetController target 'auton)
			(objSetSovereign target &svFriendlyAuton;)
			(shpOrder target 'escort gPlayerShip)
			)
		)
	)

The player launches a cyberattack on the nearest ship. If successful, that ship will be turned into an auton.

Return to Space Object functions list

Return to functions list

modding/function/objprogramdamage.txt · Last modified: 2017/02/05 00:23 by 0xabcdef