OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Se7eN on 16 Jun 2005, 08:29:08
-
I have an idea for a new mission but i cant make it, becouse i need a script or/and an addon for it.
I need an object ( like a closed notebook or a simle document) what we have to search in the mission. When we find it, we have to take this object to the extraction point to finnish the map. But if a soldier die, who bring the item, than another soldier must search his body, pick up the item and take it to the end trigger. The end trigger is being active if a player and the object is there.
another example:
We have to find a key somewhere (on a table or maybe at an enemy soldiers inventoy) and pick up it. Goto a closed gate (what you cant open without this key) and open it to steal a vehicle.
Make it possible?
THX Se7eN...
-
IMO the easiest way to do this would be to make a 'dummy weapon' addon that would class that notebook and the key as a weapon (like handgrenade or something similar)...
You could pick them up and then you could check whether a soldier has it with a simple hasWeapon script...
Of course a scripting solution could be written but the addon way would take much less work than that (again, imo...)...
-
if you get yourself the editor update (here (http://www.ofpec.com/editors/resource_view.php?id=612)) there's already a notebook and other bits and pieces which you can use. the principle of picking stuff up is quite simple, but needs expanding on a little to incorporate what you need - you'll require a static trigger for the object itself, and a moving trigger for the unit carrying it.
the static trigger - place the object, and put a trigger over it, quite small so that the player/unit has to get close, and give it a name in the 'name' field. set it to repeating. group the trigger with the player (or set it to whatever side you want to pick it up 'present'). in the 'on activation' field put
pick_up = player addaction ["Pick up the notebook!", "pickup_notes.sqs"]
and in the 'on deactivation' field put
player removeaction pick_up
the pick_notes script should do the following:
- setpos the notebook far away, to make it look like the unit has picked it up;
- display a hint or text of some sort saying "Well done, you've got the notebook!";
- add to the player's score;
- change the objectives accordingly;
- set a variable to show who has the notes;
- activate the named moving trigger;
- delete the named static trigger.
the moving trigger would be exactly as above, only a small looping script would be needed to keep it over the unit who has the notebook.
the final end-mission trigger would check who has the notes, and whether that unit is present.
i'll leave it up to you to figure out how all that is done ;)
-
WOW! Its more difficult than i think . Im a beginner in scripting and i have basic faults in my knowledge. ??? I tryed to make it, but its to complex for my brain. ;D
I wish i could download this script from somewhere. ;)
-
uh huh... hint taken. i'll make a missionette to show it in action :P
edit - i got a bit caried away... missionette attached ;)
-
Im very thankful. :)
-
Can't you use Sole's top secret document addon?
http://ofp.gamezone.cz/index.php?sekce=unofaddons/misc&archiv=true&page=8 (http://ofp.gamezone.cz/index.php?sekce=unofaddons/misc&archiv=true&page=8)
10th addon on the page. (just a few kb)
You can place the docs with a weaponholder whereever you want, so a unit is able to pick it up. You can carry them with you, because it's a weapon. No scripts or triggers needed, just a hasweapon check.
#edit by bedges - link ammended
-
THX you all guys!
Its working with hasWeapon. ;D
-
Actually you can get a list of all units in the trigger area (with the list operator) and search their inventory for the object. When you group the trigger with the player's group and only members of that group will be in the trigger list.
-
:wow:
WOW
Bedges you are unbelivable. I owe you one.
The hasweapon worked fine in SP, but in MP wasnt perfect. Your script is fantastic! This is what ive imagined, but in MP have the same bugs.
-P2 only can pick up the radio when p1 is in the trigger.
-P2 cant see the "hint "p1 pickedup the item."", p1 too if p2 pick it up.
-When p2 take the item to the end trigger then no end.
Se7eN...
-
hmmm. well then my only suggestion would be to add the pickup action to the object itself, which means it could be activated from a good few metres away, not just right up close. the principle would be the same though - find out who activated the action, make that unit the 'has_package', remove the object and action, and make the 'drop package' action in the unit's menu.
i'm not familiar with MP scripting, so perhaps the hint would be changed to a groupchat, to let the other team members know.
the final trigger could be replaced by a slowly looping script which finds out if the 'has_package' unit is a certain distance away from the final area. that would mean anyone could have the package and return, thus completing that part of the mission.
it's fun playing pass-the-parcel with ai units though isn't it ;)
-
Bedges i need your help again. I cant change your "pick-up" scrip into multiplayer. Always the same bugs. :( Whatever i do it isnt working perfectly ( or not working ;D). If you have time please take a look into it. ;)
Thx
Se7eN....
-
hmmm.... well like i say i have zero experience working with multiplayer, so i dunno. it has to be run one everyone's computers huh? i really dunno. i could suggest taking the script to the multiplayer board.
attached is a fixed up script which allows any unit in the player's group to take/drop the package. only problem is, the actions are available in all players' action menus.... no idea how that can be fixed, if at all, but then i am approaching this from a single-player perspective.
hope this helps :)
-
Thx again Bedges.
:cheers: