Jump to content
Sign in to follow this  
Joonas

My thread of amateur questions. Pleas help me :)

Recommended Posts

Hey,

Been a while since i've been editing in OFP. Honestly said i was a kid when i built map for a group of friends to play co-op with. Good times.

I'll keep posting questions as i progress but i would like to put em all in this one thread instead of flooding the forums.

Alright.

Figured number 1, cubadead.

figured paratroop.

Please help me to : Have helo shoot his weapons when it reaches selected area. No targed needed, only firing at ground at given time.

How to order a tank shoot an object. I tried Tank Dofire (Object xxxx) Didn't work.

How to create radio messages, no voice requires. only text.

How to teleport an unit group when trigger is activated(True). and move them towards next waypoint(Sync trigger and next wp probably)

How to teleport group to random location(Marker) with certain chance. Like 25% marker1, 25%marker2, 25%marker3, 25%marker4.

Could somebody be kind enough and give me all the objective status commands. How to show hidden objective for example.

Thanks a lot

Share this post


Link to post
Share on other sites

question 1:

2 possibilities

-Possibility 1

Create a trigger , press F2 (or click on the Group button of the mission editor), click on the soldier, and leave your mouse button pressed then draw a line between that unit to the trigger.

Edit the properties of the trigger linked to that unit

Check that the line "Activation" is set on "Vehicule" (as it should be automatically)

Select "Not Present"

Set the size of the trigger big enough to cover the mission area, as the trigger will activate only if the soldier is either dead or has left the trigger area.

Once done you can add your mission codes at the line "On Activation"

Possibility 2

edit the properties of the soldier, and add in the initialisation line :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">GUBADEAD=false; this addEventHandler ["killed","GUBADEAD=true"]

create a trigger.

At the line "Condition", remove the "this" and instead put GUBADEAD

Then at the line On Activation you can put your codes.

his trigger will activate only when GUBADEAD is "true", and so following the eventhandler, it can only happen when the soldier is killed.

Share this post


Link to post
Share on other sites

Alright.

Figured number 1, cubadead.

figured paratroop.

Please help me to : Have helo shoot his weapons when it reaches selected area. No targed needed, only firing at ground at given time.

How to order a tank shoot an object. I tried Tank Dofire (Object xxxx) Didn't work.

How to create radio messages, no voice requires. only text.

How to teleport an unit group when trigger is activated(True). and move them towards next waypoint(Sync trigger and next wp probably)

How to teleport group to random location(Marker) with certain chance. Like 25% marker1, 25%marker2, 25%marker3, 25%marker4.

Thanks a lot

Share this post


Link to post
Share on other sites

Ok, I've got some solutions.

For the helo and the tank I believe that the Editor Upgrade comes with some invisible targets that could be used to have the tank and chopper shoot at them. Another alternative would be to setpos a few objects underground where you want the chopper to fire and just have it dofire on those.

For the radio messages you can just use

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[West, "HQ"] sidechat "whateveryouwanttosay"

This will only make PAPA_BEAR talk. Usually, if you just want a quick order-giving sequence it works.

If you want to have other people saying stuff you'll have to learn how to create identities. Here's a link

I think you have it right with the waypoint and trigger syncing. You don't have a problem with the actual teleport do you? You could just use the <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this setpos getpos teleportlocation

As for the waypoint afterwards you might try integrating the command

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">nameofsquad lockWP true

This would lock the WP at the current waypoint which could be at any place. Then, in the On Activation line of the trigger you put that command except false instead of true. Then, they continue onto the waypoint you may have placed around the teleportation point.

With the random marker points you would have to do something in a script with the command "random" which is used to select a random number.

DISCLAIMER: I am not experienced in the use of this. I only read a lot of scripts. If this is wrong please correct it and I will be grateful.

You would have to put:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_var = random 4

? _var = 1 then groupname setpos getmarkerpos teleportplace1

? _var = 2 then groupname setpos getmarkerpos teleportplace2

...and so on. This would give it a totally random number out of four, or however many markers you would want. You could even make this more complicated and add more of a chance that it would be at one position more than the other.

Anyways, there's my piece. Hope it helps. Anymore questions and I would be glad you help.

BTW, if you don't mind me asking, what kind of mission are you working on with all this. I could probably help you more if I knew what you were trying to achieve.

Share this post


Link to post
Share on other sites

One nice feature is to group (F2, drag lines with lmb) empty markers with an unit. It will be automatically placed on one of them at random. If it's a group, leave them "in formation" and they will start there too.

The Best Way to Select a Random Element From an Arrayâ„¢ is this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_myArr = [1,2,3,4,5,6,7]

_luckyNumber = _myArr select ((random count _myArr)-0.5)

So, to select a marker pos out of 4 and move something there from the leader's init line:

markers=["m1","m2","m3","m4"]; p = getmarkerpos (markers select ((random count markers)-0.5)); {_x setpos p} foreach units group this

Share this post


Link to post
Share on other sites

Hey,

Thanks for the answers. They're kind of complicated but i try to solve my way through them. I am sorry i've never programmed or used code in any situation of my life.

Actually, i cant make the setpos working. The units dont seem to want to teleport regardless. Do i need to create a script file or can i type these in activation field. Because the latter doesnt seem to work. How would i exactly teleport a group of units to marker, say marker1.

About the helo firing, dofire didn't do the job. The tanks refuse to shoot invisible targets or even objects defined on map. Same with helos. Long time ago somebody gave me a script to order the helo to shoot it's weapons like 30 times. Like, simple said. "This, shoot SomethingLauncher x30" But in code language. I have no clue. Would this be a script file and trigger to force the helo to perform the firing script? Thanks

To your question : The mission is a city-defense (Le moule @ Everon) Against waves of enemy units. Area respawn with given time. No realism. If you have ever played defensive maps on games like warcraft 3 You'll know. Your enemies would spawn at random locations and overwhelm the city and helos fly over the city firing it and tanks rolling from the hills. This would of course be extremely hard mission to complete. Basicly there will be waves of enemy infantry, sneaky spetz natz squads, tanks, helos, paradrops in sight. A long and painful map that gets harder every passing minute as your enemy gives you no breathing time. When all members of your team are dead before at least one could respawn again it's a defeat.

Share this post


Link to post
Share on other sites

Well, instead of using markers for your spawns why don't you use Game Logics? This would allow you to use the code:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">nameofthing setpos (getpos nameofgamelogic)

This would probably work. It does for me.

I'll have to poke around a little with the editor to see about the chopper. You should be able to dig up a script for it, but it's beyond me to script that. Like you, I've just recently begun to use code myself in my missions. I'm still puzzling out arrays.

EDIT: I found out that the choppers only fire on infantry and only with the machine gun, not the rockets. This might make it difficult if you wanted the chopper to fire on the town in general. I couldn't even get the chopper to fire on an empty tank. Same for the tanks. It's something I'll have to delve into later.

Something you might try to add randomization without scripts is the placement radius of units. If you wanted to add a tank squad, but wanted to make it so that they would start anywhere in an area to the north of Le Moule you could make their placement radius a huge one covering the entire north of Le Moule. You could also add a probability that they would be there at all. Then give their waypoints a placement radius, and a probability percentage to them as well. After that you could even add times that they could spend at that waypoint to make it so that the would move immediately from that point or would wait 3 minutes.

In the standard OFP editor there are so many ways you could randomize an attack that even the creator wouldn't know where it was coming from.

Anyways, if you ever get your mission to a beta testing stage, or need more help with it, just send it to me and I'll be happy to help.

Share this post


Link to post
Share on other sites

I tested this line in the editor and it worked so I don't know what's wrong:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">markers=["m1","m2","m3","m4"]; p = getmarkerpos (markers select ((random count markers)-0.5)); {_x setpos p} foreach units group this

Place 4 markers (m1,m2,m3,m4) and that code on the leader's init line.

If it's online, you want to run it on server only so put it inside this block:

if (local this) then { markers=["m1","m2","m3","m4"]; p = getmarkerpos (markers select ((random count markers)-0.5)); {_x setpos p} foreach units group this; }

Here's all the data types in OFP explained, including a thorough description of arrays: http://ofpec.com/COMREF/types.php

Although again, the easiest way to place something randomly on certain markers, is to just group them with the unit.

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  

×