OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: garret64 on 30 Apr 2004, 05:34:21
-
I want a trigger that wehn activated will run a script that will create a coba (with crew, and in flight preferably) and then have it move to a waypoint. I have searched through the forums, and ed depot, and have downloaded a few different missions and tuts, but i just cant get it working.
Here is my setup:
i have a 'dummy' guy named cob1 with : cobraz = group(this); deleteVehicle this in his init field, and a move waypoint for him.
I also have this script (which i modified from one i found):
#start
#create
cobra1 = cobra createvehicle getpos cob1
~1
"SoldierWPilot" createunit [getpos cob1, cobra1, "p1 = this", 1, "CAPTAIN"]
"SoldierWPilot" createunit [getpos cob1, cobra1, "p2 = this", 1, "LIEUTENANT"]
~1
p1 moveindriver cobra1
p2 moveingunner cobra1
exit
and a trigger that execs the script, but when i go to the trigger nothing happens, i have an activation for it, and i know the trigger is working because i put a text effect in it, and the text comes on screen.
any help would be greatly appreciated.
-
I want a trigger that wehn activated will run a script that will create a coba (with crew, and in flight preferably) and then have it move to a waypoint. I have searched through the forums, and ed depot, and have downloaded a few different missions and tuts, but i just cant get it working.
Here is my setup:
i have a 'dummy' guy named cob1 with : cobraz = group(this); deleteVehicle this in his init field, and a move waypoint for him.
I also have this script (which i modified from one i found):
#start
#create
cobra1 = cobra createvehicle getpos cob1
~1
"SoldierWPilot" createunit [getpos cob1, cobra1, "p1 = this", 1, "CAPTAIN"]
"SoldierWPilot" createunit [getpos cob1, cobra1, "p2 = this", 1, "LIEUTENANT"]
~1
p1 moveindriver cobra1
p2 moveingunner cobra1
exit
and a trigger that execs the script, but when i go to the trigger nothing happens, i have an activation for it, and i know the trigger is working because i put a text effect in it, and the text comes on screen.
any help would be greatly appreciated.
Naming the group cobraz is useless unless you call it in the script. As far as I know, there has to be a group for the created units to goto ;)
So something like
"SoldierWPilot" createunit [getpos cob1, cobraz, "p1 = this", 1, "CAPTAIN"]
p1 moveindriver cobra1
p2 moveingunner cobra1
exit
You get the idea
Edit: If this is all there is to the script. Ditch the labels.
and: cobraz = group this
-
thanks for the feedback, but i just cant get it to work. I dont know if im missing something, or if something is tyoed incorrectly, this is my first time trying to do this, and im trying to base it off of respawning scripts ive seen.
Any one else have any ideas?
-
The only error is that you have is what Isaioux2x says above.
Change
"cobraz = group(this)"
to
"cobraz = group this"
just to make sure and in the script the create lines from
""SoldierWPilot" createunit [getpos cob1, cobra1, "p1 = this", 1, "CAPTAIN"]"
to
""SoldierWPilot" createunit [getpos cob1, cobraz, "p1 = this", 1, "CAPTAIN"]"
-
ah ha, well i hope it works....
cover me, im going in...
-
ok, i changed the 'cobraz = group(this), i didnt catch that from Isaioux2x, i thought he meant to ditch it too. and ive read through both your posts a few times, and have made every change you suggest
and now.....
it still dont work.
Is cobra the right name to use to create a cobra? from what i know thats the only other thinkg i know of that could be causing it to not worky.
-
ok, i changed the 'cobraz = group(this), i didnt catch that from Isaioux2x, i thought he meant to ditch it too. and ive read through both your posts a few times, and have made every change you suggest
and now.....
it still dont work.
Is cobra the right name to use to create a cobra? from what i know thats the only other thinkg i know of that could be causing it to not worky.
Yes, I honestly don't see why this isn't working.
I think the problem lays within your trigger. Because it doesn't seem to be erroring out. And if it couldn't find the script it would've displayed a message telling you so. The script looks sound.
If you're 100% the scipt is executing then it's a problem in the init field
-
Is cobra the right name to use to create a cobra?
Ah indeed it is. How did I miss that? ;D
cobra1 = cobra createvehicle getpos cob1should be
cobra1 = "cobra" createvehicle getpos cob1
-
Don't I look like a fool? :)
You have to love it when you're sitting for hours to figure out why something isn't working and then you find out it was just something small. Scripting/Programming in general.
-
uh hu, well ill give it a try and if it doesnt work (knock on wood) im giving up for the night.
-
so i guess im giving up for the night...
if someone could write/post a working script for this that i can compare with my own, that would help.
mabey tomarrow ill re-write the script and trigger from scratch, who knows mabey it will work then
and thanks for the help given so far, it has been helpfull, even though it isnt working yet, ive still learned a few things, so thanks alot.
-
SFS84, I got your script working with two changes. I verified both changes are necessary to get it working.
First, the line
cobra1="cobra" createvehicle getpos cob1
has two problems. "cobra" must be "Cobra", as the name is case-sensitive. Second, once you delete cob1, getpos cob1 is invalid. So you must either supply coords for createvehicle (and createunit) or place a gamelogic/other object near where cob1 is, and use that. So here is the working script:
cobra1="Cobra" createvehicle getpos glCob
~1
"SoldierWPilot" createunit [getpos glCob,cobraz,"p1=this",1,"CAPTAIN"]
"SoldierWPilot" createunit [getpos glCob,cobraz,"p2=this",1,"LIEUTENANT"]
~1
p1 moveindriver cobra1
p2 moveingunner cobra1
exit
glCob is a game logic I placed in the editor next to the unit named Cob1. Cob1's init looks like this:
cobraz=group this;deletevehicle this
and I gave him three waypoints, which the helo followed after taking off. To test this, I used a radio trigger (Alpha), but I assume you have no trouble with the trigger or calling the script on activation, right?
Hope that helps! :)
-
Ok, i made those changes and it worked. The cobra even got shot down by some shilkas. :P
Thanks Kammak, I never even thought about either of those two things, although i knew that names were case sensitive, it just escaped me.
thanks for all the help i got, now that its working im just so happy ;D
thanks again guys