You can read and reply to posts and download all mods without registering.
We're an independent and non-profit fan-site. Find out more about us here.
+ObjProp 69 "Scripts" //StarterLauncher{ "Script 0" "NVDeleteTrap" "Script 1" "" "Script 2" "" "Script 3" "" "Don't Inherit" true}+ObjProp 69 "ObjList" = "NVDeleteTrapOn="BeginScript"; NVDeleteTrapDeleteSelf=1" //StarterLauncher+ObjProp 171 "Scripts" //A MaleRick{ "Script 0" "NVCreateAndLink" "Script 1" "NVRelayTrap" "Script 2" "NVSlayMeTrap" "Script 3" "" "Don't Inherit" true}+ObjProp 171 "ObjList" = "NVCreateAndLinkOn="BeginScript"; NVCreateAndLinkCreate="-25"; NVCreateAndLinkLinkType="~SwitchLink"; NVCreateAndLinkLoc="3.0,0.0,0.0"; NVRelayTrapOn="BeginScript"; NVRelayTrapOnDelay=500; NVRelayTrapTDest="[me]"; NVRelayTrapTOn="killself" //A MaleRick
NVScript has a NVNameOnCreation script, which would require me to create a new archetype for the Stasis Field Generator I want as a starter lest the script be applied to every other mission. And I can't create new archetypes via DML, as far as I know.
When this object is created, or at the beginning of the simulation (Sim and Create messages), the object with this script is given the name specified by the NVSymName parameter, unless an object with that name already exists.If the name is already taken, nothing will happen unless you use the NVSymNameIncrement=1 parameter; then a number will be appended to the end of the chosen name until an unused name is found, up to 99 attempts. (For example, if you created multiple objects all set to be automatically given the name "NamedObject", then the first would be named "NamedObject", the second would become "NamedObject1", the next "NamedObject2", and so on, up to "NamedObject99".)
+ObjProp 171 "ObjList" = "NVCreateAndLinkOn="BeginScript"; NVCreateAndLinkCreate="-25"; NVCreateAndLinkLinkType="~SwitchLink"; NVCreateAndLinkLoc="3.0,0.0,0.0"; NVRelayTrapOn="BeginScript"; NVRelayTrapOnDelay=500; NVRelayTrapTDest="[me]"; NVRelayTrapTOn="killself";"
+ObjProp 171 "ObjList" = "NVCreateAndLinkOn="BeginScript"; NVCreateAndLinkCount=1; NVCreateAndLinkCreate="-25"; NVCreateAndLinkLinkType="~ScriptParams"; NVCreateAndLinkLoc="3.0,0.0,0.0"; NVRelayTrapOn="BeginScript"; NVRelayTrapOnDelay=500; NVRelayTrapTDest="[me]"; NVRelayTrapTOn="killself"; NVSlayMeTrapOn="killself";"
+ObjProp 171 "Scripts"{ "Script 0" "NVCreateAndLink" "Script 1" "NVRelayTrap" "Script 2" "NVGibTrap" "Script 3" "" "Don't Inherit" true}+ObjProp 171 "ObjList" = "NVCreateAndLinkOn="BeginScript"; NVCreateAndLinkCount=1; NVCreateAndLinkCreate="-25"; NVCreateAndLinkLinkType="~ScriptParams"; NVCreateAndLinkLoc="3.0,0.0,0.0"; NVRelayTrapOn="BeginScript"; NVRelayTrapOnDelay=500; NVRelayTrapTDest="[me]"; NVRelayTrapTOn="killself"; NVGibTrapOn="killself";"
+ObjProp 69 "CfgTweqEmit" //StarterLauncher{ "Halt" Destroy Obj}+ObjProp 69 "StTweqDelete" //StarterLauncher{ "AnimS" On}
////Replace the Grenade Launcher start with a Stasis Field Generator start//Delete the existing Grenade Launcher+ObjProp 69 "CfgTweqDelete" //StarterLauncher{ "Halt" Destroy Obj "AnimC" Sim}+ObjProp 69 "StTweqDelete" //StarterLauncher{ "AnimS" On}//Now use a junk object to spawn the SFG and set its name to StarterLauncher with some scripts+ObjProp 107 "Scripts" //A Crate#1{ "Script 0" "NVCreateAndLink" "Script 1" "NVRelayTrap" "Script 2" "" "Script 3" "rsdSetNameOnLink" "Don't Inherit" true}+ObjProp 107 "ObjList" = "NVCreateAndLinkOn="BeginScript"; NVCreateAndLinkCreate="-25"; NVCreateAndLinkLinkType="ScriptParams"; NVCreateAndLinkLoc="5.0,-2.0,1.0"; NVCreateAndLinkCount=1; NVRelayTrapOn="BeginScript"; NVRelayTrapOnDelay=500; NVRelayTrapTDest="[me]"; NVRelayTrapTon="rsdSetName";" //A Crate#1+ObjProp 107 "DesignNoteSS" = "rsdSetName="StarterLauncher"; rsdSetObjLookS="stasis_field_generator"; rsdSetObjName="Stasis_Field_Generator"; rsdSetObjShort="Stasis_Field_Generator"; rsdSetSett1="Stasis_Field_Generator"; rsdSetSett2="Stasis_Field_Generator"; rsdSetSHead1="Stasis_Field_Generator"; rsdSetSHead2="Stasis_Field_Generator";" //A Crate#1
// ================================================================================// RSD: Used to set names of objects created via NVCreateAndLink, only works with ScriptParams links// Reads in the name and string references from Editor/Design Note// Otherwise tries to use the object's default values, if it has any setclass rsdSetNameOnLink extends SqRootScript { function OnrsdSetName() { local link = Link.GetOne("ScriptParams", self); if (link) { local DstObj = sLink(link).dest; local NameStr = "rsdSetName" in userparams() ? userparams().rsdSetName : Object.GetName(DstObj); local ObjLookStr = "rsdSetObjLookS" in userparams() ? userparams().rsdSetObjLookS : Property.Get(DstObj, "ObjLookS"); local ObjName = "rsdSetObjName" in userparams() ? userparams().rsdSetObjName : Property.Get(DstObj, "ObjName"); local ObjShort = "rsdSetObjShort" in userparams() ? userparams().rsdSetObjShort : Property.Get(DstObj, "ObjShort"); local Sett1 = "rsdSetSett1" in userparams() ? userparams().rsdSetSett1 : Property.Get(DstObj, "Sett1"); local Sett2 = "rsdSetSett2" in userparams() ? userparams().rsdSetSett2 : Property.Get(DstObj, "Sett2"); local SHead1 = "rsdSetSHead1" in userparams() ? userparams().rsdSetSHead1 : Property.Get(DstObj, "SHead1"); local SHead2 = "rsdSetSHead2" in userparams() ? userparams().rsdSetSHead2 : Property.Get(DstObj, "SHead2"); Object.SetName(DstObj, NameStr); Property.SetSimple(DstObj, "ObjLookS", ObjLookStr); Property.SetSimple(DstObj, "ObjName",ObjName); Property.SetSimple(DstObj, "ObjShort",ObjShort); Property.SetSimple(DstObj, "Sett1",Sett1); Property.SetSimple(DstObj, "Sett2",Sett2); Property.SetSimple(DstObj, "SHead1",SHead1); Property.SetSimple(DstObj, "SHead2",SHead2); } }}
class starterReplace extends SqRootScript { // spawn new object and destroy this one function OnSim() { local objName = Object.GetName(self); Object.SetName(self, ""); local archetype = getParam("Archetype", "Object"); local stringName = getParam("StringName", fixStringName(archetype)); local obj = Object.Create(archetype); Object.Teleport(obj, Object.Position(self), vector()); Object.SetName(obj, objName); setString(obj, "ObjName", stringName); setString(obj, "ObjLookS", stringName); setString(obj, "ObjShort", stringName); if (Object.InheritsFrom(obj, "Weapon")) { setString(obj, "Sett1", stringName); setString(obj, "Sett2", stringName); setString(obj, "SHead1", stringName); setString(obj, "SHead2", stringName); } Object.Destroy(self); } // fetch a parameter or return default value function getParam(key, defVal) { return key in userparams() ? userparams()[key] : defVal; } // set string to archetype value, otherwise archetype name function setString(obj, prop, def) { local val = Property.Get(Object.Archetype(obj), prop); Property.SetSimple(obj, prop, val ? val : def); } // replace all spaces with underscores function fixStringName(txt) { local i, c; local txt2 = ""; for (i = 0; i < txt.len(); i++) { c = txt.slice(i, i + 1); txt2 += c == " " ? "_" : c; } return txt2; }}