Home   Help Search Login Register  

Author Topic: To CreateVehicle or Not to CreateVehicle  (Read 774 times)

0 Members and 1 Guest are viewing this topic.

Bobcat

  • Guest
To CreateVehicle or Not to CreateVehicle
« on: 24 Aug 2003, 01:55:01 »
Ok..... hi everyone once again. The last time I talked to you guys was on "Everon Siege" or whatever..... well that didnt quite work out and it is "in the closet" as I like to say.  Now I am starting on a similar idea but it wont as difficult (I hope).  The main idea is an RTS type game.  Tons of objectives and squad customization :D. So far so good except when it came to the whole "recruit a unit" part of the mission......

PROBLEM: ONCE THE NEW UNIT IS CREATED, IT WILL NOT JOIN YOUR SQUAD.

I tried both camCreate and createVehicle. Both did the exact same thing. Also tried a HELLAVA lot of different ways to make him join. No error messages come up but he just wont join my squad  ??? Will keep trying it out but I dont think Im getting anywhere any time soon. PLEASE HELP.

[BEGINNING OF SCRIPT]

recruitXPos= getpos RecruitPos select 0; RecruitPos is a gameLogic
recruitYPos= getpos RecruitPos select 1
recruitZPos= getpos RecruitPos select 2

UnitType= lbCurSel 214
UnitTypeText = lbText [214, UnitType]
~0.5

;This part selects what kind of soldier will be created
? UnitTypeText == "Soldier" : goto  "RECRUITASOLDIER"
? UnitTypeText == "Grenadier" : goto  "RECRUITAGRENADIER"
? UnitTypeText == "Medic" : goto  "RECRUITAMEDIC"
? UnitTypeText == "Machine-Gunner" : goto  "RECRUITAMG"
? UnitTypeText == "LAW-Soldier" : goto  "RECRUITALAW"
? UnitTypeText == "AT-Soldier" : goto  "RECRUITAAT"
? UnitTypeText == "AA-Soldier" : goto  "RECRUITAAA"
? UnitTypeText == "Black-Op" : goto  "RECRUITABO"
? UnitTypeText == "Black-Op(Day)" : goto  "RECRUITABOD"
? UnitTypeText == "Sniper" : goto  "RECRUITASNIPER"
? UnitTypeText == "Engineer" : goto  "RECRUITAENGINEER"
? UnitTypeText == "Crew" : goto  "RECRUITACREW"
? UnitTypeText == "" : closeDialog 0; Close because of stupidity


#RECRUITASOLDIER
newGuy = "SoldierWB" camCreate [recruitXPos,recruitYPos,recruitZPos]
closeDialog 0
~1
units newGuy join (group Soldier1)
Exit

[END OF SCRIPT]

Soldier1 is me. I move to a tent and hit an action that activates a menu :). From this menu I select which kind of unit I want.  Hitting recruit activates this script (I tested it with unit type and each one is created no problem. Just cant get him to be part of my squad). I only kept the first regular soldier because if he doesnt work, none of the others will.  Anyone got any ideas on how to fix this? Or am I just being totally clueless  ???

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:To CreateVehicle or Not to CreateVehicle
« Reply #1 on: 24 Aug 2003, 03:35:44 »
Quote
I tried both camCreate and createVehicle

soso - you haven't tried createUnit yet  ;)

~S~ CD
« Last Edit: 24 Aug 2003, 03:37:44 by Chris Death »
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline Blanco

  • Former Staff
  • ****
Re:To CreateVehicle or Not to CreateVehicle
« Reply #2 on: 24 Aug 2003, 07:57:13 »
lolz!!!
Search or search or search before you ask.

Bobcat

  • Guest
Re:To CreateVehicle or Not to CreateVehicle
« Reply #3 on: 25 Aug 2003, 00:08:56 »
Actually no..... about 5 minutes after I posted this I found out about the createUnit command.... DOH! it sure is tricky to use and I couldnt find any info about it in the command reference... (mabye I am going too fast *shrug*)

But anyway. Problem is now solved. ......Thanks I guess  :P

Code: [Select]
recruitXPos= getpos RecruitPos select 0
recruitYPos= getpos RecruitPos select 1

UnitType= lbCurSel 214
UnitTypeText = lbText [214, UnitType]

? UnitTypeText == "Soldier" : goto  "RECRUITASOLDIER"
? UnitTypeText == "Grenadier" : goto  "RECRUITAGRENADIER"
? UnitTypeText == "Medic" : goto  "RECRUITAMEDIC"
? UnitTypeText == "Machine-Gunner" : goto  "RECRUITAMG"
? UnitTypeText == "LAW-Soldier" : goto  "RECRUITALAW"
? UnitTypeText == "AT-Soldier" : goto  "RECRUITAAT"
? UnitTypeText == "AA-Soldier" : goto  "RECRUITAAA"
? UnitTypeText == "Black-Op" : goto  "RECRUITABO"
? UnitTypeText == "Black-Op(Day)" : goto  "RECRUITABOD"
? UnitTypeText == "Sniper" : goto  "RECRUITASNIPER"
? UnitTypeText == "Engineer" : goto  "RECRUITAENGINEER"
? UnitTypeText == "Crew" : goto  "RECRUITACREW"
? UnitTypeText == "" : closeDialog 0


#RECRUITASOLDIER
rnd1 = random 2
? rnd1 > 0 and rnd1 < 1 : _rank1 = "PRIVATE"
? rnd1 > 0 and rnd1 < 1 : _skill1 = 0.4
? rnd1 > 1 and rnd1 < 2 : _rank1 = "CORPORAL"
? rnd1 > 1 and rnd1 < 2 : _skill1 = 0.5
closeDialog 0
newGuy = "SoldierWB" createUnit [[recruitXPos,recruitYPos],group soldier1,"",_skill1,_rank1]
hint "A soldier was recruited into your squad"
Exit
etc for the rest of the script for each unit. A lot of you are probably asking.... "why do each unit individually?" Well realistically I dont know of any private black ops or colonel medics.....  ::) Also each type can have a different amount of skill corresponding to each rank change. More realistic  ;D


Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:To CreateVehicle or Not to CreateVehicle
« Reply #4 on: 25 Aug 2003, 00:13:22 »
This can't work. CreateUnit doesn't return you an object you could name 'newguy'.

Just use "SoldierWB" createUnit [[recruitXPos,recruitYPos],group soldier1,"",_skill1,_rank1]

CrashnBurn

  • Guest
Re:To CreateVehicle or Not to CreateVehicle
« Reply #5 on: 25 Aug 2003, 01:55:17 »
This can't work. CreateUnit doesn't return you an object you could name 'newguy'.

Just use "SoldierWB" createUnit [[recruitXPos,recruitYPos],group soldier1,"",_skill1,_rank1]

Sure it does...like this-

"SoldierWB" createUnit [_pos,_grp,"newguy=this",_skill,_rank]