<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://dev.playonset.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Voltaism</id>
	<title>Onset Developer Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://dev.playonset.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Voltaism"/>
	<link rel="alternate" type="text/html" href="https://dev.playonset.com/wiki/Special:Contributions/Voltaism"/>
	<updated>2026-04-24T08:43:48Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Template:TextClientEvents&amp;diff=4950</id>
		<title>Template:TextClientEvents</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Template:TextClientEvents&amp;diff=4950"/>
		<updated>2021-10-02T13:07:46Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[OnText3DStreamIn]]&lt;br /&gt;
*[[OnText3DStreamOut]]&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=OnText3DStreamOut&amp;diff=4949</id>
		<title>OnText3DStreamOut</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=OnText3DStreamOut&amp;diff=4949"/>
		<updated>2021-10-02T13:06:33Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: Create OnText3DStreamOut&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Info|Event|Client|1.0}}&lt;br /&gt;
&lt;br /&gt;
{{FuncDescription|Called when a text 3d label is streamed out from the server.}}&lt;br /&gt;
&lt;br /&gt;
{{FuncSyntax|OnText3DStreamOut(text3d)}}&lt;br /&gt;
&lt;br /&gt;
{{FuncParameters}}&lt;br /&gt;
{{FuncParam|text3d|The text3d identifier which streamed out.}}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&#039;Lua&#039;&amp;gt;&lt;br /&gt;
AddEvent(&amp;quot;OnText3DStreamOut&amp;quot;, function (text3d)&lt;br /&gt;
    AddPlayerChat(&amp;quot;You streamed out the text 3d ID &amp;quot;..text3d..&amp;quot;.&amp;quot;)&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{RelatedFunctions}}&lt;br /&gt;
{{TextClientEvents}}&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=OnDoorStreamOut&amp;diff=4948</id>
		<title>OnDoorStreamOut</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=OnDoorStreamOut&amp;diff=4948"/>
		<updated>2021-10-02T12:57:54Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Info|Event|Client|1.0}}&lt;br /&gt;
&lt;br /&gt;
{{FuncDescription|Called when a door is streamed out from the server.}}&lt;br /&gt;
&lt;br /&gt;
{{FuncSyntax|OnDoorStreamOut(door)}}&lt;br /&gt;
&lt;br /&gt;
{{FuncParameters}}&lt;br /&gt;
{{FuncParam|door|The door identifier which streamed out.}}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&#039;Lua&#039;&amp;gt;&lt;br /&gt;
AddEvent(&amp;quot;OnDoorStreamOut&amp;quot;, function (door)&lt;br /&gt;
    AddPlayerChat(&amp;quot;You streamed out the door ID &amp;quot;..door..&amp;quot;.&amp;quot;)&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{RelatedFunctions}}&lt;br /&gt;
{{DoorClientEvents}}&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Template:DoorClientEvents&amp;diff=4947</id>
		<title>Template:DoorClientEvents</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Template:DoorClientEvents&amp;diff=4947"/>
		<updated>2021-10-02T12:57:09Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: Created page with &amp;quot;*OnDoorStreamIn *OnDoorStreamOut&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[OnDoorStreamIn]]&lt;br /&gt;
*[[OnDoorStreamOut]]&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=OnDoorStreamIn&amp;diff=4946</id>
		<title>OnDoorStreamIn</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=OnDoorStreamIn&amp;diff=4946"/>
		<updated>2021-10-02T12:55:04Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Info|Event|Client|1.0}}&lt;br /&gt;
&lt;br /&gt;
{{FuncDescription|This event is called when a player streams in the door.}}&lt;br /&gt;
&lt;br /&gt;
{{FuncSyntax|OnDoorStreamIn(door)}}&lt;br /&gt;
&lt;br /&gt;
{{FuncParameters}}&lt;br /&gt;
{{FuncParam|door|The door identifier which streamed in.}}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
AddEvent(&amp;quot;OnDoorStreamIn&amp;quot;, function (door)&lt;br /&gt;
    AddPlayerChat(&amp;quot;OH! You just streamed in a door &amp;quot;..door..&amp;quot;.&amp;quot;)&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{RelatedFunctions}}&lt;br /&gt;
{{DoorClientEvents}}&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=OnDoorStreamOut&amp;diff=4945</id>
		<title>OnDoorStreamOut</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=OnDoorStreamOut&amp;diff=4945"/>
		<updated>2021-10-02T12:54:03Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: Create OnDoorStreamOut&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Info|Event|Client|1.0}}&lt;br /&gt;
&lt;br /&gt;
{{FuncDescription|Called when a door is streamed out from the server.}}&lt;br /&gt;
&lt;br /&gt;
{{FuncSyntax|OnDoorStreamOut(door)}}&lt;br /&gt;
&lt;br /&gt;
{{FuncParameters}}&lt;br /&gt;
{{FuncParam|door|The door identifier which streamed out.}}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
===Client===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&#039;Lua&#039;&amp;gt;&lt;br /&gt;
AddEvent(&amp;quot;OnDoorStreamOut&amp;quot;, function (door)&lt;br /&gt;
    AddPlayerChat(&amp;quot;You streamed out the door ID &amp;quot;..door..&amp;quot;.&amp;quot;)&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{RelatedFunctions}}&lt;br /&gt;
{{DoorClientEvents}}&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Template:ClientEvents&amp;diff=4944</id>
		<title>Template:ClientEvents</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Template:ClientEvents&amp;diff=4944"/>
		<updated>2021-10-02T12:53:32Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Game ==&lt;br /&gt;
{{GameClientEvents}}&lt;br /&gt;
== Vehicle ==&lt;br /&gt;
{{VehicleClientEvents}}&lt;br /&gt;
== Player ==&lt;br /&gt;
{{PlayerClientEvents}}&lt;br /&gt;
== Weapon ==&lt;br /&gt;
{{WeaponClientEvents}}&lt;br /&gt;
== Parachuting ==&lt;br /&gt;
{{ParachuteClientEvents}}&lt;br /&gt;
== Key ==&lt;br /&gt;
{{KeyClientEvents}}&lt;br /&gt;
== NPC ==&lt;br /&gt;
{{NPCClientEvents}}&lt;br /&gt;
== Object ==&lt;br /&gt;
{{ObjectClientEvents}}&lt;br /&gt;
== Package ==&lt;br /&gt;
{{PackageClientEvents}}&lt;br /&gt;
== Pickup ==&lt;br /&gt;
{{PickupClientEvents}}&lt;br /&gt;
== Text ==&lt;br /&gt;
{{TextClientEvents}}&lt;br /&gt;
== Vehicle ==&lt;br /&gt;
{{VehicleClientEvents}}&lt;br /&gt;
== Web UI ==&lt;br /&gt;
{{WebClientEvents}}&lt;br /&gt;
== Sound ==&lt;br /&gt;
{{SoundClientEvents}}&lt;br /&gt;
== Door ==&lt;br /&gt;
{{DoorClientEvents}}&lt;br /&gt;
== Network ==&lt;br /&gt;
{{NetworkClientEvents}}&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=OnDoorStreamIn&amp;diff=4943</id>
		<title>OnDoorStreamIn</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=OnDoorStreamIn&amp;diff=4943"/>
		<updated>2021-10-02T12:47:46Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: Create OnDoorStreamIn&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Info|Event|Client|1.0}}&lt;br /&gt;
&lt;br /&gt;
{{FuncDescription|This event is called when a player streams in the door.}}&lt;br /&gt;
&lt;br /&gt;
{{FuncSyntax|OnDoorStreamIn(door)}}&lt;br /&gt;
&lt;br /&gt;
{{FuncParameters}}&lt;br /&gt;
{{FuncParam|door|The door identifier which streamed in.}}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
AddEvent(&amp;quot;OnDoorStreamIn&amp;quot;, function (door)&lt;br /&gt;
    AddPlayerChat(&amp;quot;OH! You just streamed in a door &amp;quot;..door..&amp;quot;.&amp;quot;)&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=ImportPackage&amp;diff=4942</id>
		<title>ImportPackage</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=ImportPackage&amp;diff=4942"/>
		<updated>2021-09-25T10:58:09Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Info|Function|Server &amp;amp; Client|1.0}}&lt;br /&gt;
&lt;br /&gt;
{{FuncDescription|Creates a table holding all exported functions by another package.&lt;br /&gt;
&lt;br /&gt;
Another package should only be imported once by this function. The returned table is valid until package unload.}}&lt;br /&gt;
&lt;br /&gt;
{{FuncSyntax|ImportPackage(PackageName)}}&lt;br /&gt;
&lt;br /&gt;
{{FuncParameters}}&lt;br /&gt;
{{FuncParam|PackageName|Name of the package to import. Must be loaded before this one.}}&lt;br /&gt;
&lt;br /&gt;
{{FuncReturnValue|Creates a table holding the other packages exported functions. Return &#039;&#039;&#039;nil&#039;&#039;&#039; if PackageName does not exist.}}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
Package &#039;&#039;Test1&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function UsefulFunc(param1, param2)&lt;br /&gt;
    return param1 + param2&lt;br /&gt;
end&lt;br /&gt;
AddFunctionExport(&amp;quot;UsefulFunc&amp;quot;, UsefulFunc)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Package &#039;&#039;Test2&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
test = ImportPackage(&amp;quot;Test1&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
print(test.UsefulFunc(2, 2))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Another package should only be imported once by this function. The returned table is valid until package unload.&lt;br /&gt;
{{RelatedFunctions}}&lt;br /&gt;
[[AddFunctionExport]]&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=ImportPackage&amp;diff=4940</id>
		<title>ImportPackage</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=ImportPackage&amp;diff=4940"/>
		<updated>2021-09-19T07:09:48Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Info|Function|Server &amp;amp; Client|1.0}}&lt;br /&gt;
&lt;br /&gt;
{{FuncDescription|Creates a table holding all exported functions by another package.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;ImportPackage&#039;&#039; can only be called once in a package serverside. The returned table is valid until package unload.}}&lt;br /&gt;
&lt;br /&gt;
{{FuncSyntax|ImportPackage(PackageName)}}&lt;br /&gt;
&lt;br /&gt;
{{FuncParameters}}&lt;br /&gt;
{{FuncParam|PackageName|Name of the package to import. Must be loaded before this one.}}&lt;br /&gt;
&lt;br /&gt;
{{FuncReturnValue|Creates a table holding the other packages exported functions. Return &#039;&#039;&#039;nil&#039;&#039;&#039; if PackageName does not exist.}}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
Package &#039;&#039;Test1&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function UsefulFunc(param1, param2)&lt;br /&gt;
    return param1 + param2&lt;br /&gt;
end&lt;br /&gt;
AddFunctionExport(&amp;quot;UsefulFunc&amp;quot;, UsefulFunc)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Package &#039;&#039;Test2&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
test = ImportPackage(&amp;quot;Test1&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
print(test.UsefulFunc(2, 2))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;ImportPackage&#039;&#039; can only be called once in a package serverside. The returned table is valid until package unload.&lt;br /&gt;
{{RelatedFunctions}}&lt;br /&gt;
[[AddFunctionExport]]&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=ImportPackage&amp;diff=4939</id>
		<title>ImportPackage</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=ImportPackage&amp;diff=4939"/>
		<updated>2021-09-19T07:07:54Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Info|Function|Server &amp;amp; Client|1.0}}&lt;br /&gt;
&lt;br /&gt;
{{FuncDescription|Creates a table holding all exported functions by another package.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;ImportPackage&#039;&#039; should only be called once in a package. The returned table is valid until package unload.}}&lt;br /&gt;
&lt;br /&gt;
{{FuncSyntax|ImportPackage(PackageName)}}&lt;br /&gt;
&lt;br /&gt;
{{FuncParameters}}&lt;br /&gt;
{{FuncParam|PackageName|Name of the package to import. Must be loaded before this one.}}&lt;br /&gt;
&lt;br /&gt;
{{FuncReturnValue|Creates a table holding the other packages exported functions. Return &#039;&#039;&#039;nil&#039;&#039;&#039; if PackageName does not exist.}}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
Package &#039;&#039;Test1&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function UsefulFunc(param1, param2)&lt;br /&gt;
    return param1 + param2&lt;br /&gt;
end&lt;br /&gt;
AddFunctionExport(&amp;quot;UsefulFunc&amp;quot;, UsefulFunc)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Package &#039;&#039;Test2&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
test = ImportPackage(&amp;quot;Test1&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
print(test.UsefulFunc(2, 2))&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&#039;&#039;ImportPackage&#039;&#039; can only be called once in a package serverside. The returned table is valid until package unload.&lt;br /&gt;
{{RelatedFunctions}}&lt;br /&gt;
[[AddFunctionExport]]&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4938</id>
		<title>Voltaism Dev Tips</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4938"/>
		<updated>2021-09-15T19:41:23Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;WIP&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Serverside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Restart self using an exported function ====&lt;br /&gt;
&#039;&#039;&#039;Package 1:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestartPackage(package_name)&lt;br /&gt;
    Delay(1, function()&lt;br /&gt;
        StopPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    Delay(1000, function()&lt;br /&gt;
	    StartPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    return true&lt;br /&gt;
end&lt;br /&gt;
AddFunctionExport(&amp;quot;RestartPackage&amp;quot;, RestartPackage)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Package 2:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local package1 = ImportPackage(&amp;quot;package1&amp;quot;)&lt;br /&gt;
package1.RestartPackage(GetPackageName())&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clientside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Disable a remote player/npc collisions properly ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local npc_actor = GetNPCActor(npc)&lt;br /&gt;
local Capsule = npc_actor:GetComponentsByClass(UCapsuleComponent.Class())[1] -- Get capsule component of the npc actor&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Pawn, ECollisionResponse.ECR_Ignore) -- Disable Capsule collision with players&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Camera, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with camera&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with bullets&lt;br /&gt;
for i, v in ipairs(npc_actor:GetComponents()) do&lt;br /&gt;
    if v:GetClassName() == &amp;quot;USkeletalMeshComponent&amp;quot; then&lt;br /&gt;
        v:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable skeletal mesh component collision with bullets&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change vehicle velocity ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local veh = GetPlayerVehicle(GetPlayerId())&lt;br /&gt;
if (veh ~= 0 and IsValidVehicle(veh) and GetVehicleDriver(veh) == GetPlayerId()) then -- The player has to be the driver or the vehicle won&#039;t be synced&lt;br /&gt;
    local vehsk = GetVehicleSkeletalMeshComponent(veh)&lt;br /&gt;
    vehsk:SetPhysicsAngularVelocityInDegrees(FVector(vax, vay, vaz), bAddToCurrent)&lt;br /&gt;
    vehsk:SetPhysicsLinearVelocity(FVector(vx, vy, vz), bAddToCurrent)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change walking animations / skeleton ====&lt;br /&gt;
You&#039;ll need unreal engine installed in order to do this, it&#039;s experimental and it breaks [[SetPlayerAnimation]].&lt;br /&gt;
First make a new plugin, create an animation blueprint then make your own state machines... and link it to the output pose.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;) -- for an npc but you can do it with a player&lt;br /&gt;
local SKMesh = SKComp:GetSkeletalMesh()&lt;br /&gt;
SKMesh:SetPostProcessAnimBlueprint(UClass.LoadFromAsset(&amp;quot;/vzombies/Zombie/Zombie_Anim_BP&amp;quot;))&lt;br /&gt;
SKComp:InitAnim(false)&lt;br /&gt;
&lt;br /&gt;
function GetZombiePostProcessInstance(npc) -- Get the post process animation instance&lt;br /&gt;
    local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;)&lt;br /&gt;
    return SKComp:GetPostProcessInstance()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local PP = GetZombiePostProcessInstance(npc)&lt;br /&gt;
PP:ProcessEvent(&amp;quot;SetAttacking&amp;quot;, true) -- You can call animation blueprint functions&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Enter a vehicle when the player press F, even while being far from the door ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
AddEvent(&amp;quot;OnKeyPress&amp;quot;, function(key)&lt;br /&gt;
    if (key == &amp;quot;F&amp;quot; and GetPlayerVehicle(GetPlayerId()) == 0) then&lt;br /&gt;
        local veh = GetStreamedVehicles()[1]&lt;br /&gt;
        if (veh and GetVehicleDriver(veh) == 0) then&lt;br /&gt;
            local plyactor = GetPlayerActor()&lt;br /&gt;
            local x, y, z = GetVehicleDoorLocation(veh, 1)&lt;br /&gt;
            plyactor:SetActorLocation(FVector(x, y, z + 50)) -- Teleport the player at the vehicle door&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Do a LineTrace from the player ====&lt;br /&gt;
This is the best way to do it for me, even if it returns an HitResult, it doesn&#039;t have the bug where it returns nothing if it collides at the start of &lt;br /&gt;
the LineTrace (And it starts from the middle of the player), i still think that adding collision with the local player to LineTraces was a bad idea.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function LineTraceFromPlayer(ToDistanceFromPlayer, complex)&lt;br /&gt;
    local x, y, z = GetPlayerLocation(GetPlayerId())&lt;br /&gt;
    local fx, fy, fz = GetCameraForwardVector()&lt;br /&gt;
    local bResult, HitResult = UKismetSystemLibrary.LineTraceSingle(GetPlayerActor(), FVector(x, y, z), FVector(x + fx * ToDistanceFromPlayer, y + fy * ToDistanceFromPlayer, z + fz * ToDistanceFromPlayer), UEngineTypes.ConvertToTraceType(ECollisionChannel.ECC_Visibility), complex, {}, EDrawDebugTrace.None, true, FLinearColor(1.0, 0.0, 0.0, 1.0), FLinearColor(0.0, 1.0, 0.0, 1.0), 10.0)&lt;br /&gt;
    return bResult, HitResult&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local bResult, HitResult = LineTraceFromPlayer(100, true)&lt;br /&gt;
if bResult then&lt;br /&gt;
     local actor = HitResult:GetActor()&lt;br /&gt;
     if actor then&lt;br /&gt;
         AddPlayerChat(actor:GetName())&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reset material slot ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local sk = GetPlayerSkeletalMeshComponent(GetPlayerId(), &amp;quot;WeaponMesh&amp;quot;)&lt;br /&gt;
if sk then&lt;br /&gt;
    sk:SetMaterial(0, UMaterialInterface.LoadFromAsset())&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Global/Other Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Call/Edit a function/variable with a string ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
_ENV[&amp;quot;function_&amp;quot; .. &amp;quot;test&amp;quot;] = function(nb)&lt;br /&gt;
   print(&amp;quot;Hi&amp;quot;, nb)&lt;br /&gt;
end&lt;br /&gt;
function_test(0)&lt;br /&gt;
_ENV[&amp;quot;function_test&amp;quot;](1)&lt;br /&gt;
&lt;br /&gt;
_ENV[&amp;quot;vartest&amp;quot;] = 1&lt;br /&gt;
print(vartest)&lt;br /&gt;
print(_ENV[&amp;quot;vartest&amp;quot;])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add rotations ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function AddRotation(r, r2)&lt;br /&gt;
    r = r + r2&lt;br /&gt;
    if r &amp;gt; 180 then&lt;br /&gt;
       r = -180 + (r - 180)&lt;br /&gt;
    elseif r &amp;lt; -180 then&lt;br /&gt;
       r = 180 + (r + 180)&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end&lt;br /&gt;
local rx, ry, rz = AddRotation(120, 70), AddRotation(-160, -40), AddRotation(60, 90)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Launch the game twice ====&lt;br /&gt;
Before starting, you need to have 2 steam accounts with Onset on the accounts. &lt;br /&gt;
First, create a folder for the steam clone, grab the steam.exe on your computer (C:\Program Files (x86)\Steam\steam.exe for me) then copy and paste this file&lt;br /&gt;
in the new folder. Now you need to install [https://github.com/sandboxie-plus/Sandboxie/releases Sandboxie] (I use the classic one), a third party program that allows you to&lt;br /&gt;
sandbox apps. Start Sandboxie, click on Sandbox --&amp;gt; Create New Sandbox, put a name for it then create it. Right click on the sandbox you created then go to&lt;br /&gt;
Sandbox Settings, go to Resource Access --&amp;gt; File Access --&amp;gt; Full Access then press &#039;&#039;&#039;Add&#039;&#039;&#039; and add the steam clone folder, save the settings. Now you can&lt;br /&gt;
right click on the sandbox then Run Sandboxed --&amp;gt; Run Any Program then start the steam.exe in the steam clone folder. Login to your alt account, install Onset and you can launch it. To close the sandbox, right click on the sandbox --&amp;gt; Terminate Programs.&lt;br /&gt;
&lt;br /&gt;
==== Explore game files ====&lt;br /&gt;
This could be useful for clothes paths.&lt;br /&gt;
You need to install [https://www.gildor.org/en/projects/umodel umodel]. Start umodel, put the path to the game files (Steam\steamapps\common\Onset) then press OK.&lt;br /&gt;
Now you can explore the game files.&lt;br /&gt;
&lt;br /&gt;
==== See materials slots of game static meshes ====&lt;br /&gt;
You&#039;ll need to [https://dev.playonset.com/wiki/Voltaism_Dev_Tips#Explore_game_files explore game files], open a static mesh then click on &amp;quot;StaticMesh&amp;quot; --&amp;gt; &amp;quot;Material IDs&amp;quot;, then the materials IDs will be showed and they will be linked to a color so you can see where they are applied on the mesh.&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=IsDoorInteractable&amp;diff=4937</id>
		<title>IsDoorInteractable</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=IsDoorInteractable&amp;diff=4937"/>
		<updated>2021-08-31T11:22:55Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Info|Function|Server &amp;amp; Client|1.5.0}}&lt;br /&gt;
&lt;br /&gt;
{{FuncDescription|Checks if the door is interactable.}}&lt;br /&gt;
&lt;br /&gt;
{{FuncSyntax|IsDoorInteractable(door)}}&lt;br /&gt;
&lt;br /&gt;
{{FuncParameters}}&lt;br /&gt;
{{FuncParam|door|The door identifier.}}&lt;br /&gt;
&lt;br /&gt;
{{FuncReturnValue|Returns &#039;&#039;&#039;true&#039;&#039;&#039; if the door is interactable, &#039;&#039;&#039;false&#039;&#039;&#039; if not.}}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{RelatedFunctions}}&lt;br /&gt;
{{Template:DoorFunctions}}&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4935</id>
		<title>Voltaism Dev Tips</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4935"/>
		<updated>2021-08-27T09:18:20Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: Undo revision 4928 by Voltaism (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;WIP&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Serverside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Restart self using an exported function ====&lt;br /&gt;
&#039;&#039;&#039;Package 1:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestartPackage(package_name)&lt;br /&gt;
    Delay(1, function()&lt;br /&gt;
        StopPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    Delay(1000, function()&lt;br /&gt;
	    StartPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    return true&lt;br /&gt;
end&lt;br /&gt;
AddFunctionExport(&amp;quot;RestartPackage&amp;quot;, RestartPackage)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Package 2:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local package1 = ImportPackage(&amp;quot;package1&amp;quot;)&lt;br /&gt;
package1.RestartPackage(GetPackageName())&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clientside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Disable a remote player/npc collisions properly ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local npc_actor = GetNPCActor(npc)&lt;br /&gt;
local Capsule = npc_actor:GetComponentsByClass(UCapsuleComponent.Class())[1] -- Get capsule component of the npc actor&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Pawn, ECollisionResponse.ECR_Ignore) -- Disable Capsule collision with players&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Camera, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with camera&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with bullets&lt;br /&gt;
for i, v in ipairs(npc_actor:GetComponents()) do&lt;br /&gt;
    if v:GetClassName() == &amp;quot;USkeletalMeshComponent&amp;quot; then&lt;br /&gt;
        v:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable skeletal mesh component collision with bullets&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change vehicle velocity ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local veh = GetPlayerVehicle(GetPlayerId())&lt;br /&gt;
if (veh ~= 0 and IsValidVehicle(veh) and GetVehicleDriver(veh) == GetPlayerId()) then -- The player has to be the driver or the vehicle won&#039;t be synced&lt;br /&gt;
    local vehsk = GetVehicleSkeletalMeshComponent(veh)&lt;br /&gt;
    vehsk:SetPhysicsAngularVelocityInDegrees(FVector(vax, vay, vaz), bAddToCurrent)&lt;br /&gt;
    vehsk:SetPhysicsLinearVelocity(FVector(vx, vy, vz), bAddToCurrent)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change walking animations / skeleton ====&lt;br /&gt;
You&#039;ll need unreal engine installed in order to do this, it&#039;s experimental and it breaks [[SetPlayerAnimation]].&lt;br /&gt;
First make a new plugin, create an animation blueprint then make your own state machines... and link it to the output pose.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;) -- for an npc but you can do it with a player&lt;br /&gt;
local SKMesh = SKComp:GetSkeletalMesh()&lt;br /&gt;
SKMesh:SetPostProcessAnimBlueprint(UClass.LoadFromAsset(&amp;quot;/vzombies/Zombie/Zombie_Anim_BP&amp;quot;))&lt;br /&gt;
SKComp:InitAnim(false)&lt;br /&gt;
&lt;br /&gt;
function GetZombiePostProcessInstance(npc) -- Get the post process animation instance&lt;br /&gt;
    local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;)&lt;br /&gt;
    return SKComp:GetPostProcessInstance()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local PP = GetZombiePostProcessInstance(npc)&lt;br /&gt;
PP:ProcessEvent(&amp;quot;SetAttacking&amp;quot;, true) -- You can call animation blueprint functions&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Enter a vehicle when the player press F, even while being far from the door ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
AddEvent(&amp;quot;OnKeyPress&amp;quot;, function(key)&lt;br /&gt;
    if (key == &amp;quot;F&amp;quot; and GetPlayerVehicle(GetPlayerId()) == 0) then&lt;br /&gt;
        local veh = GetStreamedVehicles()[1]&lt;br /&gt;
        if (veh and GetVehicleDriver(veh) == 0) then&lt;br /&gt;
            local plyactor = GetPlayerActor()&lt;br /&gt;
            local x, y, z = GetVehicleDoorLocation(veh, 1)&lt;br /&gt;
            plyactor:SetActorLocation(FVector(x, y, z + 50)) -- Teleport the player at the vehicle door&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Do a LineTrace from the player ====&lt;br /&gt;
This is the best way to do it for me, even if it returns an HitResult, it doesn&#039;t have the bug where it returns nothing if it collides at the start of &lt;br /&gt;
the LineTrace (And it starts from the middle of the player), i still think that adding collision with the local player to LineTraces was a bad idea.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function LineTraceFromPlayer(ToDistanceFromPlayer, complex)&lt;br /&gt;
    local x, y, z = GetPlayerLocation(GetPlayerId())&lt;br /&gt;
    local fx, fy, fz = GetCameraForwardVector()&lt;br /&gt;
    local bResult, HitResult = UKismetSystemLibrary.LineTraceSingle(GetPlayerActor(), FVector(x, y, z), FVector(x + fx * ToDistanceFromPlayer, y + fy * ToDistanceFromPlayer, z + fz * ToDistanceFromPlayer), UEngineTypes.ConvertToTraceType(ECollisionChannel.ECC_Visibility), complex, {}, EDrawDebugTrace.None, true, FLinearColor(1.0, 0.0, 0.0, 1.0), FLinearColor(0.0, 1.0, 0.0, 1.0), 10.0)&lt;br /&gt;
    return bResult, HitResult&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local bResult, HitResult = LineTraceFromPlayer(100, true)&lt;br /&gt;
if bResult then&lt;br /&gt;
     local actor = HitResult:GetActor()&lt;br /&gt;
     if actor then&lt;br /&gt;
         AddPlayerChat(actor:GetName())&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reset material slot ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local sk = GetPlayerSkeletalMeshComponent(GetPlayerId(), &amp;quot;WeaponMesh&amp;quot;)&lt;br /&gt;
if sk then&lt;br /&gt;
    sk:SetMaterial(0, UMaterialInterface.LoadFromAsset())&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Global/Other Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Call/Edit a function/variable with a string ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
_ENV[&amp;quot;function_&amp;quot; .. &amp;quot;test&amp;quot;] = function(nb)&lt;br /&gt;
   print(&amp;quot;Hi&amp;quot;, nb)&lt;br /&gt;
end&lt;br /&gt;
function_test(0)&lt;br /&gt;
_ENV[&amp;quot;function_test&amp;quot;](1)&lt;br /&gt;
&lt;br /&gt;
_ENV[&amp;quot;vartest&amp;quot;] = 1&lt;br /&gt;
print(vartest)&lt;br /&gt;
print(_ENV[&amp;quot;vartest&amp;quot;])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add rotations ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function AddRotation(r, r2)&lt;br /&gt;
    r = r + r2&lt;br /&gt;
    if r &amp;gt; 180 then&lt;br /&gt;
       r = -180 + (r - 180)&lt;br /&gt;
    elseif r &amp;lt; -180 then&lt;br /&gt;
       r = 180 + (r + 180)&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end&lt;br /&gt;
local rx, ry, rz = AddRotation(120, 70), AddRotation(-160, -40), AddRotation(60, 90)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Launch the game twice ====&lt;br /&gt;
Before starting, you need to have 2 steam accounts with Onset on the accounts. &lt;br /&gt;
First, create a folder for the steam clone, grab the steam.exe on your computer (C:\Program Files (x86)\Steam\steam.exe for me) then copy and paste this file&lt;br /&gt;
in the new folder. Now you need to install [https://github.com/sandboxie-plus/Sandboxie/releases Sandboxie] (I use the classic one), a third party program that allows you to&lt;br /&gt;
sandbox apps. Start Sandboxie, click on Sandbox --&amp;gt; Create New Sandbox, put a name for it then create it. Right click on the sandbox you created then go to&lt;br /&gt;
Sandbox Settings, go to Resource Access --&amp;gt; File Access --&amp;gt; Full Access then press &#039;&#039;&#039;Add&#039;&#039;&#039; and add the steam clone folder, save the settings. Now you can&lt;br /&gt;
right click on the sandbox then Run Sandboxed --&amp;gt; Run Any Program then start the steam.exe in the steam clone folder. Login to your alt account, install Onset and you can launch it. To close the sandbox, right click on the sandbox --&amp;gt; Terminate Programs.&lt;br /&gt;
&lt;br /&gt;
==== Explore game files ====&lt;br /&gt;
This could be useful for clothes paths.&lt;br /&gt;
You need to install [https://www.gildor.org/en/projects/umodel umodel]. Start umodel, put the path to the game files (Steam\steamapps\common\Onset) then press OK.&lt;br /&gt;
Now you can explore the game files.&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4928</id>
		<title>Voltaism Dev Tips</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4928"/>
		<updated>2021-07-28T09:57:07Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;WIP&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Serverside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Restart self using an exported function ====&lt;br /&gt;
&#039;&#039;&#039;Package 1:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestartPackage(package_name)&lt;br /&gt;
    Delay(1, function()&lt;br /&gt;
        StopPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    Delay(1000, function()&lt;br /&gt;
	    StartPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    return true&lt;br /&gt;
end&lt;br /&gt;
AddFunctionExport(&amp;quot;RestartPackage&amp;quot;, RestartPackage)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Package 2:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local package1 = ImportPackage(&amp;quot;package1&amp;quot;)&lt;br /&gt;
package1.RestartPackage(GetPackageName())&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clientside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Disable a remote player/npc collisions properly ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local npc_actor = GetNPCActor(npc)&lt;br /&gt;
local Capsule = npc_actor:GetComponentsByClass(UCapsuleComponent.Class())[1] -- Get capsule component of the npc actor&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Pawn, ECollisionResponse.ECR_Ignore) -- Disable Capsule collision with players&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Camera, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with camera&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with bullets&lt;br /&gt;
for i, v in ipairs(npc_actor:GetComponents()) do&lt;br /&gt;
    if v:GetClassName() == &amp;quot;USkeletalMeshComponent&amp;quot; then&lt;br /&gt;
        v:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable skeletal mesh component collision with bullets&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change vehicle velocity ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local veh = GetPlayerVehicle(GetPlayerId())&lt;br /&gt;
if (veh ~= 0 and IsValidVehicle(veh) and GetVehicleDriver(veh) == GetPlayerId()) then -- The player has to be the driver or the vehicle won&#039;t be synced&lt;br /&gt;
    local vehsk = GetVehicleSkeletalMeshComponent(veh)&lt;br /&gt;
    vehsk:SetPhysicsAngularVelocityInDegrees(FVector(vax, vay, vaz), bAddToCurrent)&lt;br /&gt;
    vehsk:SetPhysicsLinearVelocity(FVector(vx, vy, vz), bAddToCurrent)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change walking animations / skeleton ====&lt;br /&gt;
You&#039;ll need unreal engine installed in order to do this, it&#039;s experimental and it breaks [[SetPlayerAnimation]].&lt;br /&gt;
First make a new plugin, create an animation blueprint then make your own state machines... and link it to the output pose.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;) -- for an npc but you can do it with a player&lt;br /&gt;
local SKMesh = SKComp:GetSkeletalMesh()&lt;br /&gt;
SKMesh:SetPostProcessAnimBlueprint(UClass.LoadFromAsset(&amp;quot;/vzombies/Zombie/Zombie_Anim_BP&amp;quot;))&lt;br /&gt;
SKComp:InitAnim(false)&lt;br /&gt;
&lt;br /&gt;
function GetZombiePostProcessInstance(npc) -- Get the post process animation instance&lt;br /&gt;
    local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;)&lt;br /&gt;
    return SKComp:GetPostProcessInstance()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local PP = GetZombiePostProcessInstance(npc)&lt;br /&gt;
PP:ProcessEvent(&amp;quot;SetAttacking&amp;quot;, true) -- You can call animation blueprint functions&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Enter a vehicle when the player press F, even while being far from the door ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
AddEvent(&amp;quot;OnKeyPress&amp;quot;, function(key)&lt;br /&gt;
    if (key == &amp;quot;F&amp;quot; and GetPlayerVehicle(GetPlayerId()) == 0) then&lt;br /&gt;
        local veh = GetStreamedVehicles()[1]&lt;br /&gt;
        if (veh and GetVehicleDriver(veh) == 0) then&lt;br /&gt;
            local plyactor = GetPlayerActor()&lt;br /&gt;
            local x, y, z = GetVehicleDoorLocation(veh, 1)&lt;br /&gt;
            plyactor:SetActorLocation(FVector(x, y, z + 50)) -- Teleport the player at the vehicle door&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Do a LineTrace from the player ====&lt;br /&gt;
This is the best way to do it for me, even if it returns an HitResult, it doesn&#039;t have the bug where it returns nothing if it collides at the start of &lt;br /&gt;
the LineTrace (And it starts from the middle of the player), i still think that adding collision with the local player to LineTraces was a bad idea.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function LineTraceFromPlayer(ToDistanceFromPlayer, complex)&lt;br /&gt;
    local x, y, z = GetPlayerLocation(GetPlayerId())&lt;br /&gt;
    local fx, fy, fz = GetCameraForwardVector()&lt;br /&gt;
    local bResult, HitResult = UKismetSystemLibrary.LineTraceSingle(GetPlayerActor(), FVector(x, y, z), FVector(x + fx * ToDistanceFromPlayer, y + fy * ToDistanceFromPlayer, z + fz * ToDistanceFromPlayer), UEngineTypes.ConvertToTraceType(ECollisionChannel.ECC_Visibility), complex, {}, EDrawDebugTrace.None, true, FLinearColor(1.0, 0.0, 0.0, 1.0), FLinearColor(0.0, 1.0, 0.0, 1.0), 10.0)&lt;br /&gt;
    return bResult, HitResult&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local bResult, HitResult = LineTraceFromPlayer(100, true)&lt;br /&gt;
if bResult then&lt;br /&gt;
     local actor = HitResult:GetActor()&lt;br /&gt;
     if actor then&lt;br /&gt;
         AddPlayerChat(actor:GetName())&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reset material slot ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local sk = GetPlayerSkeletalMeshComponent(GetPlayerId(), &amp;quot;WeaponMesh&amp;quot;)&lt;br /&gt;
if sk then&lt;br /&gt;
    sk:SetMaterial(0, UMaterialInterface.LoadFromAsset())&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Outline on component ====&lt;br /&gt;
SOON&lt;br /&gt;
&lt;br /&gt;
== Global/Other Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Call/Edit a function/variable with a string ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
_ENV[&amp;quot;function_&amp;quot; .. &amp;quot;test&amp;quot;] = function(nb)&lt;br /&gt;
   print(&amp;quot;Hi&amp;quot;, nb)&lt;br /&gt;
end&lt;br /&gt;
function_test(0)&lt;br /&gt;
_ENV[&amp;quot;function_test&amp;quot;](1)&lt;br /&gt;
&lt;br /&gt;
_ENV[&amp;quot;vartest&amp;quot;] = 1&lt;br /&gt;
print(vartest)&lt;br /&gt;
print(_ENV[&amp;quot;vartest&amp;quot;])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add rotations ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function AddRotation(r, r2)&lt;br /&gt;
    r = r + r2&lt;br /&gt;
    if r &amp;gt; 180 then&lt;br /&gt;
       r = -180 + (r - 180)&lt;br /&gt;
    elseif r &amp;lt; -180 then&lt;br /&gt;
       r = 180 + (r + 180)&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end&lt;br /&gt;
local rx, ry, rz = AddRotation(120, 70), AddRotation(-160, -40), AddRotation(60, 90)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Launch the game twice ====&lt;br /&gt;
Before starting, you need to have 2 steam accounts with Onset on the accounts. &lt;br /&gt;
First, create a folder for the steam clone, grab the steam.exe on your computer (C:\Program Files (x86)\Steam\steam.exe for me) then copy and paste this file&lt;br /&gt;
in the new folder. Now you need to install [https://github.com/sandboxie-plus/Sandboxie/releases Sandboxie] (I use the classic one), a third party program that allows you to&lt;br /&gt;
sandbox apps. Start Sandboxie, click on Sandbox --&amp;gt; Create New Sandbox, put a name for it then create it. Right click on the sandbox you created then go to&lt;br /&gt;
Sandbox Settings, go to Resource Access --&amp;gt; File Access --&amp;gt; Full Access then press &#039;&#039;&#039;Add&#039;&#039;&#039; and add the steam clone folder, save the settings. Now you can&lt;br /&gt;
right click on the sandbox then Run Sandboxed --&amp;gt; Run Any Program then start the steam.exe in the steam clone folder. Login to your alt account, install Onset and you can launch it. To close the sandbox, right click on the sandbox --&amp;gt; Terminate Programs.&lt;br /&gt;
&lt;br /&gt;
==== Explore game files ====&lt;br /&gt;
This could be useful for clothes paths.&lt;br /&gt;
You need to install [https://www.gildor.org/en/projects/umodel umodel]. Start umodel, put the path to the game files (Steam\steamapps\common\Onset) then press OK.&lt;br /&gt;
Now you can explore the game files.&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4923</id>
		<title>Voltaism Dev Tips</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4923"/>
		<updated>2021-07-21T14:35:12Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;WIP&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Serverside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Restart self using an exported function ====&lt;br /&gt;
&#039;&#039;&#039;Package 1:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestartPackage(package_name)&lt;br /&gt;
    Delay(1, function()&lt;br /&gt;
        StopPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    Delay(1000, function()&lt;br /&gt;
	    StartPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    return true&lt;br /&gt;
end&lt;br /&gt;
AddFunctionExport(&amp;quot;RestartPackage&amp;quot;, RestartPackage)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Package 2:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local package1 = ImportPackage(&amp;quot;package1&amp;quot;)&lt;br /&gt;
package1.RestartPackage(GetPackageName())&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clientside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Disable a remote player/npc collisions properly ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local npc_actor = GetNPCActor(npc)&lt;br /&gt;
local Capsule = npc_actor:GetComponentsByClass(UCapsuleComponent.Class())[1] -- Get capsule component of the npc actor&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Pawn, ECollisionResponse.ECR_Ignore) -- Disable Capsule collision with players&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Camera, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with camera&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with bullets&lt;br /&gt;
for i, v in ipairs(npc_actor:GetComponents()) do&lt;br /&gt;
    if v:GetClassName() == &amp;quot;USkeletalMeshComponent&amp;quot; then&lt;br /&gt;
        v:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable skeletal mesh component collision with bullets&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change vehicle velocity ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local veh = GetPlayerVehicle(GetPlayerId())&lt;br /&gt;
if (veh ~= 0 and IsValidVehicle(veh) and GetVehicleDriver(veh) == GetPlayerId()) then -- The player has to be the driver or the vehicle won&#039;t be synced&lt;br /&gt;
    local vehsk = GetVehicleSkeletalMeshComponent(veh)&lt;br /&gt;
    vehsk:SetPhysicsAngularVelocityInDegrees(FVector(vax, vay, vaz), bAddToCurrent)&lt;br /&gt;
    vehsk:SetPhysicsLinearVelocity(FVector(vx, vy, vz), bAddToCurrent)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change walking animations / skeleton ====&lt;br /&gt;
You&#039;ll need unreal engine installed in order to do this, it&#039;s experimental and it breaks [[SetPlayerAnimation]].&lt;br /&gt;
First make a new plugin, create an animation blueprint then make your own state machines... and link it to the output pose.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;) -- for an npc but you can do it with a player&lt;br /&gt;
local SKMesh = SKComp:GetSkeletalMesh()&lt;br /&gt;
SKMesh:SetPostProcessAnimBlueprint(UClass.LoadFromAsset(&amp;quot;/vzombies/Zombie/Zombie_Anim_BP&amp;quot;))&lt;br /&gt;
SKComp:InitAnim(false)&lt;br /&gt;
&lt;br /&gt;
function GetZombiePostProcessInstance(npc) -- Get the post process animation instance&lt;br /&gt;
    local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;)&lt;br /&gt;
    return SKComp:GetPostProcessInstance()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local PP = GetZombiePostProcessInstance(npc)&lt;br /&gt;
PP:ProcessEvent(&amp;quot;SetAttacking&amp;quot;, true) -- You can call animation blueprint functions&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Enter a vehicle when the player press F, even while being far from the door ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
AddEvent(&amp;quot;OnKeyPress&amp;quot;, function(key)&lt;br /&gt;
    if (key == &amp;quot;F&amp;quot; and GetPlayerVehicle(GetPlayerId()) == 0) then&lt;br /&gt;
        local veh = GetStreamedVehicles()[1]&lt;br /&gt;
        if (veh and GetVehicleDriver(veh) == 0) then&lt;br /&gt;
            local plyactor = GetPlayerActor()&lt;br /&gt;
            local x, y, z = GetVehicleDoorLocation(veh, 1)&lt;br /&gt;
            plyactor:SetActorLocation(FVector(x, y, z + 50)) -- Teleport the player at the vehicle door&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Do a LineTrace from the player ====&lt;br /&gt;
This is the best way to do it for me, even if it returns an HitResult, it doesn&#039;t have the bug where it returns nothing if it collides at the start of &lt;br /&gt;
the LineTrace (And it starts from the middle of the player), i still think that adding collision with the local player to LineTraces was a bad idea.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function LineTraceFromPlayer(ToDistanceFromPlayer, complex)&lt;br /&gt;
    local x, y, z = GetPlayerLocation(GetPlayerId())&lt;br /&gt;
    local fx, fy, fz = GetCameraForwardVector()&lt;br /&gt;
    local bResult, HitResult = UKismetSystemLibrary.LineTraceSingle(GetPlayerActor(), FVector(x, y, z), FVector(x + fx * ToDistanceFromPlayer, y + fy * ToDistanceFromPlayer, z + fz * ToDistanceFromPlayer), UEngineTypes.ConvertToTraceType(ECollisionChannel.ECC_Visibility), complex, {}, EDrawDebugTrace.None, true, FLinearColor(1.0, 0.0, 0.0, 1.0), FLinearColor(0.0, 1.0, 0.0, 1.0), 10.0)&lt;br /&gt;
    return bResult, HitResult&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local bResult, HitResult = LineTraceFromPlayer(100, true)&lt;br /&gt;
if bResult then&lt;br /&gt;
     local actor = HitResult:GetActor()&lt;br /&gt;
     if actor then&lt;br /&gt;
         AddPlayerChat(actor:GetName())&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reset material slot ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local sk = GetPlayerSkeletalMeshComponent(GetPlayerId(), &amp;quot;WeaponMesh&amp;quot;)&lt;br /&gt;
if sk then&lt;br /&gt;
    sk:SetMaterial(0, UMaterialInterface.LoadFromAsset())&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Global/Other Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Call/Edit a function/variable with a string ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
_ENV[&amp;quot;function_&amp;quot; .. &amp;quot;test&amp;quot;] = function(nb)&lt;br /&gt;
   print(&amp;quot;Hi&amp;quot;, nb)&lt;br /&gt;
end&lt;br /&gt;
function_test(0)&lt;br /&gt;
_ENV[&amp;quot;function_test&amp;quot;](1)&lt;br /&gt;
&lt;br /&gt;
_ENV[&amp;quot;vartest&amp;quot;] = 1&lt;br /&gt;
print(vartest)&lt;br /&gt;
print(_ENV[&amp;quot;vartest&amp;quot;])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add rotations ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function AddRotation(r, r2)&lt;br /&gt;
    r = r + r2&lt;br /&gt;
    if r &amp;gt; 180 then&lt;br /&gt;
       r = -180 + (r - 180)&lt;br /&gt;
    elseif r &amp;lt; -180 then&lt;br /&gt;
       r = 180 + (r + 180)&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end&lt;br /&gt;
local rx, ry, rz = AddRotation(120, 70), AddRotation(-160, -40), AddRotation(60, 90)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Launch the game twice ====&lt;br /&gt;
Before starting, you need to have 2 steam accounts with Onset on the accounts. &lt;br /&gt;
First, create a folder for the steam clone, grab the steam.exe on your computer (C:\Program Files (x86)\Steam\steam.exe for me) then copy and paste this file&lt;br /&gt;
in the new folder. Now you need to install [https://github.com/sandboxie-plus/Sandboxie/releases Sandboxie] (I use the classic one), a third party program that allows you to&lt;br /&gt;
sandbox apps. Start Sandboxie, click on Sandbox --&amp;gt; Create New Sandbox, put a name for it then create it. Right click on the sandbox you created then go to&lt;br /&gt;
Sandbox Settings, go to Resource Access --&amp;gt; File Access --&amp;gt; Full Access then press &#039;&#039;&#039;Add&#039;&#039;&#039; and add the steam clone folder, save the settings. Now you can&lt;br /&gt;
right click on the sandbox then Run Sandboxed --&amp;gt; Run Any Program then start the steam.exe in the steam clone folder. Login to your alt account, install Onset and you can launch it. To close the sandbox, right click on the sandbox --&amp;gt; Terminate Programs.&lt;br /&gt;
&lt;br /&gt;
==== Explore game files ====&lt;br /&gt;
This could be useful for clothes paths.&lt;br /&gt;
You need to install [https://www.gildor.org/en/projects/umodel umodel]. Start umodel, put the path to the game files (Steam\steamapps\common\Onset) then press OK.&lt;br /&gt;
Now you can explore the game files.&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4922</id>
		<title>Voltaism Dev Tips</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4922"/>
		<updated>2021-07-21T14:27:40Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;WIP&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Serverside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Restart self using an exported function ====&lt;br /&gt;
&#039;&#039;&#039;Package 1:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestartPackage(package_name)&lt;br /&gt;
    Delay(1, function()&lt;br /&gt;
        StopPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    Delay(1000, function()&lt;br /&gt;
	    StartPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    return true&lt;br /&gt;
end&lt;br /&gt;
AddFunctionExport(&amp;quot;RestartPackage&amp;quot;, RestartPackage)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Package 2:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local package1 = ImportPackage(&amp;quot;package1&amp;quot;)&lt;br /&gt;
package1.RestartPackage(GetPackageName())&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clientside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Disable a remote player/npc collisions properly ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local npc_actor = GetNPCActor(npc)&lt;br /&gt;
local Capsule = npc_actor:GetComponentsByClass(UCapsuleComponent.Class())[1] -- Get capsule component of the npc actor&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Pawn, ECollisionResponse.ECR_Ignore) -- Disable Capsule collision with players&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Camera, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with camera&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with bullets&lt;br /&gt;
for i, v in ipairs(npc_actor:GetComponents()) do&lt;br /&gt;
    if v:GetClassName() == &amp;quot;USkeletalMeshComponent&amp;quot; then&lt;br /&gt;
        v:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable skeletal mesh component collision with bullets&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change vehicle velocity ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local veh = GetPlayerVehicle(GetPlayerId())&lt;br /&gt;
if (veh ~= 0 and IsValidVehicle(veh) and GetVehicleDriver(veh) == GetPlayerId()) then -- The player has to be the driver or the vehicle won&#039;t be synced&lt;br /&gt;
    local vehsk = GetVehicleSkeletalMeshComponent(veh)&lt;br /&gt;
    vehsk:SetPhysicsAngularVelocityInDegrees(FVector(vax, vay, vaz), bAddToCurrent)&lt;br /&gt;
    vehsk:SetPhysicsLinearVelocity(FVector(vx, vy, vz), bAddToCurrent)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change walking animations / skeleton ====&lt;br /&gt;
You&#039;ll need unreal engine installed in order to do this, it&#039;s experimental and it breaks [[SetPlayerAnimation]].&lt;br /&gt;
First make a new plugin, create an animation blueprint then make your own state machines... and link it to the output pose.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;) -- for an npc but you can do it with a player&lt;br /&gt;
local SKMesh = SKComp:GetSkeletalMesh()&lt;br /&gt;
SKMesh:SetPostProcessAnimBlueprint(UClass.LoadFromAsset(&amp;quot;/vzombies/Zombie/Zombie_Anim_BP&amp;quot;))&lt;br /&gt;
SKComp:InitAnim(false)&lt;br /&gt;
&lt;br /&gt;
function GetZombiePostProcessInstance(npc) -- Get the post process animation instance&lt;br /&gt;
    local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;)&lt;br /&gt;
    return SKComp:GetPostProcessInstance()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local PP = GetZombiePostProcessInstance(npc)&lt;br /&gt;
PP:ProcessEvent(&amp;quot;SetAttacking&amp;quot;, true) -- You can call animation blueprint functions&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Enter a vehicle when the player press F, even while being far from the door ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
AddEvent(&amp;quot;OnKeyPress&amp;quot;, function(key)&lt;br /&gt;
    if (key == &amp;quot;F&amp;quot; and GetPlayerVehicle(GetPlayerId()) == 0) then&lt;br /&gt;
        local veh = GetStreamedVehicles()[1]&lt;br /&gt;
        if (veh and GetVehicleDriver(veh) == 0) then&lt;br /&gt;
            local plyactor = GetPlayerActor()&lt;br /&gt;
            local x, y, z = GetVehicleDoorLocation(veh, 1)&lt;br /&gt;
            plyactor:SetActorLocation(FVector(x, y, z + 50)) -- Teleport the player at the vehicle door&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Do a LineTrace from the player ====&lt;br /&gt;
This is the best way to do it for me, even if it returns an HitResult, it doesn&#039;t have the bug where it returns nothing if it collides at the start of &lt;br /&gt;
the LineTrace (And it starts from the middle of the player), i still think that adding collision with the local player to LineTraces was a bad idea.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function LineTraceFromPlayer(ToDistanceFromPlayer, complex)&lt;br /&gt;
    local x, y, z = GetPlayerLocation(GetPlayerId())&lt;br /&gt;
    local fx, fy, fz = GetCameraForwardVector()&lt;br /&gt;
    local bResult, HitResult = UKismetSystemLibrary.LineTraceSingle(GetPlayerActor(), FVector(x, y, z), FVector(x + fx * ToDistanceFromPlayer, y + fy * ToDistanceFromPlayer, z + fz * ToDistanceFromPlayer), UEngineTypes.ConvertToTraceType(ECollisionChannel.ECC_Visibility), complex, {}, EDrawDebugTrace.None, true, FLinearColor(1.0, 0.0, 0.0, 1.0), FLinearColor(0.0, 1.0, 0.0, 1.0), 10.0)&lt;br /&gt;
    return bResult, HitResult&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local bResult, HitResult = LineTraceFromPlayer(100, true)&lt;br /&gt;
if bResult then&lt;br /&gt;
     local actor = HitResult:GetActor()&lt;br /&gt;
     if actor then&lt;br /&gt;
         AddPlayerChat(actor:GetName())&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Reset material slot ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local sk = GetPlayerSkeletalMeshComponent(GetPlayerId(), &amp;quot;WeaponMesh&amp;quot;)&lt;br /&gt;
if sk then&lt;br /&gt;
    sk:SetMaterial(0, UMaterialInterface.LoadFromAsset())&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Global/Other Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Call/Edit a function/variable with a string ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
_ENV[&amp;quot;function_&amp;quot; .. &amp;quot;test&amp;quot;] = function(nb)&lt;br /&gt;
   print(&amp;quot;Hi&amp;quot;, nb)&lt;br /&gt;
end&lt;br /&gt;
function_test(0)&lt;br /&gt;
_ENV[&amp;quot;function_test&amp;quot;](1)&lt;br /&gt;
&lt;br /&gt;
_ENV[&amp;quot;vartest&amp;quot;] = 1&lt;br /&gt;
print(vartest)&lt;br /&gt;
print(_ENV[&amp;quot;vartest&amp;quot;])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add rotations ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function AddRotation(r, r2)&lt;br /&gt;
    r = r + r2&lt;br /&gt;
    if r &amp;gt; 180 then&lt;br /&gt;
       r = -180 + (r - 180)&lt;br /&gt;
    elseif r &amp;lt; -180 then&lt;br /&gt;
       r = 180 + (r + 180)&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end&lt;br /&gt;
local rx, ry, rz = AddRotation(120, 70), AddRotation(-160, -40), AddRotation(60, 90)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Launch the game twice ====&lt;br /&gt;
Before starting, you need to have 2 steam accounts with Onset on the accounts. &lt;br /&gt;
First, create a folder for the steam clone, grab the steam.exe on your computer (C:\Program Files (x86)\Steam\steam.exe for me) then copy and paste this file&lt;br /&gt;
in the new folder. Now you need to install [https://github.com/sandboxie-plus/Sandboxie/releases Sandboxie] (I use the classic one), a third party program that allows you to&lt;br /&gt;
sandbox apps. Start Sandboxie, click on Sandbox --&amp;gt; Create New Sandbox, put a name for it then create it. Right click on the sandbox you created then go to&lt;br /&gt;
Sandbox Settings, go to Resource Access --&amp;gt; File Access --&amp;gt; Full Access then press &#039;&#039;&#039;Add&#039;&#039;&#039; and add the steam clone folder, save the settings. Now you can&lt;br /&gt;
right click on the sandbox then Run Sandboxed --&amp;gt; Run Any Program then start the steam.exe in the steam clone folder. Login to your alt account, install Onset and you can launch it. To close the sandbox, right click on the sandbox --&amp;gt; Terminate Programs.&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=ClientParameters&amp;diff=4906</id>
		<title>ClientParameters</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=ClientParameters&amp;diff=4906"/>
		<updated>2021-07-15T17:32:35Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: add -logfunctioncalls&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This describes the game console parameters which can be set in Steam.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: left;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Switch&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
| -dev&lt;br /&gt;
|Enables the development mode. Currently this enables file logging of Lua errors and more. File is to be found under %LocalAppData%\Onset\Saved\Logs\DevLog.txt&lt;br /&gt;
|-&lt;br /&gt;
| -cefdebug=&lt;br /&gt;
|Specifies a different CEF remote debugging port (Default port is 9222).&lt;br /&gt;
|-&lt;br /&gt;
| -ConnectAddress=&lt;br /&gt;
|Connects to a specific server by ip or hostname.&lt;br /&gt;
|-&lt;br /&gt;
| -ConnectPort=&lt;br /&gt;
|Specifies connect port.&lt;br /&gt;
|-&lt;br /&gt;
| -ConnectPassword=&lt;br /&gt;
|Specifies server password.&lt;br /&gt;
|-&lt;br /&gt;
| -dx12, -dx11 (default)&lt;br /&gt;
|Specifies DirectX RHI version.&lt;br /&gt;
|-&lt;br /&gt;
| -windowed&lt;br /&gt;
|Starts game in windowed mode.&lt;br /&gt;
|-&lt;br /&gt;
| -fullscreen&lt;br /&gt;
|Starts game in fullscreen mode.&lt;br /&gt;
|-&lt;br /&gt;
| -statunit&lt;br /&gt;
|Shows the unit graph.&lt;br /&gt;
|-&lt;br /&gt;
| -logfunctioncalls&lt;br /&gt;
|Log Lua function calls to the dev log. (requires -dev)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Client Folder Paths ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align: left;&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;6&amp;quot;|Paths&lt;br /&gt;
|-&lt;br /&gt;
|Settings save files&lt;br /&gt;
|%LocalAppData%\Onset\Saved\SaveGames&lt;br /&gt;
|-&lt;br /&gt;
|Server files (client cache)&lt;br /&gt;
|%LocalAppData%\Onset\Saved\ServerContent&lt;br /&gt;
|-&lt;br /&gt;
|Game logs (Requires dev mode)&lt;br /&gt;
|%LocalAppData%\Onset\Saved\Logs&lt;br /&gt;
|-&lt;br /&gt;
|Crash dumps&lt;br /&gt;
|%LocalAppData%\Onset\Saved\Crashes&lt;br /&gt;
|-&lt;br /&gt;
|Custom pak files&lt;br /&gt;
|%LocalAppData%\Onset\Saved\PakFiles&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4903</id>
		<title>Voltaism Dev Tips</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4903"/>
		<updated>2021-07-09T10:05:19Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;WIP&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Serverside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Restart self using an exported function ====&lt;br /&gt;
&#039;&#039;&#039;Package 1:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestartPackage(package_name)&lt;br /&gt;
    Delay(1, function()&lt;br /&gt;
        StopPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    Delay(1000, function()&lt;br /&gt;
	    StartPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    return true&lt;br /&gt;
end&lt;br /&gt;
AddFunctionExport(&amp;quot;RestartPackage&amp;quot;, RestartPackage)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Package 2:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local package1 = ImportPackage(&amp;quot;package1&amp;quot;)&lt;br /&gt;
package1.RestartPackage(GetPackageName())&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clientside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Disable a remote player/npc collisions properly ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local npc_actor = GetNPCActor(npc)&lt;br /&gt;
local Capsule = npc_actor:GetComponentsByClass(UCapsuleComponent.Class())[1] -- Get capsule component of the npc actor&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Pawn, ECollisionResponse.ECR_Ignore) -- Disable Capsule collision with players&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Camera, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with camera&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with bullets&lt;br /&gt;
for i, v in ipairs(npc_actor:GetComponents()) do&lt;br /&gt;
    if v:GetClassName() == &amp;quot;USkeletalMeshComponent&amp;quot; then&lt;br /&gt;
        v:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable skeletal mesh component collision with bullets&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change vehicle velocity ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local veh = GetPlayerVehicle(GetPlayerId())&lt;br /&gt;
if (veh ~= 0 and IsValidVehicle(veh) and GetVehicleDriver(veh) == GetPlayerId()) then -- The player has to be the driver or the vehicle won&#039;t be synced&lt;br /&gt;
    local vehsk = GetVehicleSkeletalMeshComponent(veh)&lt;br /&gt;
    vehsk:SetPhysicsAngularVelocityInDegrees(FVector(vax, vay, vaz), bAddToCurrent)&lt;br /&gt;
    vehsk:SetPhysicsLinearVelocity(FVector(vx, vy, vz), bAddToCurrent)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change walking animations / skeleton ====&lt;br /&gt;
You&#039;ll need unreal engine installed in order to do this, it&#039;s experimental and it breaks [[SetPlayerAnimation]].&lt;br /&gt;
First make a new plugin, create an animation blueprint then make your own state machines... and link it to the output pose.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;) -- for an npc but you can do it with a player&lt;br /&gt;
local SKMesh = SKComp:GetSkeletalMesh()&lt;br /&gt;
SKMesh:SetPostProcessAnimBlueprint(UClass.LoadFromAsset(&amp;quot;/vzombies/Zombie/Zombie_Anim_BP&amp;quot;))&lt;br /&gt;
SKComp:InitAnim(false)&lt;br /&gt;
&lt;br /&gt;
function GetZombiePostProcessInstance(npc) -- Get the post process animation instance&lt;br /&gt;
    local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;)&lt;br /&gt;
    return SKComp:GetPostProcessInstance()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local PP = GetZombiePostProcessInstance(npc)&lt;br /&gt;
PP:ProcessEvent(&amp;quot;SetAttacking&amp;quot;, true) -- You can call animation blueprint functions&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Enter a vehicle when the player press F, even while being far from the door ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
AddEvent(&amp;quot;OnKeyPress&amp;quot;, function(key)&lt;br /&gt;
    if (key == &amp;quot;F&amp;quot; and GetPlayerVehicle(GetPlayerId()) == 0) then&lt;br /&gt;
        local veh = GetStreamedVehicles()[1]&lt;br /&gt;
        if (veh and GetVehicleDriver(veh) == 0) then&lt;br /&gt;
            local plyactor = GetPlayerActor()&lt;br /&gt;
            local x, y, z = GetVehicleDoorLocation(veh, 1)&lt;br /&gt;
            plyactor:SetActorLocation(FVector(x, y, z + 50)) -- Teleport the player at the vehicle door&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Do a LineTrace from the player ====&lt;br /&gt;
This is the best way to do it for me, even if it returns an HitResult, it doesn&#039;t have the bug where it returns nothing if it collides at the start of &lt;br /&gt;
the LineTrace (And it starts from the middle of the player), i still think that adding collision with the local player to LineTraces was a bad idea.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function LineTraceFromPlayer(ToDistanceFromPlayer, complex)&lt;br /&gt;
    local x, y, z = GetPlayerLocation(GetPlayerId())&lt;br /&gt;
    local fx, fy, fz = GetCameraForwardVector()&lt;br /&gt;
    local bResult, HitResult = UKismetSystemLibrary.LineTraceSingle(GetPlayerActor(), FVector(x, y, z), FVector(x + fx * ToDistanceFromPlayer, y + fy * ToDistanceFromPlayer, z + fz * ToDistanceFromPlayer), UEngineTypes.ConvertToTraceType(ECollisionChannel.ECC_Visibility), complex, {}, EDrawDebugTrace.None, true, FLinearColor(1.0, 0.0, 0.0, 1.0), FLinearColor(0.0, 1.0, 0.0, 1.0), 10.0)&lt;br /&gt;
    return bResult, HitResult&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local bResult, HitResult = LineTraceFromPlayer(100, true)&lt;br /&gt;
if bResult then&lt;br /&gt;
     local actor = HitResult:GetActor()&lt;br /&gt;
     if actor then&lt;br /&gt;
         AddPlayerChat(actor:GetName())&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Global/Other Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Call/Edit a function/variable with a string ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
_ENV[&amp;quot;function_&amp;quot; .. &amp;quot;test&amp;quot;] = function(nb)&lt;br /&gt;
   print(&amp;quot;Hi&amp;quot;, nb)&lt;br /&gt;
end&lt;br /&gt;
function_test(0)&lt;br /&gt;
_ENV[&amp;quot;function_test&amp;quot;](1)&lt;br /&gt;
&lt;br /&gt;
_ENV[&amp;quot;vartest&amp;quot;] = 1&lt;br /&gt;
print(vartest)&lt;br /&gt;
print(_ENV[&amp;quot;vartest&amp;quot;])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add rotations ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function AddRotation(r, r2)&lt;br /&gt;
    r = r + r2&lt;br /&gt;
    if r &amp;gt; 180 then&lt;br /&gt;
       r = -180 + (r - 180)&lt;br /&gt;
    elseif r &amp;lt; -180 then&lt;br /&gt;
       r = 180 + (r + 180)&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end&lt;br /&gt;
local rx, ry, rz = AddRotation(120, 70), AddRotation(-160, -40), AddRotation(60, 90)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Launch the game twice ====&lt;br /&gt;
Before starting, you need to have 2 steam accounts with Onset on the accounts. &lt;br /&gt;
First, create a folder for the steam clone, grab the steam.exe on your computer (C:\Program Files (x86)\Steam\steam.exe for me) then copy and paste this file&lt;br /&gt;
in the new folder. Now you need to install [https://github.com/sandboxie-plus/Sandboxie/releases Sandboxie] (I use the classic one), a third party program that allows you to&lt;br /&gt;
sandbox apps. Start Sandboxie, click on Sandbox --&amp;gt; Create New Sandbox, put a name for it then create it. Right click on the sandbox you created then go to&lt;br /&gt;
Sandbox Settings, go to Resource Access --&amp;gt; File Access --&amp;gt; Full Access then press &#039;&#039;&#039;Add&#039;&#039;&#039; and add the steam clone folder, save the settings. Now you can&lt;br /&gt;
right click on the sandbox then Run Sandboxed --&amp;gt; Run Any Program then start the steam.exe in the steam clone folder. Login to your alt account, install Onset and you can launch it. To close the sandbox, right click on the sandbox --&amp;gt; Terminate Programs.&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4902</id>
		<title>Voltaism Dev Tips</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4902"/>
		<updated>2021-07-09T10:00:52Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;WIP&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Serverside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Restart self using an exported function ====&lt;br /&gt;
&#039;&#039;&#039;Package 1:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestartPackage(package_name)&lt;br /&gt;
    Delay(1, function()&lt;br /&gt;
        StopPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    Delay(1000, function()&lt;br /&gt;
	    StartPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    return true&lt;br /&gt;
end&lt;br /&gt;
AddFunctionExport(&amp;quot;RestartPackage&amp;quot;, RestartPackage)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Package 2:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local package1 = ImportPackage(&amp;quot;package1&amp;quot;)&lt;br /&gt;
package1.RestartPackage(GetPackageName())&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clientside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Disable a remote player/npc collisions properly ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local npc_actor = GetNPCActor(npc)&lt;br /&gt;
local Capsule = npc_actor:GetComponentsByClass(UCapsuleComponent.Class())[1] -- Get capsule component of the npc actor&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Pawn, ECollisionResponse.ECR_Ignore) -- Disable Capsule collision with players&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Camera, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with camera&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with bullets&lt;br /&gt;
for i, v in ipairs(npc_actor:GetComponents()) do&lt;br /&gt;
    if v:GetClassName() == &amp;quot;USkeletalMeshComponent&amp;quot; then&lt;br /&gt;
        v:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable skeletal mesh component collision with bullets&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change vehicle velocity ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local veh = GetPlayerVehicle(GetPlayerId())&lt;br /&gt;
if (veh ~= 0 and IsValidVehicle(veh) and GetVehicleDriver(veh) == GetPlayerId()) then -- The player has to be the driver or the vehicle won&#039;t be synced&lt;br /&gt;
    local vehsk = GetVehicleSkeletalMeshComponent(veh)&lt;br /&gt;
    vehsk:SetPhysicsAngularVelocityInDegrees(FVector(vax, vay, vaz), bAddToCurrent)&lt;br /&gt;
    vehsk:SetPhysicsLinearVelocity(FVector(vx, vy, vz), bAddToCurrent)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change walking animations / skeleton ====&lt;br /&gt;
You&#039;ll need unreal engine installed in order to do this, it&#039;s experimental and it breaks [[SetPlayerAnimation]].&lt;br /&gt;
First make a new plugin, create an animation blueprint then make your own state machines... and link it to the output pose.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;) -- for an npc but you can do it with a player&lt;br /&gt;
local SKMesh = SKComp:GetSkeletalMesh()&lt;br /&gt;
SKMesh:SetPostProcessAnimBlueprint(UClass.LoadFromAsset(&amp;quot;/vzombies/Zombie/Zombie_Anim_BP&amp;quot;))&lt;br /&gt;
SKComp:InitAnim(false)&lt;br /&gt;
&lt;br /&gt;
function GetZombiePostProcessInstance(npc) -- Get the post process animation instance&lt;br /&gt;
    local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;)&lt;br /&gt;
    return SKComp:GetPostProcessInstance()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local PP = GetZombiePostProcessInstance(npc)&lt;br /&gt;
PP:ProcessEvent(&amp;quot;SetAttacking&amp;quot;, true) -- You can call animation blueprint functions&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Enter a vehicle when the player press F, even while being far from the door ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
AddEvent(&amp;quot;OnKeyPress&amp;quot;, function(key)&lt;br /&gt;
    if (key == &amp;quot;F&amp;quot; and GetPlayerVehicle(GetPlayerId()) == 0) then&lt;br /&gt;
        local veh = GetStreamedVehicles()[1]&lt;br /&gt;
        if (veh and GetVehicleDriver(veh) == 0) then&lt;br /&gt;
            local plyactor = GetPlayerActor()&lt;br /&gt;
            local x, y, z = GetVehicleDoorLocation(veh, 1)&lt;br /&gt;
            plyactor:SetActorLocation(FVector(x, y, z + 50)) -- Teleport the player at the vehicle door&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Do a LineTrace from the player ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function LineTraceFromPlayer(ToDistanceFromPlayer, complex)&lt;br /&gt;
    local x, y, z = GetPlayerLocation(GetPlayerId())&lt;br /&gt;
    local fx, fy, fz = GetCameraForwardVector()&lt;br /&gt;
    local bResult, HitResult = UKismetSystemLibrary.LineTraceSingle(GetPlayerActor(), FVector(x, y, z), FVector(x + fx * ToDistanceFromPlayer, y + fy * ToDistanceFromPlayer, z + fz * ToDistanceFromPlayer), UEngineTypes.ConvertToTraceType(ECollisionChannel.ECC_Visibility), complex, {}, EDrawDebugTrace.None, true, FLinearColor(1.0, 0.0, 0.0, 1.0), FLinearColor(0.0, 1.0, 0.0, 1.0), 10.0)&lt;br /&gt;
    return bResult, HitResult&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local bResult, HitResult = LineTraceFromPlayer(100, true)&lt;br /&gt;
if bResult then&lt;br /&gt;
     local actor = HitResult:GetActor()&lt;br /&gt;
     if actor then&lt;br /&gt;
         AddPlayerChat(actor:GetName())&lt;br /&gt;
     end&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Global/Other Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Call/Edit a function/variable with a string ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
_ENV[&amp;quot;function_&amp;quot; .. &amp;quot;test&amp;quot;] = function(nb)&lt;br /&gt;
   print(&amp;quot;Hi&amp;quot;, nb)&lt;br /&gt;
end&lt;br /&gt;
function_test(0)&lt;br /&gt;
_ENV[&amp;quot;function_test&amp;quot;](1)&lt;br /&gt;
&lt;br /&gt;
_ENV[&amp;quot;vartest&amp;quot;] = 1&lt;br /&gt;
print(vartest)&lt;br /&gt;
print(_ENV[&amp;quot;vartest&amp;quot;])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add rotations ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function AddRotation(r, r2)&lt;br /&gt;
    r = r + r2&lt;br /&gt;
    if r &amp;gt; 180 then&lt;br /&gt;
       r = -180 + (r - 180)&lt;br /&gt;
    elseif r &amp;lt; -180 then&lt;br /&gt;
       r = 180 + (r + 180)&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end&lt;br /&gt;
local rx, ry, rz = AddRotation(120, 70), AddRotation(-160, -40), AddRotation(60, 90)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Launch the game twice ====&lt;br /&gt;
Before starting, you need to have 2 steam accounts with Onset on the accounts. &lt;br /&gt;
First, create a folder for the steam clone, grab the steam.exe on your computer (C:\Program Files (x86)\Steam\steam.exe for me) then copy and paste this file&lt;br /&gt;
in the new folder. Now you need to install [https://github.com/sandboxie-plus/Sandboxie/releases Sandboxie] (I use the classic one), a third party program that allows you to&lt;br /&gt;
sandbox apps. Start Sandboxie, click on Sandbox --&amp;gt; Create New Sandbox, put a name for it then create it. Right click on the sandbox you created then go to&lt;br /&gt;
Sandbox Settings, go to Resource Access --&amp;gt; File Access --&amp;gt; Full Access then press &#039;&#039;&#039;Add&#039;&#039;&#039; and add the steam clone folder, save the settings. Now you can&lt;br /&gt;
right click on the sandbox then Run Sandboxed --&amp;gt; Run Any Program then start the steam.exe in the steam clone folder. Login to your alt account, install Onset and you can launch it. To close the sandbox, right click on the sandbox --&amp;gt; Terminate Programs.&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=RotationToVector&amp;diff=4901</id>
		<title>RotationToVector</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=RotationToVector&amp;diff=4901"/>
		<updated>2021-07-09T08:56:13Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Info|Function|Client|1.0}}&lt;br /&gt;
&lt;br /&gt;
{{FuncDescription|Converts the given rotation into XYZ vectors.&lt;br /&gt;
&lt;br /&gt;
https://docs.unrealengine.com/en-US/API/Runtime/Engine/Kismet/UKismetMathLibrary/Conv_RotatorToVector/index.html}}&lt;br /&gt;
&lt;br /&gt;
{{FuncSyntax|RotationToVector(rx, ry, rz)}}&lt;br /&gt;
&lt;br /&gt;
{{FuncParameters}}&lt;br /&gt;
{{FuncParam|rx|The rotation at X axis.}}&lt;br /&gt;
{{FuncParam|ry|The rotation at Y axis.}}&lt;br /&gt;
{{FuncParam|rz|The rotation at Z axis.}}&lt;br /&gt;
&lt;br /&gt;
{{FuncReturnValue|Returns 3 float values, X, Y, Z}}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
__EDIT_ME__&lt;br /&gt;
&lt;br /&gt;
{{RelatedFunctions}}&lt;br /&gt;
* [[VectorToRotation]]&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=RotationToVector&amp;diff=4900</id>
		<title>RotationToVector</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=RotationToVector&amp;diff=4900"/>
		<updated>2021-07-09T08:55:35Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Info|Function|Client|1.0}}&lt;br /&gt;
&lt;br /&gt;
{{FuncDescription|Converts the given rotation into XYZ vectors.&lt;br /&gt;
&lt;br /&gt;
https://docs.unrealengine.com/en-US/API/Runtime/Engine/Kismet/UKismetMathLibrary/Conv_RotatorToVector/index.html}}&lt;br /&gt;
&lt;br /&gt;
{{FuncSyntax|RotationToVector(rx, ry, rz)}}&lt;br /&gt;
&lt;br /&gt;
{{FuncParameters}}&lt;br /&gt;
{{FuncParam|rx|The rotation at X axis.}}&lt;br /&gt;
{{FuncParam|ry|The rotation at Y axis.}}&lt;br /&gt;
{{FuncParam|rz|The rotation at Z axis.}}&lt;br /&gt;
&lt;br /&gt;
{{FuncReturnValue|Returns 3 float values, RX, RY, RZ}}&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
__EDIT_ME__&lt;br /&gt;
&lt;br /&gt;
{{RelatedFunctions}}&lt;br /&gt;
* [[VectorToRotation]]&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4899</id>
		<title>Voltaism Dev Tips</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4899"/>
		<updated>2021-07-08T18:30:57Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: Add sandboxie tip&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;WIP&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Serverside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Restart self using an exported function ====&lt;br /&gt;
&#039;&#039;&#039;Package 1:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestartPackage(package_name)&lt;br /&gt;
    Delay(1, function()&lt;br /&gt;
        StopPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    Delay(1000, function()&lt;br /&gt;
	    StartPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    return true&lt;br /&gt;
end&lt;br /&gt;
AddFunctionExport(&amp;quot;RestartPackage&amp;quot;, RestartPackage)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Package 2:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local package1 = ImportPackage(&amp;quot;package1&amp;quot;)&lt;br /&gt;
package1.RestartPackage(GetPackageName())&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clientside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Disable a remote player/npc collisions properly ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local npc_actor = GetNPCActor(npc)&lt;br /&gt;
local Capsule = npc_actor:GetComponentsByClass(UCapsuleComponent.Class())[1] -- Get capsule component of the npc actor&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Pawn, ECollisionResponse.ECR_Ignore) -- Disable Capsule collision with players&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Camera, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with camera&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with bullets&lt;br /&gt;
for i, v in ipairs(npc_actor:GetComponents()) do&lt;br /&gt;
    if v:GetClassName() == &amp;quot;USkeletalMeshComponent&amp;quot; then&lt;br /&gt;
        v:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable skeletal mesh component collision with bullets&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change vehicle velocity ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local veh = GetPlayerVehicle(GetPlayerId())&lt;br /&gt;
if (veh ~= 0 and IsValidVehicle(veh) and GetVehicleDriver(veh) == GetPlayerId()) then -- The player has to be the driver or the vehicle won&#039;t be synced&lt;br /&gt;
    local vehsk = GetVehicleSkeletalMeshComponent(veh)&lt;br /&gt;
    vehsk:SetPhysicsAngularVelocityInDegrees(FVector(vax, vay, vaz), bAddToCurrent)&lt;br /&gt;
    vehsk:SetPhysicsLinearVelocity(FVector(vx, vy, vz), bAddToCurrent)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change walking animations / skeleton ====&lt;br /&gt;
You&#039;ll need unreal engine installed in order to do this, it&#039;s experimental and it breaks [[SetPlayerAnimation]].&lt;br /&gt;
First make a new plugin, create an animation blueprint then make your own state machines... and link it to the output pose.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;) -- for an npc but you can do it with a player&lt;br /&gt;
local SKMesh = SKComp:GetSkeletalMesh()&lt;br /&gt;
SKMesh:SetPostProcessAnimBlueprint(UClass.LoadFromAsset(&amp;quot;/vzombies/Zombie/Zombie_Anim_BP&amp;quot;))&lt;br /&gt;
SKComp:InitAnim(false)&lt;br /&gt;
&lt;br /&gt;
function GetZombiePostProcessInstance(npc) -- Get the post process animation instance&lt;br /&gt;
    local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;)&lt;br /&gt;
    return SKComp:GetPostProcessInstance()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local PP = GetZombiePostProcessInstance(npc)&lt;br /&gt;
PP:ProcessEvent(&amp;quot;SetAttacking&amp;quot;, true) -- You can call animation blueprint functions&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Enter a vehicle when the player press F, even while being far from the door ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
AddEvent(&amp;quot;OnKeyPress&amp;quot;, function(key)&lt;br /&gt;
    if (key == &amp;quot;F&amp;quot; and GetPlayerVehicle(GetPlayerId()) == 0) then&lt;br /&gt;
        local veh = GetStreamedVehicles()[1]&lt;br /&gt;
        if (veh and GetVehicleDriver(veh) == 0) then&lt;br /&gt;
            local plyactor = GetPlayerActor()&lt;br /&gt;
            local x, y, z = GetVehicleDoorLocation(veh, 1)&lt;br /&gt;
            plyactor:SetActorLocation(FVector(x, y, z + 50)) -- Teleport the player at the vehicle door&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Global/Other Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Call/Edit a function/variable with a string ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
_ENV[&amp;quot;function_&amp;quot; .. &amp;quot;test&amp;quot;] = function(nb)&lt;br /&gt;
   print(&amp;quot;Hi&amp;quot;, nb)&lt;br /&gt;
end&lt;br /&gt;
function_test(0)&lt;br /&gt;
_ENV[&amp;quot;function_test&amp;quot;](1)&lt;br /&gt;
&lt;br /&gt;
_ENV[&amp;quot;vartest&amp;quot;] = 1&lt;br /&gt;
print(vartest)&lt;br /&gt;
print(_ENV[&amp;quot;vartest&amp;quot;])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add rotations ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function AddRotation(r, r2)&lt;br /&gt;
    r = r + r2&lt;br /&gt;
    if r &amp;gt; 180 then&lt;br /&gt;
       r = -180 + (r - 180)&lt;br /&gt;
    elseif r &amp;lt; -180 then&lt;br /&gt;
       r = 180 + (r + 180)&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end&lt;br /&gt;
local rx, ry, rz = AddRotation(120, 70), AddRotation(-160, -40), AddRotation(60, 90)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Launch the game twice ====&lt;br /&gt;
Before starting, you need to have 2 steam accounts with Onset on the accounts. &lt;br /&gt;
First, create a folder for the steam clone, grab the steam.exe on your computer (C:\Program Files (x86)\Steam\steam.exe for me) then copy and paste this file&lt;br /&gt;
in the new folder. Now you need to install [https://github.com/sandboxie-plus/Sandboxie/releases Sandboxie] (I use the classic one), a third party program that allows you to&lt;br /&gt;
sandbox apps. Start Sandboxie, click on Sandbox --&amp;gt; Create New Sandbox, put a name for it then create it. Right click on the sandbox you created then go to&lt;br /&gt;
Sandbox Settings, go to Resource Access --&amp;gt; File Access --&amp;gt; Full Access then press &#039;&#039;&#039;Add&#039;&#039;&#039; and add the steam clone folder, save the settings. Now you can&lt;br /&gt;
right click on the sandbox then Run Sandboxed --&amp;gt; Run Any Program then start the steam.exe in the steam clone folder. Login to your alt account, install Onset and you can launch it. To close the sandbox, right click on the sandbox --&amp;gt; Terminate Programs.&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4898</id>
		<title>Voltaism Dev Tips</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4898"/>
		<updated>2021-07-08T17:40:25Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;WIP&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Serverside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Restart self using an exported function ====&lt;br /&gt;
&#039;&#039;&#039;Package 1:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestartPackage(package_name)&lt;br /&gt;
    Delay(1, function()&lt;br /&gt;
        StopPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    Delay(1000, function()&lt;br /&gt;
	    StartPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    return true&lt;br /&gt;
end&lt;br /&gt;
AddFunctionExport(&amp;quot;RestartPackage&amp;quot;, RestartPackage)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Package 2:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local package1 = ImportPackage(&amp;quot;package1&amp;quot;)&lt;br /&gt;
package1.RestartPackage(GetPackageName())&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clientside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Disable a remote player/npc collisions properly ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local npc_actor = GetNPCActor(npc)&lt;br /&gt;
local Capsule = npc_actor:GetComponentsByClass(UCapsuleComponent.Class())[1] -- Get capsule component of the npc actor&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Pawn, ECollisionResponse.ECR_Ignore) -- Disable Capsule collision with players&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Camera, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with camera&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with bullets&lt;br /&gt;
for i, v in ipairs(npc_actor:GetComponents()) do&lt;br /&gt;
    if v:GetClassName() == &amp;quot;USkeletalMeshComponent&amp;quot; then&lt;br /&gt;
        v:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable skeletal mesh component collision with bullets&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change vehicle velocity ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local veh = GetPlayerVehicle(GetPlayerId())&lt;br /&gt;
if (veh ~= 0 and IsValidVehicle(veh) and GetVehicleDriver(veh) == GetPlayerId()) then -- The player has to be the driver or the vehicle won&#039;t be synced&lt;br /&gt;
    local vehsk = GetVehicleSkeletalMeshComponent(veh)&lt;br /&gt;
    vehsk:SetPhysicsAngularVelocityInDegrees(FVector(vax, vay, vaz), bAddToCurrent)&lt;br /&gt;
    vehsk:SetPhysicsLinearVelocity(FVector(vx, vy, vz), bAddToCurrent)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change walking animations / skeleton ====&lt;br /&gt;
You&#039;ll need unreal engine installed in order to do this, it&#039;s experimental and it breaks [[SetPlayerAnimation]].&lt;br /&gt;
First make a new plugin, create an animation blueprint then make your own state machines... and link it to the output pose.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;) -- for an npc but you can do it with a player&lt;br /&gt;
local SKMesh = SKComp:GetSkeletalMesh()&lt;br /&gt;
SKMesh:SetPostProcessAnimBlueprint(UClass.LoadFromAsset(&amp;quot;/vzombies/Zombie/Zombie_Anim_BP&amp;quot;))&lt;br /&gt;
SKComp:InitAnim(false)&lt;br /&gt;
&lt;br /&gt;
function GetZombiePostProcessInstance(npc) -- Get the post process animation instance&lt;br /&gt;
    local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;)&lt;br /&gt;
    return SKComp:GetPostProcessInstance()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local PP = GetZombiePostProcessInstance(npc)&lt;br /&gt;
PP:ProcessEvent(&amp;quot;SetAttacking&amp;quot;, true) -- You can call animation blueprint functions&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Enter a vehicle when the player press F, even while being far from the door ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
AddEvent(&amp;quot;OnKeyPress&amp;quot;, function(key)&lt;br /&gt;
    if (key == &amp;quot;F&amp;quot; and GetPlayerVehicle(GetPlayerId()) == 0) then&lt;br /&gt;
        local veh = GetStreamedVehicles()[1]&lt;br /&gt;
        if (veh and GetVehicleDriver(veh) == 0) then&lt;br /&gt;
            local plyactor = GetPlayerActor()&lt;br /&gt;
            local x, y, z = GetVehicleDoorLocation(veh, 1)&lt;br /&gt;
            plyactor:SetActorLocation(FVector(x, y, z + 50)) -- Teleport the player at the vehicle door&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Global/Other Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Call/Edit a function/variable with a string ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
_ENV[&amp;quot;function_&amp;quot; .. &amp;quot;test&amp;quot;] = function(nb)&lt;br /&gt;
   print(&amp;quot;Hi&amp;quot;, nb)&lt;br /&gt;
end&lt;br /&gt;
function_test(0)&lt;br /&gt;
_ENV[&amp;quot;function_test&amp;quot;](1)&lt;br /&gt;
&lt;br /&gt;
_ENV[&amp;quot;vartest&amp;quot;] = 1&lt;br /&gt;
print(vartest)&lt;br /&gt;
print(_ENV[&amp;quot;vartest&amp;quot;])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add rotations ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function AddRotation(r, r2)&lt;br /&gt;
    r = r + r2&lt;br /&gt;
    if r &amp;gt; 180 then&lt;br /&gt;
       r = -180 + (r - 180)&lt;br /&gt;
    elseif r &amp;lt; -180 then&lt;br /&gt;
       r = 180 + (r + 180)&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end&lt;br /&gt;
local rx, ry, rz = AddRotation(120, 70), AddRotation(-160, -40), AddRotation(60, 90)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Launch the game 2 times ====&lt;br /&gt;
?&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4897</id>
		<title>Voltaism Dev Tips</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4897"/>
		<updated>2021-07-07T14:58:30Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;WIP&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Serverside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Restart self using an exported function ====&lt;br /&gt;
&#039;&#039;&#039;Package 1:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestartPackage(package_name)&lt;br /&gt;
    Delay(1, function()&lt;br /&gt;
        StopPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    Delay(1000, function()&lt;br /&gt;
	    StartPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    return true&lt;br /&gt;
end&lt;br /&gt;
AddFunctionExport(&amp;quot;RestartPackage&amp;quot;, RestartPackage)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Package 2:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local package1 = ImportPackage(&amp;quot;package1&amp;quot;)&lt;br /&gt;
package1.RestartPackage(GetPackageName())&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clientside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Disable a remote player/npc collisions properly ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local npc_actor = GetNPCActor(npc)&lt;br /&gt;
local Capsule = npc_actor:GetComponentsByClass(UCapsuleComponent.Class())[1] -- Get capsule component of the npc actor&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Pawn, ECollisionResponse.ECR_Ignore) -- Disable Capsule collision with players&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Camera, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with camera&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with bullets&lt;br /&gt;
for i, v in ipairs(npc_actor:GetComponents()) do&lt;br /&gt;
    if v:GetClassName() == &amp;quot;USkeletalMeshComponent&amp;quot; then&lt;br /&gt;
        v:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable skeletal mesh component collision with bullets&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change vehicle velocity ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local veh = GetPlayerVehicle(GetPlayerId())&lt;br /&gt;
if (veh ~= 0 and IsValidVehicle(veh) and GetVehicleDriver(veh) == GetPlayerId()) then -- The player has to be the driver or the vehicle won&#039;t be synced&lt;br /&gt;
    local vehsk = GetVehicleSkeletalMeshComponent(veh)&lt;br /&gt;
    vehsk:SetPhysicsAngularVelocityInDegrees(FVector(vax, vay, vaz), bAddToCurrent)&lt;br /&gt;
    vehsk:SetPhysicsLinearVelocity(FVector(vx, vy, vz), bAddToCurrent)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change walking animations / skeleton ====&lt;br /&gt;
You&#039;ll need unreal engine installed in order to do this, it&#039;s experimental and it breaks [[SetPlayerAnimation]].&lt;br /&gt;
First make a new plugin, create an animation blueprint then make your own state machines... and link it to the output pose.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;) -- for an npc but you can do it with a player&lt;br /&gt;
local SKMesh = SKComp:GetSkeletalMesh()&lt;br /&gt;
SKMesh:SetPostProcessAnimBlueprint(UClass.LoadFromAsset(&amp;quot;/vzombies/Zombie/Zombie_Anim_BP&amp;quot;))&lt;br /&gt;
SKComp:InitAnim(false)&lt;br /&gt;
&lt;br /&gt;
function GetZombiePostProcessInstance(npc) -- Get the post process animation instance&lt;br /&gt;
    local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;)&lt;br /&gt;
    return SKComp:GetPostProcessInstance()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local PP = GetZombiePostProcessInstance(npc)&lt;br /&gt;
PP:ProcessEvent(&amp;quot;SetAttacking&amp;quot;, true) -- You can call animation blueprint functions&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Enter a vehicle when the player press F, even while being far from the door ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
AddEvent(&amp;quot;OnKeyPress&amp;quot;, function(key)&lt;br /&gt;
    if (key == &amp;quot;F&amp;quot; and GetPlayerVehicle(GetPlayerId()) == 0) then&lt;br /&gt;
        local veh = GetStreamedVehicles()[1]&lt;br /&gt;
        if (veh and GetVehicleDriver(veh) == 0) then&lt;br /&gt;
            local plyactor = GetPlayerActor()&lt;br /&gt;
            local x, y, z = GetVehicleDoorLocation(veh, 1)&lt;br /&gt;
            plyactor:SetActorLocation(FVector(x, y, z + 50)) -- Teleport the player at the vehicle door&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Global/Other Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Call/Edit a function/variable with a string ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
_ENV[&amp;quot;function_&amp;quot; .. &amp;quot;test&amp;quot;] = function(nb)&lt;br /&gt;
   print(&amp;quot;Hi&amp;quot;, nb)&lt;br /&gt;
end&lt;br /&gt;
function_test(0)&lt;br /&gt;
_ENV[&amp;quot;function_test&amp;quot;](1)&lt;br /&gt;
&lt;br /&gt;
_ENV[&amp;quot;vartest&amp;quot;] = 1&lt;br /&gt;
print(vartest)&lt;br /&gt;
print(_ENV[&amp;quot;vartest&amp;quot;])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add rotations ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function AddRotation(r, r2)&lt;br /&gt;
    r = r + r2&lt;br /&gt;
    if r &amp;gt; 180 then&lt;br /&gt;
       r = -180 + (r - 180)&lt;br /&gt;
    elseif r &amp;lt; -180 then&lt;br /&gt;
       r = 180 + (r + 180)&lt;br /&gt;
    end&lt;br /&gt;
    return r&lt;br /&gt;
end&lt;br /&gt;
local rx, ry, rz = AddRotation(120, 70), AddRotation(-160, -40), AddRotation(60, 90)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4896</id>
		<title>Voltaism Dev Tips</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4896"/>
		<updated>2021-07-07T10:43:14Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;WIP&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Serverside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Restart self using an exported function ====&lt;br /&gt;
&#039;&#039;&#039;Package 1:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestartPackage(package_name)&lt;br /&gt;
    Delay(1, function()&lt;br /&gt;
        StopPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    Delay(1000, function()&lt;br /&gt;
	    StartPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    return true&lt;br /&gt;
end&lt;br /&gt;
AddFunctionExport(&amp;quot;RestartPackage&amp;quot;, RestartPackage)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Package 2:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local package1 = ImportPackage(&amp;quot;package1&amp;quot;)&lt;br /&gt;
package1.RestartPackage(GetPackageName())&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clientside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Disable a remote player/npc collisions properly ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local npc_actor = GetNPCActor(npc)&lt;br /&gt;
local Capsule = npc_actor:GetComponentsByClass(UCapsuleComponent.Class())[1] -- Get capsule component of the npc actor&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Pawn, ECollisionResponse.ECR_Ignore) -- Disable Capsule collision with players&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Camera, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with camera&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with bullets&lt;br /&gt;
for i, v in ipairs(npc_actor:GetComponents()) do&lt;br /&gt;
    if v:GetClassName() == &amp;quot;USkeletalMeshComponent&amp;quot; then&lt;br /&gt;
        v:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable skeletal mesh component collision with bullets&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change vehicle velocity ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local veh = GetPlayerVehicle(GetPlayerId())&lt;br /&gt;
if (veh ~= 0 and IsValidVehicle(veh) and GetVehicleDriver(veh) == GetPlayerId()) then -- The player has to be the driver or the vehicle won&#039;t be synced&lt;br /&gt;
    local vehsk = GetVehicleSkeletalMeshComponent(veh)&lt;br /&gt;
    vehsk:SetPhysicsAngularVelocityInDegrees(FVector(vax, vay, vaz), bAddToCurrent)&lt;br /&gt;
    vehsk:SetPhysicsLinearVelocity(FVector(vx, vy, vz), bAddToCurrent)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change walking animations / skeleton ====&lt;br /&gt;
You&#039;ll need unreal engine installed in order to do this, it&#039;s experimental and it breaks [[SetPlayerAnimation]].&lt;br /&gt;
First make a new plugin, create an animation blueprint then make your own state machines... and link it to the output pose.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;) -- for an npc but you can do it with a player&lt;br /&gt;
local SKMesh = SKComp:GetSkeletalMesh()&lt;br /&gt;
SKMesh:SetPostProcessAnimBlueprint(UClass.LoadFromAsset(&amp;quot;/vzombies/Zombie/Zombie_Anim_BP&amp;quot;))&lt;br /&gt;
SKComp:InitAnim(false)&lt;br /&gt;
&lt;br /&gt;
function GetZombiePostProcessInstance(npc) -- Get the post process animation instance&lt;br /&gt;
    local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;)&lt;br /&gt;
    return SKComp:GetPostProcessInstance()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local PP = GetZombiePostProcessInstance(npc)&lt;br /&gt;
PP:ProcessEvent(&amp;quot;SetAttacking&amp;quot;, true) -- You can call animation blueprint functions&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Enter a vehicle when the player press F, even while being far from the door ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
AddEvent(&amp;quot;OnKeyPress&amp;quot;, function(key)&lt;br /&gt;
    if (key == &amp;quot;F&amp;quot; and GetPlayerVehicle(GetPlayerId()) == 0) then&lt;br /&gt;
        local veh = GetStreamedVehicles()[1]&lt;br /&gt;
        if (veh and GetVehicleDriver(veh) == 0) then&lt;br /&gt;
            local plyactor = GetPlayerActor()&lt;br /&gt;
            local x, y, z = GetVehicleDoorLocation(veh, 1)&lt;br /&gt;
            plyactor:SetActorLocation(FVector(x, y, z + 50)) -- Teleport the player at the vehicle door&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Global/Other Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Call/Edit a function/variable with a string ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
_ENV[&amp;quot;function_&amp;quot; .. &amp;quot;test&amp;quot;] = function(nb)&lt;br /&gt;
   print(&amp;quot;Hi&amp;quot;, nb)&lt;br /&gt;
end&lt;br /&gt;
function_test(0)&lt;br /&gt;
_ENV[&amp;quot;function_test&amp;quot;](1)&lt;br /&gt;
&lt;br /&gt;
_ENV[&amp;quot;vartest&amp;quot;] = 1&lt;br /&gt;
print(vartest)&lt;br /&gt;
print(_ENV[&amp;quot;vartest&amp;quot;])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4895</id>
		<title>Voltaism Dev Tips</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4895"/>
		<updated>2021-07-06T22:03:09Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;WIP&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Serverside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Restart self using an exported function ====&lt;br /&gt;
&#039;&#039;&#039;Package 1:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestartPackage(package_name)&lt;br /&gt;
    Delay(1, function()&lt;br /&gt;
        StopPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    Delay(1000, function()&lt;br /&gt;
	    StartPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    return true&lt;br /&gt;
end&lt;br /&gt;
AddFunctionExport(&amp;quot;RestartPackage&amp;quot;, RestartPackage)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Package 2:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local package1 = ImportPackage(&amp;quot;package1&amp;quot;)&lt;br /&gt;
package1.RestartPackage(GetPackageName())&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clientside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Disable a remote player/npc collisions properly ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local npc_actor = GetNPCActor(npc)&lt;br /&gt;
local Capsule = npc_actor:GetComponentsByClass(UCapsuleComponent.Class())[1] -- Get capsule component of the npc actor&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Pawn, ECollisionResponse.ECR_Ignore) -- Disable Capsule collision with players&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Camera, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with camera&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with bullets&lt;br /&gt;
for i, v in ipairs(npc_actor:GetComponents()) do&lt;br /&gt;
    if v:GetClassName() == &amp;quot;USkeletalMeshComponent&amp;quot; then&lt;br /&gt;
        v:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable skeletal mesh component collision with bullets&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change vehicle velocity ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local veh = GetPlayerVehicle(GetPlayerId())&lt;br /&gt;
if (veh ~= 0 and IsValidVehicle(veh) and GetVehicleDriver(veh) == GetPlayerId()) then -- The player has to be the driver or the vehicle won&#039;t be synced&lt;br /&gt;
    local vehsk = GetVehicleSkeletalMeshComponent(veh)&lt;br /&gt;
    vehsk:SetPhysicsAngularVelocityInDegrees(FVector(vax, vay, vaz), bAddToCurrent)&lt;br /&gt;
    vehsk:SetPhysicsLinearVelocity(FVector(vx, vy, vz), bAddToCurrent)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change walking animations / skeleton ====&lt;br /&gt;
You&#039;ll need unreal engine installed in order to do this, it&#039;s experimental and it breaks [[SetPlayerAnimation]].&lt;br /&gt;
First make a new plugin, create an animation blueprint then make your own state machines... and link it to the output pose.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;) -- for an npc but you can do it with a player&lt;br /&gt;
local SKMesh = SKComp:GetSkeletalMesh()&lt;br /&gt;
SKMesh:SetPostProcessAnimBlueprint(UClass.LoadFromAsset(&amp;quot;/vzombies/Zombie/Zombie_Anim_BP&amp;quot;))&lt;br /&gt;
SKComp:InitAnim(false)&lt;br /&gt;
&lt;br /&gt;
function GetZombiePostProcessInstance(npc) -- Get the post process animation instance&lt;br /&gt;
    local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;)&lt;br /&gt;
    return SKComp:GetPostProcessInstance()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local PP = GetZombiePostProcessInstance(npc)&lt;br /&gt;
PP:ProcessEvent(&amp;quot;SetAttacking&amp;quot;, true) -- You can call animation blueprint functions&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Enter a vehicle when the player press F, even while being far from the door ====&lt;br /&gt;
SOON&lt;br /&gt;
&lt;br /&gt;
== Global/Other Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Call/Edit a function/variable with a string ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
_ENV[&amp;quot;function_&amp;quot; .. &amp;quot;test&amp;quot;] = function(nb)&lt;br /&gt;
   print(&amp;quot;Hi&amp;quot;, nb)&lt;br /&gt;
end&lt;br /&gt;
function_test(0)&lt;br /&gt;
_ENV[&amp;quot;function_test&amp;quot;](1)&lt;br /&gt;
&lt;br /&gt;
_ENV[&amp;quot;vartest&amp;quot;] = 1&lt;br /&gt;
print(vartest)&lt;br /&gt;
print(_ENV[&amp;quot;vartest&amp;quot;])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4894</id>
		<title>Voltaism Dev Tips</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4894"/>
		<updated>2021-07-06T21:21:47Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;WIP&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Serverside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Restart self using an exported function ====&lt;br /&gt;
&#039;&#039;&#039;Package 1:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestartPackage(package_name)&lt;br /&gt;
    Delay(1, function()&lt;br /&gt;
        StopPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    Delay(1000, function()&lt;br /&gt;
	    StartPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    return true&lt;br /&gt;
end&lt;br /&gt;
AddFunctionExport(&amp;quot;RestartPackage&amp;quot;, RestartPackage)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Package 2:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local package1 = ImportPackage(&amp;quot;package1&amp;quot;)&lt;br /&gt;
package1.RestartPackage(GetPackageName())&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clientside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Disable a remote player/npc collisions properly ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local npc_actor = GetNPCActor(npc)&lt;br /&gt;
local Capsule = npc_actor:GetComponentsByClass(UCapsuleComponent.Class())[1] -- Get capsule component of the npc actor&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Pawn, ECollisionResponse.ECR_Ignore) -- Disable Capsule collision with players&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Camera, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with camera&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with bullets&lt;br /&gt;
for i, v in ipairs(npc_actor:GetComponents()) do&lt;br /&gt;
    if v:GetClassName() == &amp;quot;USkeletalMeshComponent&amp;quot; then&lt;br /&gt;
        v:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable skeletal mesh component collision with bullets&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change vehicle velocity ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local veh = GetPlayerVehicle(GetPlayerId())&lt;br /&gt;
if (veh ~= 0 and IsValidVehicle(veh) and GetVehicleDriver(veh) == GetPlayerId()) then -- The player has to be the driver or the vehicle won&#039;t be synced&lt;br /&gt;
    local vehsk = GetVehicleSkeletalMeshComponent(veh)&lt;br /&gt;
    vehsk:SetPhysicsAngularVelocityInDegrees(FVector(vax, vay, vaz), bAddToCurrent)&lt;br /&gt;
    vehsk:SetPhysicsLinearVelocity(FVector(vx, vy, vz), bAddToCurrent)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change walking animations / skeleton ====&lt;br /&gt;
You&#039;ll need unreal engine installed in order to do this, it&#039;s experimental and it breaks [[SetPlayerAnimation]].&lt;br /&gt;
First make a new plugin, create an animation blueprint then make your own state machines... and link it to the output pose.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;) -- for an npc but you can do it with a player&lt;br /&gt;
local SKMesh = SKComp:GetSkeletalMesh()&lt;br /&gt;
SKMesh:SetPostProcessAnimBlueprint(UClass.LoadFromAsset(&amp;quot;/vzombies/Zombie/Zombie_Anim_BP&amp;quot;))&lt;br /&gt;
SKComp:InitAnim(false)&lt;br /&gt;
&lt;br /&gt;
function GetZombiePostProcessInstance(npc) -- Get the post process animation instance&lt;br /&gt;
    local SKComp = GetNPCSkeletalMeshComponent(npc, &amp;quot;Body&amp;quot;)&lt;br /&gt;
    return SKComp:GetPostProcessInstance()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local PP = GetZombiePostProcessInstance(npc)&lt;br /&gt;
PP:ProcessEvent(&amp;quot;SetAttacking&amp;quot;, true) -- You can call animation blueprint functions&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Global/Other Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Call/Edit a function/variable with a string ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
_ENV[&amp;quot;function_&amp;quot; .. &amp;quot;test&amp;quot;] = function(nb)&lt;br /&gt;
   print(&amp;quot;Hi&amp;quot;, nb)&lt;br /&gt;
end&lt;br /&gt;
function_test(0)&lt;br /&gt;
_ENV[&amp;quot;function_test&amp;quot;](1)&lt;br /&gt;
&lt;br /&gt;
_ENV[&amp;quot;vartest&amp;quot;] = 1&lt;br /&gt;
print(vartest)&lt;br /&gt;
print(_ENV[&amp;quot;vartest&amp;quot;])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4893</id>
		<title>Voltaism Dev Tips</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4893"/>
		<updated>2021-07-06T20:57:09Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: add client tip&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;WIP&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Serverside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Restart self using an exported function ====&lt;br /&gt;
&#039;&#039;&#039;Package 1:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestartPackage(package_name)&lt;br /&gt;
    Delay(1, function()&lt;br /&gt;
        StopPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    Delay(1000, function()&lt;br /&gt;
	    StartPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    return true&lt;br /&gt;
end&lt;br /&gt;
AddFunctionExport(&amp;quot;RestartPackage&amp;quot;, RestartPackage)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Package 2:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local package1 = ImportPackage(&amp;quot;package1&amp;quot;)&lt;br /&gt;
package1.RestartPackage(GetPackageName())&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clientside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Disable a remote player/npc collisions properly ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local npc_actor = GetNPCActor(npc)&lt;br /&gt;
local Capsule = npc_actor:GetComponentsByClass(UCapsuleComponent.Class())[1] -- Get capsule component of the npc actor&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Pawn, ECollisionResponse.ECR_Ignore) -- Disable Capsule collision with players&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Camera, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with camera&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with bullets&lt;br /&gt;
for i, v in ipairs(npc_actor:GetComponents()) do&lt;br /&gt;
    if v:GetClassName() == &amp;quot;USkeletalMeshComponent&amp;quot; then&lt;br /&gt;
        v:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable skeletal mesh component collision with bullets&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Change vehicle velocity ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local veh = GetPlayerVehicle(GetPlayerId())&lt;br /&gt;
if (veh ~= 0 and IsValidVehicle(veh) and GetVehicleDriver(veh) == GetPlayerId()) then -- The player has to be the driver or the vehicle won&#039;t be synced&lt;br /&gt;
    local vehsk = GetVehicleSkeletalMeshComponent(veh)&lt;br /&gt;
    vehsk:SetPhysicsAngularVelocityInDegrees(FVector(vax, vay, vaz), bAddToCurrent)&lt;br /&gt;
    vehsk:SetPhysicsLinearVelocity(FVector(vx, vy, vz), bAddToCurrent)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Global/Other Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Call/Edit a function/variable with a string ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
_ENV[&amp;quot;function_&amp;quot; .. &amp;quot;test&amp;quot;] = function(nb)&lt;br /&gt;
   print(&amp;quot;Hi&amp;quot;, nb)&lt;br /&gt;
end&lt;br /&gt;
function_test(0)&lt;br /&gt;
_ENV[&amp;quot;function_test&amp;quot;](1)&lt;br /&gt;
&lt;br /&gt;
_ENV[&amp;quot;vartest&amp;quot;] = 1&lt;br /&gt;
print(vartest)&lt;br /&gt;
print(_ENV[&amp;quot;vartest&amp;quot;])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4892</id>
		<title>Voltaism Dev Tips</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4892"/>
		<updated>2021-07-06T19:36:43Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: add client tip&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;WIP&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Serverside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Restart self using an exported function ====&lt;br /&gt;
&#039;&#039;&#039;Package 1:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestartPackage(package_name)&lt;br /&gt;
    Delay(1, function()&lt;br /&gt;
        StopPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    Delay(1000, function()&lt;br /&gt;
	    StartPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    return true&lt;br /&gt;
end&lt;br /&gt;
AddFunctionExport(&amp;quot;RestartPackage&amp;quot;, RestartPackage)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Package 2:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local package1 = ImportPackage(&amp;quot;package1&amp;quot;)&lt;br /&gt;
package1.RestartPackage(GetPackageName())&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clientside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Disable a remote player/npc collisions properly ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local npc_actor = GetNPCActor(npc)&lt;br /&gt;
local Capsule = npc_actor:GetComponentsByClass(UCapsuleComponent.Class())[1] -- Get capsule component of the npc actor&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Pawn, ECollisionResponse.ECR_Ignore) -- Disable Capsule collision with players&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_Camera, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with camera&lt;br /&gt;
Capsule:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable capsule collision with bullets&lt;br /&gt;
for i, v in ipairs(npc_actor:GetComponents()) do&lt;br /&gt;
    if v:GetClassName() == &amp;quot;USkeletalMeshComponent&amp;quot; then&lt;br /&gt;
        v:SetCollisionResponseToChannel(ECollisionChannel.ECC_GameTraceChannel1, ECollisionResponse.ECR_Ignore) -- Disable skeletal mesh component collision with bullets&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Global/Other Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Call/Edit a function/variable with a string ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
_ENV[&amp;quot;function_&amp;quot; .. &amp;quot;test&amp;quot;] = function(nb)&lt;br /&gt;
   print(&amp;quot;Hi&amp;quot;, nb)&lt;br /&gt;
end&lt;br /&gt;
function_test(0)&lt;br /&gt;
_ENV[&amp;quot;function_test&amp;quot;](1)&lt;br /&gt;
&lt;br /&gt;
_ENV[&amp;quot;vartest&amp;quot;] = 1&lt;br /&gt;
print(vartest)&lt;br /&gt;
print(_ENV[&amp;quot;vartest&amp;quot;])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4891</id>
		<title>Voltaism Dev Tips</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4891"/>
		<updated>2021-07-06T19:04:58Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;WIP&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Serverside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Restart self using an exported function ====&lt;br /&gt;
&#039;&#039;&#039;Package 1:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestartPackage(package_name)&lt;br /&gt;
    Delay(1, function()&lt;br /&gt;
        StopPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    Delay(1000, function()&lt;br /&gt;
	    StartPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    return true&lt;br /&gt;
end&lt;br /&gt;
AddFunctionExport(&amp;quot;RestartPackage&amp;quot;, RestartPackage)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Package 2:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local package1 = ImportPackage(&amp;quot;package1&amp;quot;)&lt;br /&gt;
package1.RestartPackage(GetPackageName())&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clientside Tips ==&lt;br /&gt;
&lt;br /&gt;
== Global/Other Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Call/Edit a function/variable with a string ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
_ENV[&amp;quot;function_&amp;quot; .. &amp;quot;test&amp;quot;] = function(nb)&lt;br /&gt;
   print(&amp;quot;Hi&amp;quot;, nb)&lt;br /&gt;
end&lt;br /&gt;
function_test(0)&lt;br /&gt;
_ENV[&amp;quot;function_test&amp;quot;](1)&lt;br /&gt;
&lt;br /&gt;
_ENV[&amp;quot;vartest&amp;quot;] = 1&lt;br /&gt;
print(vartest)&lt;br /&gt;
print(_ENV[&amp;quot;vartest&amp;quot;])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4890</id>
		<title>Voltaism Dev Tips</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4890"/>
		<updated>2021-07-06T19:00:33Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: add tip&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;WIP&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Serverside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== SV1) Restart self using an exported function ====&lt;br /&gt;
&#039;&#039;&#039;Package 1:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestartPackage(package_name)&lt;br /&gt;
    Delay(1, function()&lt;br /&gt;
        StopPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    Delay(1000, function()&lt;br /&gt;
	    StartPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    return true&lt;br /&gt;
end&lt;br /&gt;
AddFunctionExport(&amp;quot;RestartPackage&amp;quot;, RestartPackage)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Package 2:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local package1 = ImportPackage(&amp;quot;package1&amp;quot;)&lt;br /&gt;
package1.RestartPackage(GetPackageName())&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clientside Tips ==&lt;br /&gt;
&lt;br /&gt;
== Global/Other Tips ==&lt;br /&gt;
&lt;br /&gt;
==== G1) Call/Edit a function/variable with a string ====&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
_ENV[&amp;quot;function_&amp;quot; .. &amp;quot;test&amp;quot;] = function(nb)&lt;br /&gt;
   print(&amp;quot;Hi&amp;quot;, nb)&lt;br /&gt;
end&lt;br /&gt;
function_test(0)&lt;br /&gt;
_ENV[&amp;quot;function_test&amp;quot;](1)&lt;br /&gt;
&lt;br /&gt;
_ENV[&amp;quot;vartest&amp;quot;] = 1&lt;br /&gt;
print(vartest)&lt;br /&gt;
print(_ENV[&amp;quot;vartest&amp;quot;])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4889</id>
		<title>Voltaism Dev Tips</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4889"/>
		<updated>2021-07-06T18:27:07Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: added first server tip&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;WIP&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Serverside Tips ==&lt;br /&gt;
&lt;br /&gt;
==== Restart self using an exported function ====&lt;br /&gt;
&#039;&#039;&#039;Package 1:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestartPackage(package_name)&lt;br /&gt;
    Delay(1, function()&lt;br /&gt;
        StopPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    Delay(1000, function()&lt;br /&gt;
	    StartPackage(package_name)&lt;br /&gt;
    end)&lt;br /&gt;
    return true&lt;br /&gt;
end&lt;br /&gt;
AddFunctionExport(&amp;quot;RestartPackage&amp;quot;, RestartPackage)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Package 2:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;Lua&amp;quot;&amp;gt;&lt;br /&gt;
local package1 = ImportPackage(&amp;quot;package1&amp;quot;)&lt;br /&gt;
package1.RestartPackage(GetPackageName())&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Clientside Tips ==&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4888</id>
		<title>Voltaism Dev Tips</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4888"/>
		<updated>2021-07-06T18:18:17Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;WIP&lt;br /&gt;
&lt;br /&gt;
== Serverside Tips ==&lt;br /&gt;
&lt;br /&gt;
== Clientside Tips ==&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
	<entry>
		<id>https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4887</id>
		<title>Voltaism Dev Tips</title>
		<link rel="alternate" type="text/html" href="https://dev.playonset.com/index.php?title=Voltaism_Dev_Tips&amp;diff=4887"/>
		<updated>2021-07-06T18:05:46Z</updated>

		<summary type="html">&lt;p&gt;Voltaism: Created page with &amp;quot;WIP&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;WIP&lt;/div&gt;</summary>
		<author><name>Voltaism</name></author>
	</entry>
</feed>