1<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 2<!DOCTYPE funcs 3 SYSTEM '../../../clonk.dtd'> 4<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?> 5<funcs> 6 <func> 7 <title>ChangeDef</title> 8 <category>Objects</category> 9 <subcat>Status</subcat> 10 <version>5.1 OC</version> 11 <syntax> 12 <rtype>bool</rtype> 13 <params> 14 <param> 15 <type>id</type> 16 <name>new_def</name> 17 <desc>id of the new definition.</desc> 18 </param> 19 </params> 20 </syntax> 21 <desc>Assigns a new definition to an object.</desc> 22 <remark>ChangeDef does not affect object local variables. The values of named local variables are transferred to local variables of the same name in the target definition.</remark> 23 <remark>Warning: if an object applies ChangeDef to itself, the executed object script will no longer match the object definition after the call. Because of this, following a ChangeDef call you should neither call any local function (use <funclink>this</funclink>()->function(...) instead) nor access any local variables (even if a variable of the same name exists in the new definition).</remark> 24 <examples> 25 <example> 26 <code><funclink>GetCursor</funclink>(0)->ChangeDef(Wipf);</code> 27 <text>Changes the selected clonk of the first player into a wipf.</text> 28 </example> 29 </examples> 30 <related><funclink>GetID</funclink></related> 31 </func> 32 <author>Sven2</author><date>2001-11</date> 33</funcs> 34