Project X Forums



It is currently Fri Jun 22, 2018 2:49 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Coding
PostPosted: Fri Oct 26, 2012 10:01 pm 
Offline

Joined: Thu Oct 18, 2012 11:24 pm
Posts: 26
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


Top
 Profile  
Reply with quote  
 Post subject: Re: Coding
PostPosted: Sat Nov 17, 2012 11:55 pm 
Offline
User avatar

Joined: Sun Apr 08, 2012 1:09 pm
Posts: 425
Location: Ukraine, Kyiv
hello.
i already made a turrets that shooting with many kinds of weapons. u can check that scripts.
viewtopic.php?f=13&t=435

_________________
Things to impress.


Top
 Profile  
Reply with quote  
 Post subject: Re: Coding
PostPosted: Sat Nov 24, 2012 6:54 am 
Offline
User avatar

Joined: Sun Apr 08, 2012 1:09 pm
Posts: 425
Location: Ukraine, Kyiv
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.
Code:
     CShootDesc SDesc;
     zero(&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.

_________________
Things to impress.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Skin by Lucas Kane