Jump to content
Sign in to follow this  
iceman11a

Scripting samples, and respawning a player

Recommended Posts

I been looking and haven't fount any thing. I was looking for some script samples. From a basic script to an advance script. I wanted to see if some one made some up or have an idea or 2 where I can get some.

and last. Is it possible to respawn a player in single missions.

Thanks again Iceman11a

Share this post


Link to post
Share on other sites

There was a collection of scripts on OFPEC.com, also various tutorials for scripts and basic missions... maybe other sites still have some. And respawning in single player isn't possible, sadly. I've tried a few things out, and it didn't end too well.

---------- Post added at 21:34 ---------- Previous post was at 21:32 ----------

Ah, I got something, here we go: http://ofp.toadlife.net/downloads/tutorials/scripting_guide/scripting.htm

Share this post


Link to post
Share on other sites
You can check below, there is some missions you can find some examples of what you want, It has some respawn scripts to but I'm not sure if the "Player" him self can be respawn.

http://www.ofpd.org/scripts.php

Thanks, I all ready have these. They don't have the options or samples I wanted.

---------- Post added at 04:49 PM ---------- Previous post was at 04:46 PM ----------

There was a collection of scripts on OFPEC.com, also various tutorials for scripts and basic missions... maybe other sites still have some. And respawning in single player isn't possible, sadly. I've tried a few things out, and it didn't end too well.

---------- Post added at 21:34 ---------- Previous post was at 21:32 ----------

Ah, I got something, here we go: http://ofp.toadlife.net/downloads/tutorials/scripting_guide/scripting.htm

Thank you all so. It's just the samples I was looking for are going to require a mission all so.

I think I posted a small list too.

Share this post


Link to post
Share on other sites

I'm having some problems getting a unit and group to spawn. Can some one please help.

here's some code I fount that just doesn't work. I keep getting the west doesn't exists. So I'm lost here.

--------------------------------------

_grp = createGroup west; ; This line errors out

_pos = getpos player;

_unit = _grp createUnit ["USMC_Soldier", _pos, [], 100, "FORM"] ;

--------------------------------------------------------------

Can some one, any one show me how to spawn a unit and a group of soldiers.

Share this post


Link to post
Share on other sites

Hi iceman,

You're trying to use Arma scripting that isn't present in OFP "createGroup". Also anything like "_unit" is a variable that needs a real name assigned to it. Lastly generic template layout needs real terms used "Form".

Here is the basic layout for spawning a unit:

"EDITORNAME" Createunit [sPAWN POS,GROUPNAME,"INIT",SKILL","RANK"]

Example:

"SoldierWmedic" createunit [getpos spawn,grp,"W1 = this",1,"SERGEANT"]

Spawn Pos is an object (with name) a marker name...etc.

This will spawn a group:

Create.sqs

;create script by -CrashnBurn- dwaters59@msn.com

;-----------------------------------------------------------

#start

_units1 = units west1

"_x setunitpos up" foreach _units1

west1 allowfleeing 0

"_x addweapon NVGoggles" foreach _units1

#loop

? NOT(alive player): exit

?(("Alive _x" count _units1) == 0): goto "create"

~(random 5) + 5

goto "loop"

#create

~(random 5) + 5

"deletevehicle _x" foreach _units1

~1

"OfficerW" createunit [getpos g1, west1, "w1 = this", 1, "LIEUTENANT"]

"SoldierWG" createunit [getpos g1, west1, "w2 = this", 1, "SERGEANT"]

"SoldierWLAW" createunit [getpos g1, west1, "w3 = this", 1, "CORPORAL"]

"SoldierWAA" createunit [getpos g1, west1, "w4 = this", 1, "CORPORAL"]

"SoldierWMedic" createunit [getpos g1, west1, "w5 = this", 1, "PRIVATE"]

"SoldierWMG" createunit [getpos g1, west1, "w6 = this", 1, "PRIVATE"]

~(random 5) + 5

goto "start"

Edited by Zulu1

Share this post


Link to post
Share on other sites

Thank you for the script. Please I'm just trying to learn the basics. So the extra code wasn't needed. How ever I am getting an error on this.

http://www.mediafire.com/view/flat7s1vf2ukz77/spawn_error.jpg

If I under stand this right that some thing is missing and I can't figure it out. All I want to do is when a unit enters a trigger is to spawn like 4 to 6 solders from the west side. This is what I have so far. I don't under stand all of this. Please just some thing real simple and easy to under stand. This is why I had issues learning ArmA 2 scripting.

"OfficerW" createunit [getMarkerPos Zone1, SkoTroops, "t1 = this", 1, "LIEUTENANT"];

"SoldierWG" createunit [getMarkerPos Zone1, SkoTroops, "t2 = this", 1, "SERGEANT"];

"SoldierWLAW" createunit [getMarkerPos Zone1, SkoTroops, "t3 = this", 1, "CORPORAL"];

"SoldierWAA" createunit [getMarkerPos Zone1, SkoTroops, "t4 = this", 1, "CORPORAL"];

"SoldierWMedic" createunit [getMarkerPos Zone1, SkoTroops, "t5 = this", 1, "PRIVATE"];

"SoldierWMG" createunit [getMarkerPos Zone1, SkoTroops, "t6 = this", 1, "PRIVATE"];

---------- Post added at 06:25 AM ---------- Previous post was at 05:17 AM ----------

I was going over the script commands and I look up CreateUnit and that's when I saw this.

type: String - Classname of unit to be created as per cfgVehicles

Am I missing a file or some thing that I need, What is cfgVehicles ???

and the other sentence I saw was this.

The Group parameter MUST be an existing group or the unit won't be created.

Does this mean I have to create the Group before I can spawn it. I mean is that I have to put a Groups of units on the map so that I can spawn them.

?

Share this post


Link to post
Share on other sites

hi,

Does this mean I have to create the Group before I can spawn it. I mean is that I have to put a Groups of units on the map so that I can spawn them.

?

Yes you must put one unit on the map with SkoTroops=group this in its init field to create your group. You can also use waypoints with this unit and the spawned units will follow them.

cya.

Nikiller.

Share this post


Link to post
Share on other sites

I added 6 units west and added SkoTroops=group this in its init field and I still can't get it to work. Some thing about groups and objects again. No wonder I gave up on Arma over a year a go. I down loaded some samples and they are way too advanced. Can some one make me a real simple and easy one. That's what I need.

All I want it to spawn 6 units on a marker, in a group when a player triggers a trigger . That's all.

Edited by iceman11a
spelling error

Share this post


Link to post
Share on other sites
I added 6 units west and added SkoTroops=group this in its init field and I still can't get it to work. Some thing about groups and objects again. No wonder I gave up on Arma over a year a go. I down loaded some samples and they are way too advanced. Can some one make me a real simple and easy one. That's what I need.

All I want it to spawn 6 units on a marker, in a group when a player triggers a trigger . That's all.

Like Niki said you need to add one "dummy" unit on the map, usually far away on a small island and put "SkoTroops=group this " in the init field. Then either put your lines of code in the init filed of a trigger or better to put it in a .sqs file and call that from the trigger. Then what ever side the player is make that the activation for the tirgger. Of course you must also have the marker named zone1 placed on the map. If you need it maybe tonight I could make a demo mission to show how it works. Unless Nikiller beats me to it :)

Share this post


Link to post
Share on other sites

Thanks, I could use a demo to show me how to do it. I did all that all ready and it didn't work.

Share this post


Link to post
Share on other sites

hi,

Thanks, I could use a demo to show me how to do it. I did all that all ready and it didn't work.

"OfficerW" createunit [getMarkerPos Zone1, SkoTroops, "t1 = this", 1, "LIEUTENANT"] is wrong it's "OfficerW" createunit [getMarkerPos "Zone1", SkoTroops, "t1 = this", 1, "LIEUTENANT"]

demo link: http://www.mediafire.com/download/1g176q6zmlx4ob6/demo_niki_basic_spawn.Intro.rar

PS: I beat you Z :icon_mrgreen:

cya.

Nikiller.

Share this post


Link to post
Share on other sites

Thanks Nikiller, Now that works. Thank you very much.

Two more things, Is there a way to mark a unit as a target. I want the player to see that the unit is a target. and last. Is there an program that will let me keep my OFP updated or let me download and install mods and addon's. I was wondering if any one made one for OFP. Please let me know.

Share this post


Link to post
Share on other sites

Sense I didn't here back. I guess the answer is no. and that sucks. Does any one know of some nice mods or addon's I should add to my game. I need to start a new post any way.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×