Home   Help Search Login Register  

Author Topic: spawn points  (Read 1331 times)

0 Members and 1 Guest are viewing this topic.

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
spawn points
« on: 14 Nov 2004, 21:18:38 »
hello
is it possible to have a marker or gamelogic, used as a getpos set pos point. to create a man w/ a waypoint to move to a certain place every 7 secs and that unit to have this setUnitpos"UP"? kinda like a spawn point
and im talking about single player not multi
thanks
« Last Edit: 14 Nov 2004, 21:19:17 by penguinman »

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:spawn points
« Reply #1 on: 14 Nov 2004, 21:52:41 »
Yes. Create this script 'ere:

#loop
~7
"soldierwb" createUnit [getpos GL, grpalpha,"this setunitpos {UP};this move getpos GL2",1,"private"]
goto "loop"

:beat: *Gets Shot* :beat:

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:spawn points
« Reply #2 on: 14 Nov 2004, 23:52:24 »
thanks what would i put in the activation and how would i get the script to stop.

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:spawn points
« Reply #3 on: 15 Nov 2004, 01:10:29 »
just make it check for a global variable to be true to exit
you could make the variable true through a trigger or another script, just put:
stop = true     in the script or in the activation field of a trigger (stop is the name of the global variable i used)

#loop
~7
"soldierwb" createUnit [getpos GL, grpalpha,"this setunitpos {UP};this move getpos GL2",1,"private"]
?stop = true:goto "end"
goto "loop"

#end
exit

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:spawn points
« Reply #4 on: 15 Nov 2004, 06:47:58 »
sorry guys this is not getting through to me.
if sombody could explain this or maby an example mission.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:spawn points
« Reply #5 on: 15 Nov 2004, 14:50:01 »
;lines starting with a semicolon are comments
;look up all of the commmands in the online version of the comref
;if there's one you don't understand just ask

;this is a label to indicate the section of the script called loop
#loop

;delay of 7 seconds
~7

;this line creates the loon
"soldierwb" createUnit [getpos GL, grpalpha,"this setunitpos {UP};this move getpos GL2",1,"private"]

;if the variable stop is true then go to the section called "end", otherwise go to the next line
;you can set it to true in a trigger
;with the command
;stop=true
;Armsty wrote it wrong, it should be
? stop : goto "end"

;pretty much self explanatory
goto "loop"

;section called end
#end

;stop the script
exit

;hope that helps
Plenty of reviewed ArmA missions for you to play

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:spawn points
« Reply #6 on: 15 Nov 2004, 15:17:04 »
I didn't write it wrong, Trigg did! I am PERFECT! PERFECT! ;D

Anyway, I've had a bad experience of bools in scripts. I prefer using numbers. So the script will look like this:

Code: [Select]
stop = 0
#loop
~7
"soldierwb" createUnit [getpos GL, grpalpha,"this setunitpos {UP};this move getpos GL2",1,"private"]
?stop == 1:exit
goto "loop"

And to turn the script off, type:

stop = 1

Remember that grpalpha must actually be a real group that you've allready defined, like this:

grpalpha = group this

in some d00ds init field.

:beat: *Gets Shot* :beat:

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:spawn points
« Reply #7 on: 15 Nov 2004, 16:03:08 »
Ah yes, I wondered who'd be the first to spot that.   ::)
Plenty of reviewed ArmA missions for you to play

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:spawn points
« Reply #8 on: 16 Nov 2004, 06:11:39 »
thank you guys
I get it pretty much now
but what is loon
also is GL a name or an official thing: group leader right?
1 more thing: where would i define the group?
1 more thing : this is hard to explain but:
u know how the different portions of code are seperated by spaces, well when the game reads the script does it read it top to bottom or if I wanted to make the game first move a man to a marker pos then right after move him to another marker pos would I::::

Code: [Select]
man1 setPos getPos M1

man1 setPos getPos M2

Or would I do:::

Code: [Select]
man1 setPos getPos M1

~2

man1 setPos getPos M2
if this works then this is my first script.

which one would be correct or would both be right
Thank you guys
Ps: you should have a contest at the end of the year and count up who inserted the most posts in the scripting section and give him a prize. but dont tell anyone
kind of like most likly begining scripter to succeed or best scripting pupil
just a thought
another thought: anybody tried pacific assault?

once again thanks all Im learning scripting pretty well now.
will ofp 2 have a mission editor and scripts?

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:spawn points
« Reply #9 on: 16 Nov 2004, 12:47:03 »
loon = moron = dude = soldier

GL = game logic

grpalpha = group this
goes in the init field of the group leader

The game executes each line of a script in turn.    The end of a line is marked by the enter/carriage return key, which leaves an invisible mark like
this.

You don't need delays between lines unless you want a delay.   The exeption is in a loop, where a delay is highly desirable.

OFPEC does not have post counting.  We used to, but it can lead to the wrong sort of behaviour.    The forums are much better without it.

OFP2 is still pretty much off topic on these forums, because it hasn't been released so you can't have any editing questions about it.    Head over to the official forums (and elsewhere) to talk about it.


Plenty of reviewed ArmA missions for you to play

Knowlife

  • Guest
Re:spawn points
« Reply #10 on: 16 Nov 2004, 19:24:19 »
Quote
where would i define the group?
I would like to know this too, I am making a mission that involves some spawning of enemies. I would like each soldier to spawn into a new group, and run hunter.sqs (a script that make him go hunt down the player)

_point is a gamelogic (the spawn point)
_group should be a new group every loop
_interval is the time between each spawning

#spawn
_group = group ???
"soldierE" createUnit [getpos _point,_group,"[this] exec "hunter.sqs"",0.5,"PRIVATE"]
~_interval
goto "spawn"

Apart from the problem with groups, it is also a problem to run hunter.sqs. I get a error message because of the qoutes around the filename, so I wrote this instead:

"soldierE" createUnit [getpos _point,_group,"[this] exec hunter.sqs",0.5,"PRIVATE"]

Now, there's no error message, but it still does'nt work, nothing happens, hunter.sqs just does'nt execute...

Can anyone help?

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:spawn points
« Reply #11 on: 17 Nov 2004, 03:02:55 »
When you use createUnit, the group must already exist.    I think the usual way is to create a gamelogic in the mission editor with a probability of presence of 0.     Put a group name in its init line.    Use one GL for each group you want to create.   Remember that there is a limit of 63 groups per side.

Sometimes you need to use curly brackets { } instead of quotes " ".    They are supposed to be identical, but sometimes the game gets confused when it meets a " and can't decide if it's closing a previous " or opening a new one.
« Last Edit: 17 Nov 2004, 03:04:06 by macguba »
Plenty of reviewed ArmA missions for you to play

Knowlife

  • Guest
Re:spawn points
« Reply #12 on: 17 Nov 2004, 20:57:33 »
Thank you, that was just what I needed to know. :)