Home   Help Search Login Register  

Author Topic: Spawning Questions  (Read 1660 times)

0 Members and 1 Guest are viewing this topic.

mad_addons

  • Guest
Spawning Questions
« on: 03 Aug 2005, 05:10:38 »
Hi all,

I was working on the OnSingleMapClick with CreateUnit, and I've come to several problems.. due to lack of my intelligience.

First, how do you set up a position on the location you clicked using OnSingleMapClick? For example, moving the game logic to that clicked area. If possible, could anybody tell me the syntax for this?

Is there a way to delete the dead bodies so that I can keep spawning units regardless of 64 group cap?

If you could answer those questions, I'd appreciate it.

Offline RujiK

  • Members
  • *
  • KoKo Puh-Fizzles!
Re:Spawning Questions
« Reply #1 on: 03 Aug 2005, 17:24:51 »
onMapSingleClick {"SoldierEB" createUnit [_pos,group player]}

_pos is automaticly defined when you click so all you need to do is stick this in the init, however you will be able to create endless guys with this so it will need more work depending upon what you intend to do.

To delete bodies just give killed event handlers and the deletevehicle command for the scrpt.
I like your approach, lets see your departure.
Download the New Flashlight Script!

mad_addons

  • Guest
Re:Spawning Questions
« Reply #2 on: 03 Aug 2005, 18:47:52 »
Okay, I'll get working on it.
Also, when I put init for soldiers I create on the script, it doesn't seem to work? Is it not supposed to?

I appreciate your help, RujiK.

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Spawning Questions
« Reply #3 on: 04 Aug 2005, 03:10:03 »
yes, it is very much supposed to work, and does, flawlessly, when used with correct syntax/commands etc

perhaps you could post your createunit code

mad_addons

  • Guest
Re:Spawning Questions
« Reply #4 on: 04 Aug 2005, 04:08:39 »
Uh.. I erased it just few hours ago.. sorry..

Okay, now I know that init works... Another question.

I was looking into another thread and I saw something with _alt and _shift in the field. Are these automatically applied to OnSingleMapClick or do I have to set them up?

mad_addons

  • Guest
Re:Spawning Questions
« Reply #5 on: 04 Aug 2005, 20:09:06 »
uh... anyone? sorry, but i really need to get this done as soon as possible.

mad_addons

  • Guest
Re:Spawning Questions
« Reply #6 on: 04 Aug 2005, 20:48:27 »
Sorry, but i have another thing to say.

OnMapSingleClick {"OfficerW" createunit [_pos, west1, "this addeventhandler ["killed", {deletevehicle this}]"]}

That is my code. When I try to execute it, it says. Unknown operator "killed". Why's that?

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Spawning Questions
« Reply #7 on: 05 Aug 2005, 03:43:50 »
because ofp doesn't read quotes the way you would. it sees this:

OnMapSingleClick {"OfficerW" createunit [_pos, west1, "this addeventhandler ["killed", {deletevehicle this}]" ]}

the curly brackets( { ) can be used instead of quotes, and will always work the way you want it to
« Last Edit: 05 Aug 2005, 03:44:54 by Triggerhappy »

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Spawning Questions
« Reply #8 on: 08 Aug 2005, 12:54:06 »
Yeap... that's about the size of it.

Back in the day before curly brackets came into OFP, we used to have to use a set of double quotes. It could get very confusing, but to cut a long story short this line should work for you:

OnMapSingleClick {"OfficerW" createunit [_pos, west1, "this addeventhandler [""killed"", {deletevehicle this}]"]}

Any set of quotes that's already inside a set of quotes needs to have two quotes. It gets even more fun using foreach commands... eg.

"_x setbehaviour ""Combat""" foreach units group

The 3 quotes at the end can really throw you off a bit ;)

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Spawning Questions
« Reply #9 on: 10 Aug 2005, 20:48:44 »
#Bump
Plenty of reviewed ArmA missions for you to play

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Spawning Questions
« Reply #10 on: 12 Aug 2005, 03:50:08 »
lol why? is this problem coming up a lot recently?

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Spawning Questions
« Reply #11 on: 12 Aug 2005, 03:59:42 »
Quote
lol why? is this problem coming up a lot recently?

Not really, but due to the large number of topics shunted back and forth from Advanced and General, recent posts were bumped back to the top.  

 ;D ;D

Planck
I know a little about a lot, and a lot about a little.

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Spawning Questions
« Reply #12 on: 12 Aug 2005, 04:07:02 »
ahhh
i noticed that topics had been moved around. i know this is getting offtopic but is there any particular reason why?
(My curiousity is exploding!! lol)
perhaps i should pm you instead. if so, go ahaed and delete this post or i will...or something

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Spawning Questions
« Reply #13 on: 12 Aug 2005, 15:47:33 »
Quote
is there any particular reason why?
Yes.    

Read this new sticky post.  ;)


PS - it's very rare that posts are deleted.   Questions about why something is happening at OFPEC, or suggestions about how it could be done better, are always welcome.
« Last Edit: 12 Aug 2005, 15:53:43 by macguba »
Plenty of reviewed ArmA missions for you to play