Home   Help Search Login Register  

Author Topic: When an object activate a trigger  (Read 1093 times)

0 Members and 1 Guest are viewing this topic.

Offline Se7eN

  • Contributing Member
  • **
  • Cannot load mission, missing addons: Brain.pbo
When an object activate a trigger
« 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...

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:When an object activate a trigger
« Reply #1 on: 16 Jun 2005, 08:57:26 »
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...)...
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:When an object activate a trigger
« Reply #2 on: 16 Jun 2005, 09:00:59 »
if you get yourself the editor update (here) 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

Code: [Select]
pick_up = player addaction ["Pick up the notebook!", "pickup_notes.sqs"]
and in the 'on deactivation' field put

Code: [Select]
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 ;)
« Last Edit: 16 Jun 2005, 09:10:08 by bedges »

Offline Se7eN

  • Contributing Member
  • **
  • Cannot load mission, missing addons: Brain.pbo
Re:When an object activate a trigger
« Reply #3 on: 16 Jun 2005, 09:51:48 »
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.   ;)

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:When an object activate a trigger
« Reply #4 on: 16 Jun 2005, 10:28:37 »
uh huh... hint taken. i'll make a missionette to show it in action :P

edit - i got a bit caried away... missionette attached ;)
« Last Edit: 16 Jun 2005, 14:05:19 by bedges »

Offline Se7eN

  • Contributing Member
  • **
  • Cannot load mission, missing addons: Brain.pbo
Re:When an object activate a trigger
« Reply #5 on: 16 Jun 2005, 11:05:45 »
Im very thankful.  :)

Offline Blanco

  • Former Staff
  • ****
Re:When an object activate a trigger
« Reply #6 on: 16 Jun 2005, 12:06:46 »
Can't you use Sole's top secret document addon?

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
« Last Edit: 16 Jun 2005, 13:06:14 by bedges »
Search or search or search before you ask.

Offline Se7eN

  • Contributing Member
  • **
  • Cannot load mission, missing addons: Brain.pbo
Re:When an object activate a trigger
« Reply #7 on: 16 Jun 2005, 12:39:12 »
THX you all guys!

Its working with hasWeapon.  ;D


Offline Sefe

  • OFPEC Patron
  • Former Staff
  • ****
Re:When an object activate a trigger
« Reply #8 on: 16 Jun 2005, 12:40:14 »
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.

Offline Se7eN

  • Contributing Member
  • **
  • Cannot load mission, missing addons: Brain.pbo
Re:When an object activate a trigger
« Reply #9 on: 17 Jun 2005, 21:16:39 »
 :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...
« Last Edit: 17 Jun 2005, 21:51:23 by Se7eN »

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:When an object activate a trigger
« Reply #10 on: 17 Jun 2005, 22:41:30 »
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 ;)

Offline Se7eN

  • Contributing Member
  • **
  • Cannot load mission, missing addons: Brain.pbo
Re:When an object activate a trigger
« Reply #11 on: 19 Jun 2005, 10:27:30 »

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....

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:When an object activate a trigger
« Reply #12 on: 19 Jun 2005, 19:22:17 »
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 :)

Offline Se7eN

  • Contributing Member
  • **
  • Cannot load mission, missing addons: Brain.pbo
Re:When an object activate a trigger
« Reply #13 on: 20 Jun 2005, 16:14:24 »
Thx again Bedges.

 :cheers: