| 
		
	
		| MrBehemoth   Senior Member
 
 Posts: 408
 Threads: 19
 Joined: Feb 2014
 Reputation: 
40
 | 
			| ReplaceEntity function (AMFP patch) 
 
				Patrik Wrote:void ReplaceEntity(string &in asName, string &in asBodyName, string &in asNewEntityName, string &in asNewEntityFile, bool abFullGameSave)
Removes the specified entity and places a new entity at its location.
 
 asName- the name of the entity that should be replaced.
 asBodyName- name of the body in the entity to place the new entity at. If "", the first body in the entity will be used.
 asNewEntityName- name of the entity that should be created.
 asNewEntityFile- .ent file that the new entitiy should be created from.
 abFullGameSave- if ALL properties should be saved for the created entity
 
Has anyone had any trouble with this function from the beta AMFP patch? Whatever parameters I use cause a crash. I can achieve the same effect using multiple entities, but swapping them in would be ideal.
 
Just wondering if my problem is (a) because the function isn't fully implemented/debugged or (b) something specific to my entities/script.
 
Cheers!
			 
 |  |  
	| 08-23-2014, 11:36 AM |  |  
	
		| Rapture   Posting Freak
 
 Posts: 1,078
 Threads: 79
 Joined: May 2011
 Reputation: 
30
 | 
			| RE: ReplaceEntity function (AMFP patch) 
 
				For starters, it helps if you post your Code (Just the "ReplaceEntity" so we can check if you got errors)
 
 
 Second, it does work.
 
 void Script_Temp(string &in asTimer)
 {
 ReplaceEntity("Entity_ReplaceBarrel", "", "wood_box_small01_test", "wood_box_small01.ent", true);
 }
 
 The "Entity_ReplaceBarrel" should match the entity in the LEVEL EDITOR that you want to replace.
 
 The second parameter should normally be nothing by default unless you got a specific one in mind.
 
 The third is one is the name so you can call it back in code. (That works also)
 
 The forth one is the ".ent" file you replace it with. You can browse to the folder with the object and copy the ".ent" name, or click a Entity in the Level Editor and get the name of the bottom of the property panel.
 |  |  
	| 08-23-2014, 01:43 PM |  |  
	
		| MrBehemoth   Senior Member
 
 Posts: 408
 Threads: 19
 Joined: Feb 2014
 Reputation: 
40
 | 
			| RE: ReplaceEntity function (AMFP patch) 
 
				Thanks Rapture. The issue is with my entities, which are unusual.  (08-23-2014, 01:43 PM)Rapture Wrote:  For starters, it helps if you post your Code (Just the "ReplaceEntity" so we can check if you got errors) 
Totally understand, but I didn't post it because I'm sure there's no errors there.    ReplaceEntity("CompScreen_Back", "", "CompScreen_Back", "blackaether/entities/computer/mail_0.ent", true);
 // also tried
 ReplaceEntity("CompScreen_Back", "", "CompScreen_Back", "mail_0.ent", true);
 // and
 ReplaceEntity("CompScreen_Back", "", "CompScreen_Back1", "blackaether/entities/computer/mail_0.ent", true);
 // in case the issue was the new ent having the same name, plus various other things
Anyway, I think I know what the problem is - it's to do with the entities not containing any bodies, so even having an empty string as the 2nd parameter leaves the engine not knowing where to place the new entity. My real question wasn't "why isn't this working?" but rather "does this beta function definitely work?" and you answered that! Thanks!   
 |  |  
	| 08-23-2014, 01:59 PM |  |  
	
		| Mudbill   Muderator
 
 Posts: 3,881
 Threads: 59
 Joined: Apr 2013
 Reputation: 
179
 | 
			| RE: ReplaceEntity function (AMFP patch) 
 
				Well, I set up a scene just to try the script myself, and the game crashed not knowing what the function was. It just spewed out the message of "ReplaceEntity does not match (string, string, string, string, bool)." I do have the patch installed though.
 Is this the same issue you had? If so, I'm interested in knowing how Rapture got it working. Perhaps there's something in addition to the patch that I'm missing.
 
 |  |  
	| 08-23-2014, 02:22 PM |  |  
	
		| MrBehemoth   Senior Member
 
 Posts: 408
 Threads: 19
 Joined: Feb 2014
 Reputation: 
40
 | 
			| RE: ReplaceEntity function (AMFP patch) 
 
				 (08-23-2014, 02:22 PM)Mudbill Wrote:  Is this the same issue you had? 
Nope, it just crashed to Black Box, which only gave me some memory addresses.
			 
 |  |  
	| 08-23-2014, 02:26 PM |  |  
	
		| PutraenusAlivius   Posting Freak
 
 Posts: 4,713
 Threads: 75
 Joined: Dec 2012
 Reputation: 
119
 | 
			| RE: ReplaceEntity function (AMFP patch) 
 
				 (08-23-2014, 02:22 PM)Mudbill Wrote:  Well, I set up a scene just to try the script myself, and the game crashed not knowing what the function was. It just spewed out the message of "ReplaceEntity does not match (string, string, string, string, bool)." I do have the patch installed though.
 Is this the same issue you had? If so, I'm interested in knowing how Rapture got it working. Perhaps there's something in addition to the patch that I'm missing.
 
I have the same issue with the beta functions.
			 
 "Veni, vidi, vici.""I came, I saw, I conquered."
 |  |  
	| 08-23-2014, 02:57 PM |  |  
	
		| Rapture   Posting Freak
 
 Posts: 1,078
 Threads: 79
 Joined: May 2011
 Reputation: 
30
 | 
			| RE: ReplaceEntity function (AMFP patch) 
 
				 (08-23-2014, 02:22 PM)Mudbill Wrote:  Well, I set up a scene just to try the script myself, and the game crashed not knowing what the function was. It just spewed out the message of "ReplaceEntity does not match (string, string, string, string, bool)." I do have the patch installed though.
 Is this the same issue you had? If so, I'm interested in knowing how Rapture got it working. Perhaps there's something in addition to the patch that I'm missing.
 Have you ever been able to use any of the new AMFP functions with the 11/11/13 patch?
https://www.frictionalgames.com/forum/thread-23378.html 
The only other thing I can think of is that you should be using the "AmnesiaTest131111.exe" that comes with the AMFP patch.
			 
				
(This post was last modified: 08-23-2014, 07:13 PM by Rapture.)
 |  |  
	| 08-23-2014, 07:10 PM |  |  
	
		| Mudbill   Muderator
 
 Posts: 3,881
 Threads: 59
 Joined: Apr 2013
 Reputation: 
179
 | 
			| RE: ReplaceEntity function (AMFP patch) 
 
				Oh, right, that might've just been the problem all along xP
 I got the game on Steam, so I tend to forget that launcher since the normal one doesn't work to start from the folder anyway.
 
 |  |  
	| 08-23-2014, 08:20 PM |  |  |