Jump to content
Hoppah

[RELEASED] Search house script

Recommended Posts

Hoppah presents the SearcHouse script

Difficulty: Easy*

*although scripting knowledge is required when you want to edit the random outcomes in the script.

The modding concepts thread brought up the idea of searching non-open buildings and have a random outcome such as an injured civilian or an injured fire fighter. I liked the idea (for the US Army Modification) and started working on it and I'd like to share the result.

What does the script do?

It's a very simple script actually. I've incorporated the entire functionality in the EnterHouse script and there's no need to add new commands to your units Your units can only enter buildings where a child with the name "SearchHouse is present (see instructions). Just like the original EnterHouse.script you only have to click a (non-open-house type) building and your unit will approach the door and disappear for 30 seconds (time can be changed in the script). A fence will spawn in front of the building to remind you the building is being searched. After 30 seconds your unit will appear again, the fence will be deleted and a random outcome will be generated. The provided script has the following random outcomes (SearchHouse_v2: only for buildings on fire or burned down):

  • 30% chance that nothing has been found
  • 20% chance that a resident has been found and evacuated (will spawn a single civilian near the door)
  • 20% chance that your unit will get minor injuries (he will lose 90% of his health when the building is burning, otherwise 45% of his health)
  • 10% chance that your unit will get severly injured (he will be laying on the floor in front of the building)
  • 20% chance a victim has been found, the unit will spawn while carrying a victim.

Each outcome will be described by a short message ingame.

How to install:

1. Download the attached package. Unrar and copy EnterHouse.script to your "[MOD]\Scripts\Game\Command\" folder.

2. Only buildings with a child carrying the name "SearchHouse" can be entered. Check out the instructions in the provided screenshot below to find out how to add childs to buildings.

3. Make sure the child is enabled on the buildings on your map. Test EACH building ingame at least once.

post-4-0-42747000-1367156372_thumb.jpg

This screenshot is also present in the provided package.

Known bugs/problems:

I haven't found any bugs, but for unknown reasons the game might crash without error when the unit is about to enter the building. That error is related to the prototype file of the building (I had it happen with deserthouse01.e4p and deserthouse01b_2.e4p). Solution: Recreate the entire prototype file of the building. Other than that, units might get stuck when they appear again, but this is unlikely to happen. A solution for that would've been the code: 'Game::FindFreePosition', but for some reason that code also crashes the game, so the code has been left out.

Script usage:

Everyone is allowed to use AND edit the script for personal use or a public mod at your own risk.

Versions:

SearchHouse.rar: Orginal version which has been tested.

SearchHouse_v2.rar: Added disctinction between buildings on fire and normal buildings. Only buildings on fire or burned down might injure a unit or generate a victim, normal buildings won't. NOT TESTED BY ME

Feedback on this script will be appreciated!

Hoppah

SearchHouse.rar

SearchHouse_v2.rar

Edited by Hoppah
Spelling mistakes, sorry for my English
Link to comment
Share on other sites

Awesome work Hops, here's some feedback:

I had no crashing issues, it was also straight forward to set up.

However things I'd recommend -

1. Only being able to enter one person at a time kinda sucks, but if it is the only way I'll make do

2. FFs can enter buildings not on fire, which means they can get injured from entering normal buildings, but again if its no other way round it then it'll do. But if it's possible to set the target as must be on fire it'd be far more effective, excellent work!

x

Link to comment
Share on other sites

You can enter buildings with more FFs, select a group of them and click the building. Once a FF has entered the building you can't send more indeed. I did that on purpose because that might've made the script buggy. I'll rather go for the safe way. As for the second thing: I'll make some changes and release a second version tomorrow. Buildings not on fire, will not injure FF's or create victims. :)

Thanks for the feedback.

x


When I grow up I wanna be like HOPPAH! (Dang, too late, too old now. Does young at heart count?) Man you have such AWESOME SKILLS! Thanks Hoppah!


Aww, don't exaggerate now, it's a fairly simple script to add some more fun things.
 
Link to comment
Share on other sites

Thanks!!! I'll make some changes and release a second version tomorrow.

Awesome man, I think the barrier is a cool idea, but for a firefighting version it'd be better not to have, if that makes sense? But it's soo cool man, involves far more units like ambulances etc :)

x

Link to comment
Share on other sites

Awesome man, I think the barrier is a cool idea, but for a firefighting version it'd be better not to have, if that makes sense? But it's soo cool man, involves far more units like ambulances etc :)

x

Well, if you want to increase the time to 1 or even 2 minutes, the barrier is very useful to find out which buildings are being searched.

But if you want to disable the barrier, remove the following 5 lines (do not touch the rest) from the script:


GameObject m = Game::CreateObject("mod:Prototypes/Objects/Fences/constrfence03.e4p", "Unnamed");
m.SetPosition(Pos);
m.SetRotation(Caller);
m.PushActionWait(ACTION_NEWLIST, TIME_SEARCH-0.5f);
m.PushActionDeleteOwner(ACTION_APPEND);

Link to comment
Share on other sites

Well, if you want to increase the time to 1 or even 2 minutes, the barrier is very useful to find out which buildings are being searched.

But if you want to disable the barrier, remove the following 5 lines (do not touch the rest lol) from the script:


GameObject m = Game::CreateObject("mod:Prototypes/Objects/Fences/constrfence03.e4p", "Unnamed");
m.SetPosition(Pos);
m.SetRotation(Caller);
m.PushActionWait(ACTION_NEWLIST, TIME_SEARCH-0.5f);
m.PushActionDeleteOwner(ACTION_APPEND);

Yeah I figured that's what it was for, well if you manage to enable multiple FFs to enter (as they usually search in teams of a full company) blocking the entrance would be a bit odd haha. But yeah fair enough.

I'm continuing to test, trying out multiple possibilities, I did have a crash but it wasnt a CTD so I'm guessing it was related to my pc

x

Link to comment
Share on other sites

Yeah I figured that's what it was for, well if you manage to enable multiple FFs to enter (as they usually search in teams of a full company) blocking the entrance would be a bit odd haha. But yeah fair enough.

I'm continuing to test, trying out multiple possibilities, I did have a crash but it wasnt a CTD so I'm guessing it was related to my pc

x

The crash I had with those 2 prototypes wasn't a CTD. The game just froze and the logfile didn't mention anything about a crash, so it just stopped responding. Had to use task manager to stop the em4 process. Thats why I mentioned specifically to test all buildings. :)

edit:

Added v2 already. Couldn't wait. See first post. Yippie-Kai-Yay

edit 2:

In most mods, the enterhouse script has been edited, so fire fighters with a hose can enter open_house buildings. To enable that in my script, find and remove the following codes from the script:


if(Caller->GetFirehoseID() > 0)
return false;


if(person.GetFirehoseID() > 0)
return false;

Edited by Hoppah
Link to comment
Share on other sites

Pardon my excavating, but how do I stop people on ladder trucks from being able to search? All I managed was a script error with my attempt.

 

Also, I don't know if this was mentioned, but is it possible to have multiple outcomes if you send multiple people in to search? Whenever I did that, only one thing seemed to happen with only one person.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...