Skip to content

old chains and loops

James edited this page Jul 19, 2015 · 8 revisions

SPU handling

$(SPU A).interract(function() {
	AccessIC="SPU 1";
	Access_Node="SPU 1";
	IC_Location="SPU 1";
	AccessIC="Sub Procession Unit\n\n";
	g:Skill_Test_Modifier=2;
	enableTrigger("SPU 1 Hacked");
	Conversation("Matrix-Access IC", persona.last());
		// throw("IC Trip")
		// throw("SpoofTest")
	teleportCamera(persona.last());
	throw("Matrix Test");
});

$(map).on("SpoofTest", function(){
	if(g:SkillTest>(g:DeckerTraining+g:Program_Rating_SPOOF+curentactor.decking)) {
		g:Spoof_Check=0;
		You_Rolled_A();
		throw("Masking Test");
		endTurn(Actor.current);
	  } else {
		sound("Matrix BuffHit", 1, noloop);
		g:Spoof_Check=0;
		You_Rolled_A();
		if(persona.last().nearestTaggedPropName("X"),hasTagName("Barrier")) {
			plytext("You are able to spoof the system and disablel the Access IC without alerting the security system.");
			deletePropsByTagName("Barrier", 10);
		  }
		if(persona.last().nearestTaggedPropName("X"),hasTagName("BarrierB")) {
			plytext("You are able to spoof the login protocols and disablel the Access IC without alerting the security system.");
			deletePropsByTagName("BarrierB", 10);
		  }
		throw("Node Hacked")
	  }
});


$(map).on("IC Trip", function(){
	spawnByTagName(IC_Location);
	deletePropsByTagName("BarrierB", 10);
	throw("IC Trip Node Disable");
});

$(map).on("IC Trip Node Disable", function(){
	// All ifs would run simultaneously
	if(persona.last().nearestTaggedPropName("Peaceful"),hasTagName("SPU 1")) {
		//enableTrigger("SPU 1 Hacked");
		//throw("Node Hacked");
			//disableTrigger("SPU 1 Hacked");
			disablePropInteraction("Sub Processing Unit A");
			prop.setHacked("Sub Processing Unit A");
	  }
});

Run perils

$(map).interact(alarmPanelX) {
        if(e.triggeringActor.team==Shadowrunners)
                conversation(alarmPanels, e.triggeringActor)
                enable(securityAlarmDisableTest)
                throw(test)
                g:alarmPaneID=1
          } else {
                displaytext("Damn, they triggered the alarm.")
                throw(alarm)
          }
  }

$(map).on(AlarmPanelTest) {
        if() {
                g:alarmPanelDisabled4=true;
                playSound(beepGenericGood)
                displayText("Easy.")
           } else {
                endTurn(currentActor)
                displayText("Damn, I tripped the Alarm")
                throw(alarm)
           }
        displayText("You rolled a")
        displayText(g:skillTest.tostring())
        disable(securityAlarmDisableTest)
  }

$(map).awareness {
        if(
                (g:alarmAlreadyActive===false)&&
                (e.triggeringActor.team==Lonestar)&&
                (e.triggeringActor.inside(alarmArea2))&&
                (e.triggeringTargetActor==Shadowrunners)
          ) {
                order(e.triggeringActor, interact, alarmPanel[2])
           }
  }

$(map).enter(cameraX) {
        if(
           (e.triggeringActor.team==Shadowrunners)&&
           (g:skillTest>e.triggeringActor.quickness)&&
           (g:alarmAlreadyActive==false)
          ) {
                displayText("You are not quick enough to and the camera spots you")
                displayText("You rolled a")
                displayText(g:skillTest.tostring())
                throw(alarm)
          }
  }

$(map).enter(laserTripwireX) {
        if(e.triggeringActor.team==Shadowrunners) {
                if(e.triggeringActor.intelligence>e.triggeringActor.quickness) {
                        g:testPass="You are able to notice the tell-tale signs of a laser tripwire and carefully avoid setting off the alarm."
                        g:testFail="You fail to notice the laser tripwire, break the beam and trigger the alarm."
                  } else {
                        g:testPass="You notice the beam of light at the last second and dance over the tripwire avoiding an alarm."
                        g:testFail="You fail to notice the laser tripwire, stumble through it and trigger the alarm."
                  }
                if(
                        max(e.triggeringActor.intelligence,e.triggeringActor.quickness)
                        > g:skillTest
                      ) {
                        displayText(G:testPass)
                  } else {
                        displayText(G:testFail)
                        throw(alarm)
                  }
                throw(test)
          }
  }

Pay Data

$(map).on({ "PayDataStart":function(){
                if(g:deckStorageFileCount<6) {
                        g:deckStorageFileCount++;
                        throw(randomData);
                  } else {
                        system.displayText("You can not have more than six PayData files in storage"...)
                  }
          }, "randomData":function(){
                payData=rand(1,9);
                throw(payData);
          }, "payData":function(){
                if((nodeLevel=="BLUE")&&(g:Deck_Storage_Used > (g:Deck_total-Storage - 10))) {
                        system.displayText("Your deck storage is full. Better unload some of your digital loot"...)
                  } else {
                        switch(payData) {
                                case 1: payData1Integrity();
                               ...
                                case 9: payData9Integrity();
                          }
                  }
          }
  });

// last item of list calls first on fail
func payData1Integrity() {
        if(map.actors.PC0.hasItem("Pay Data BLUE 1")) {
                map.actors.PC0.recieveItem("Pay Data BLUE 1")
          } else {
                payData2Integrity();
          }
  }

lighting

$(map).ready(func(){
        if(g:risingOrSedtting===1) {
                map.ambientLight=rgb(g:daylight, g:daylight, g:daylight);
                sleep_throw(5, nightFall);
          }
        if(g:risingOrSedtting===0) {
                map.ambientLight=rgb(g:daylight, g:daylight, g:daylight);
                sleep_throw(5, sunRising);
          }
})

$(map).on("sunRising", func(){
        if(g:daylight<2) {
                g:daylight++;
                map.ambientLight=rgb(g:daylight, g:daylight, g:daylight);
                sleep_throw(5, sunRising);
          } else {
                g:risingOrSetting=1;
                throw(nightFall);
          }
})

$(map).on("nightFall", func(){
        if(g:daylight>-1) {
                g:daylight--;
                map.ambientLight=rgb(g:daylight, g:daylight, g:daylight);
                sleep_throw(120, nigghtFall);
          } else {
                g:risingOrSetting=0;
                throw(sunRising);
          }
  })

Pacts

all ifs run in parallel

$(map).ready(func(){
        if(map.actors.PC0.hasItem("Gaes Pact")) {
                map.actors.PC0.magic+=g:gaesRating
          }
        if(map.actors.PC0.hasItem("pact of Strength")) {
                map.actors.PC0.statusBuff({"dur":-1,"innate":true,"desc":""
                        ,effects:["killingHands"]})
          }
        if(map.actors.PC0.hasItem("Lesser Pact of Haste")) {
                map.actors.PC0.runSpeed=sprint;
          }
        if(map.actors.PC0.hasItem("Greater Pact of Haste")) {
                map.actors.PC0.runSpeed=superSpeed;
          }
  })

Training

all ifs run in parallel

$(map).ready(func(){
        if(g:CombatTraining>0) {
                map.actors.PC0.skillBuff({"dur":-1,"desc":"Close Combat Training"
                        ,effects:[{"closeCombat":g:Training}]})
          }
        if(g:deckingTraining>0) {
                map.actors.PC0.skillBuff({"dur":-1,"desc":"Decking Training"
                        ,effects:[{"decking":g:deckingTraining}]})
          }
        if(g:droneTraining>0) {
                map.actors.PC0.skillBuff({"dur":-1,"desc":"Drone Control Training"
                        ,effects:[{"droneControl":g:droneTraining}]})
          }
        if(g:fireArmsTraining>0) {
                map.actors.PC0.skillBuff({"dur":-1,"desc":"Firearms Training"
                        ,effects:[{"rangedCombat":g:fireArmsTraining}]})
          }
        if(g:spellTraining>0) {
                map.actors.PC0.skillBuff({"dur":-1,"desc":"Spellcraft Training"
                        ,effects:[{"spellcasting":g:spellTraining}]})
          }
        if(g:summonTraining>0) {
                map.actors.PC0.skillBuff({"dur":-1,"desc":"Summoning Training"
                        ,effects:[{"summoning":g:summonTraining}]})
          }
        if(g:fitnessTraining>0) {
                g:mainHealth=map.actors.PC0.currentHP;
                map.actors.PC0.statusBuff({"dur":-1,"desc":"Fitness Training"
                        ,effects:[{"body":g:fitnessTraining}]})

                map.actors.PC0.HP=g:mainHealth;
          }
  })
HealthPact
When
        Game Event HealthPact
        combat enters a new round in dimension default
IF
        ( single actor: PC0 ) has the item Greater Pact of Health
        PC0 's current HP is greater than 1
        PC0 's current HP is less than (( PC0 's current Body ) * 10 )
DO
        Heal g:HealthPact HP damage on ( single actor: PC0 ) with a floatie
        send out the Game Event HealthPact

gotcha?? the trigger does not account for cyberware or body training (see below)

Not SRUish

mjjaso

$(map).on("tai", func(){
        if((G:tai-month>4)&&(11>G:tai-month)) {
                g:tai-pflip=
          } else {
          }
  });
Clone this wiki locally