Category | Scripting |
Created | 24.12.2010 14:50 |
Hel Zole (Unknown) | 24.12.2010 14:54 |
---|---|
Hi! How to add TipTrigger in ls2011? It's wrong: self.trigger = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.trigger#index")); self.triggerObject = TipTrigger:new(self.trigger); table.insert(g_currentMission.tipTriggers, TipTrigger:new(self.triggerObject)); table: 12342458(table)=table: 12342458 nextDirtyFlag(number)=1 triggerId(number)=0 dirtyMask(number)=0 className(string)=TipTrigger isRegistered(boolean)=false id(number)=110 isServer(table)=table: 123424A8 |
Stefan Geiger - GIANTS Software | 27.12.2010 11:14 |
---|---|
The new function does not take an id anymore. There is a load function which uses the id. To code then should look like this: self.triggerObject = TipTrigger:new(self.isServer, self.isClient); self.triggerObject:load(self.trigger); self.triggerObject:register(true); To have the same behavior both on the client and the server (same particle systems) you also need to register the object correctly. For this you need to call register(true), which tells the game, that you make sure that the object is registered both on the server and the client manually. Furthermore, you need to make sure that the trigger exists both on the server and the client and that the code knows that these are the same objects. For this you need to add the following code (replace "YourClass" with the correct class name): function YourClass:readStream(streamId, connection) if connection:getIsServer() then -- read the id the trigger has on the server, and mark our trigger object to have this id local serverId = streamReadInt32(streamId); g_client:finishRegisterObject(self.triggerObject, serverId); end; end; function YourClass:writeStream(streamId, connection) if not connection:getIsServer() then -- send the serverId the trigger object has streamWriteInt32(streamId, self.triggerObject.id) end; end; |
Hel Zole (Unknown) | 27.12.2010 16:15 |
---|---|
Thanks, it's work! |
Note: Log in to post. Create a new account here.