Project X Forums

Page 1 of 1

Author:  curtcooll [ Fri Oct 26, 2012 10:01 pm ]
Post subject:  Coding

Hi there i was looking at editing some already made weopens problem is i don't understand how code works trying to make the turret fire mines or rockets how would one go about this i just don't understand ive tried changing some code to CMissile but nothing happens.

Thanks curtis green

Author:  PyroMan [ Sat Nov 17, 2012 11:55 pm ]
Post subject:  Re: Coding

i already made a turrets that shooting with many kinds of weapons. u can check that scripts.

Author:  PyroMan [ Sat Nov 24, 2012 6:54 am ]
Post subject:  Re: Coding

Not enough just to add some CMissile code. Missiles (zook, nades etc from CMissile class) need a launchdata and CDesc for launchning. CDesc contains information about place of shooting, owner (team, worm), speed, angle. ldata contains weapon name and throug it we can change all parameters about explosion delay, sprites, trails.. everything from SchemeWeapon editor. So to launch a CMissile u also need prepare information about the launch.
     CShootDesc SDesc;
     SDesc.Team = WormTeam;
     SDesc.Worm = WormNumber;
     SDesc.X = PositionX; //integer
     SDesc.Y = PositionY; //integer
     SDesc.SpX = 5;  //power 5 ar X axiss (Right side)
     SDesc.SpY = -17.0;  //power 17 at Y axiss (UP).
     SDesc.AddX = targetX; //integer, for homing weapon
     SDesc.AddY = targetY; //integer, for homing weapon
     SDesc.Delay = 5;
     local ldata;
     local weapon;
     ldata = GetWeaponByName("Bazooka");
     weapon = new CMissile(Root->GetObject(25, 0), &ldata->launch, &SDesc);

This code (if u change some variables to integer values) will launch CMissiles. In this case weapon will be bazooka.
Good luck.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group